-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Feat][Core] Implement single file module for runtime_env #47807
[Feat][Core] Implement single file module for runtime_env #47807
Conversation
e6afa5d
to
175cdf5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally LGTM. Left with some wording issues. Also can you add a real Ray running test in python/ray/tests/test_runtime_env_working_dir.py ?
The following screencast shows that the zip file actually only contains single file even if its parent folder contains multiple files. 2024-09-25.16-43-02.mp4Explanation:
I've renamed some variables and add more comments in 2957106 to make it clear. |
9acb04b
to
2957106
Compare
Added tests for single file module in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Other than 1 nit on naming we can merge this.
Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
Signed-off-by: Chi-Sheng Liu <[email protected]>
Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
…king_dir.py Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
Closes: ray-project#23151 Signed-off-by: Chi-Sheng Liu <[email protected]>
a0d5bc2
to
ea58122
Compare
@angelinalg Hi this PR updates the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some style nits and some clarification for confusing sentence. Please correct if I introduced inaccuracies.
) -> bytes: | ||
"""Helper function to create hash of a single file or directory. | ||
|
||
This function will hash the path of the file or directory, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will hash the path of the file or directory, | |
This function hashes the path of the file or directory, |
"""Helper function to create hash of a single file or directory. | ||
|
||
This function will hash the path of the file or directory, | ||
and if it's a file, it'll hash its content too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if it's a file, it'll hash its content too. | |
and if it's a file, then it hashes its content too. |
except Exception as e: | ||
logger.debug( | ||
f"Skipping contents of file {filepath} when calculating package hash " | ||
f"because the file could not be opened: {e}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
f"because the file could not be opened: {e}" | |
f"because the file couldn't be opened: {e}" |
) -> bytes: | ||
"""Helper function to create hash of a single file. | ||
|
||
It'll hash the path of the file and its content to create a hash value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll hash the path of the file and its content to create a hash value. | |
It hashes the path of the file and its content to create a hash value. |
def get_uri_for_file(file: str) -> str: | ||
"""Get a content-addressable URI from a file's content. | ||
|
||
This function will generate the name of the package by the file. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function will generate the name of the package by the file. | |
This function generates the name of the package by the file. |
"""Get a content-addressable URI from a file's content. | ||
|
||
This function will generate the name of the package by the file. | ||
The final package name is: _ray_pkg_<HASH_VAL>.zip of this package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The final package name is: _ray_pkg_<HASH_VAL>.zip of this package. | |
The final package name is _ray_pkg_<HASH_VAL>.zip, where <HASH_VAL> is a hash of this package. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't understand what you meant to say in this sentence. This is a guess at a rewrite. Please correct if needed.
|
||
This function will generate the name of the package by the file. | ||
The final package name is: _ray_pkg_<HASH_VAL>.zip of this package. | ||
e.g., _ray_pkg_029f88d5ecc55e1e4d64fc6e388fd103.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e.g., _ray_pkg_029f88d5ecc55e1e4d64fc6e388fd103.zip | |
For example: _ray_pkg_029f88d5ecc55e1e4d64fc6e388fd103.zip |
Oops! Auto-merged without applying the doc reviews. @MortalHappiness would you mind updating the docs in another PR? |
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
…t#47807) Supports single file modules in `py_module` runtime_env. Signed-off-by: Chi-Sheng Liu <[email protected]> Signed-off-by: ujjawal-khare <[email protected]>
Why are these changes needed?
See the description in the corresponding issue for details.
Related issue number
Closes #23151
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.