-
Notifications
You must be signed in to change notification settings - Fork 75
[DataLoader] Support setting JVM args when using JNI #529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
c9dd623
Add jvm_args support to DataLoaderContext
robreeves b342b26
Fix ruff formatting
robreeves 8c1ee7e
Extract LIBHDFS_OPTS env var name to constant
robreeves ed157d5
Defer UDF session creation until after first HDFS read
robreeves cdca869
Add integration test to verify JVM honors planner_jvm_args
robreeves 2807d7f
Verify both planner and worker jvm_args in integration tests
robreeves 2b47f63
Move jvm_args verification before 'All tests passed' message
robreeves 26cfab7
Clarify jvm_args docs: JNI-only, once-per-process semantics
robreeves 810a8b9
Extract JvmConfig from DataLoaderContext
robreeves 23cc91a
Fix JvmConfig docstring wording
robreeves 5451c15
Rename jvm field to jvm_config on DataLoaderContext
robreeves 457da7b
Update JvmConfig docstring to say 'storage access'
robreeves 02bbb42
Make apply_libhdfs_opts idempotent and thread-safe
robreeves e9c3ec3
Add worker_jvm_args to TableScanContext docstring; remove temp file c…
robreeves 2823a3c
Address PR review comments
robreeves e3024fc
Make JvmConfig a frozen dataclass
robreeves 7be131d
Update DataLoaderContext.jvm_config docstring wording
robreeves File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
integrations/python/dataloader/src/openhouse/dataloader/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
integrations/python/dataloader/src/openhouse/dataloader/_jvm.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| """JVM configuration utilities for the HDFS client.""" | ||
|
|
||
| import logging | ||
| import os | ||
| import threading | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
| LIBHDFS_OPTS_ENV = "LIBHDFS_OPTS" | ||
| """Environment variable read by libhdfs when starting the JNI JVM.""" | ||
|
|
||
| _lock = threading.Lock() | ||
|
|
||
|
|
||
| def apply_libhdfs_opts(jvm_args: str) -> None: | ||
| """Merge *jvm_args* into the JNI JVM options environment variable. | ||
|
|
||
| Appends to any existing value. Must be called before the first | ||
| HDFS access in the current process (the JVM is started once and | ||
| reads these options only at startup). Thread-safe and idempotent — | ||
| duplicate args are not appended. | ||
| """ | ||
| with _lock: | ||
| existing = os.environ.get(LIBHDFS_OPTS_ENV, "") | ||
| if jvm_args in existing: | ||
| return | ||
| merged = f"{existing} {jvm_args}".strip() if existing else jvm_args | ||
robreeves marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| os.environ[LIBHDFS_OPTS_ENV] = merged | ||
| logger.info("Set %s=%s", LIBHDFS_OPTS_ENV, merged) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.