Skip to content
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

[runtime_env] Remote whl support #39407

Merged
merged 15 commits into from
Sep 26, 2023
Merged

Conversation

jonathan-anyscale
Copy link
Contributor

@jonathan-anyscale jonathan-anyscale commented Sep 7, 2023

Why are these changes needed?

Refactor runtime_env to support remote wheel for py_modules
Unit test: Combined in test_runtime_env_working_dir_remote_uri.py

Related issue number

Closes #35804

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: Jonathan Nitisastro <[email protected]>
@architkulkarni
Copy link
Contributor

@jonathan-anyscale is this ready for review or still WIP?

@jonathan-anyscale jonathan-anyscale changed the title [runtime_env] remote whl to zip converter [runtime_env] remote whl to zip converter (WIP) Sep 8, 2023
@jonathan-anyscale
Copy link
Contributor Author

@jonathan-anyscale is this ready for review or still WIP?

still WIP, doing some refactor instead of this method and trying to test it right now

@jonathan-anyscale jonathan-anyscale marked this pull request as draft September 8, 2023 16:47
@jonathan-anyscale jonathan-anyscale marked this pull request as ready for review September 12, 2023 17:07
@jonathan-anyscale jonathan-anyscale changed the title [runtime_env] remote whl to zip converter (WIP) [runtime_env] Remote whl support Sep 12, 2023
Copy link
Contributor

@architkulkarni architkulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall, just a few minor comments and questions. @jjyao can you review this as well?

python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/py_modules.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/working_dir.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/working_dir.py Outdated Show resolved Hide resolved
Signed-off-by: Jonathan Nitisastro <[email protected]>
Copy link
Contributor

@architkulkarni architkulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The last round of changes looks good! One question is that now we're allowing a user to set a working_dir to a remote .whl file. Even though it technically makes sense because a whl file happens to be a zip of a directory, I think it might be confusing for users, so it would be better to just disallow it. What do you think? We can always add it later if users ask for it.

Also, please update the documentation in this PR to reflect the change. It's on this page https://docs.ray.io/en/latest/ray-core/handling-dependencies.html

@architkulkarni
Copy link
Contributor

Looks like one or more tests may need to be updated, e.g.: https://buildkite.com/ray-project/oss-ci-build-pr/builds/36008#018a8c11-1593-4e10-9d3d-11694b724e24/3606-4413

@jonathan-anyscale
Copy link
Contributor Author

The last round of changes looks good! One question is that now we're allowing a user to set a working_dir to a remote .whl file. Even though it technically makes sense because a whl file happens to be a zip of a directory, I think it might be confusing for users, so it would be better to just disallow it. What do you think? We can always add it later if users ask for it.

Also, please update the documentation in this PR to reflect the change. It's on this page https://docs.ray.io/en/latest/ray-core/handling-dependencies.html

Okk make sense, I didn't check before that local whl is not supported for working_dir as well. So I agree with disallowing it as user can just fill py_modules field for .whl file

Signed-off-by: Jonathan Nitisastro <[email protected]>
Signed-off-by: Jonathan Nitisastro <[email protected]>
@jonathan-anyscale jonathan-anyscale requested a review from a team as a code owner September 13, 2023 21:23
Copy link
Contributor

@architkulkarni architkulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! If there are failing tests that look unrelated, you can check against https://flaky-tests.ray.io/ to see if they're flaky on master, list out the ones that failed and mark the PR with the tests-ok.

python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
@angelinalg
Copy link
Contributor

Just had a few minor nits.

Co-authored-by: angelinalg <[email protected]>
Signed-off-by: jonathan-anyscale <[email protected]>
Co-authored-by: angelinalg <[email protected]>
Signed-off-by: jonathan-anyscale <[email protected]>
Co-authored-by: angelinalg <[email protected]>
Signed-off-by: jonathan-anyscale <[email protected]>
python/ray/_private/runtime_env/packaging.py Show resolved Hide resolved
# Don't modify the .whl filename. See
# https://peps.python.org/pep-0427/#file-name-convention
# for more informationl.
package_name = pkg_uri.split("/")[-1]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this cause conflict since we only use the filename of whl instead of the entire uri? Like if I have both s3:https://A/package.whl and s3:https://B/package.whl.

Copy link
Contributor Author

@jonathan-anyscale jonathan-anyscale Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fine since whl filename is uniquely generated when we create it. The only conflict is when the user want to use package with same name which is unlikely.
Also, this filename will only used to save locally, which the file will be deleted after installation so shouldn't be any conflict.

python/ray/_private/runtime_env/packaging.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/working_dir.py Outdated Show resolved Hide resolved
@@ -883,3 +901,34 @@ def delete_package(pkg_uri: str, base_directory: str) -> Tuple[bool, int]:
deleted = True

return deleted


async def install_wheel_package(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we move to here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Initially I thought working_dir will support remote wheel as well but it isn't by our definition of working_dir.
But this function is generally used to install wheel package, so might as well move it outside from py_modules for general usage later.

Signed-off-by: Jonathan Nitisastro <[email protected]>
Signed-off-by: Jonathan Nitisastro <[email protected]>
Signed-off-by: Jonathan Nitisastro <[email protected]>
@jjyao jjyao merged commit 3e8aad8 into ray-project:master Sep 26, 2023
82 of 89 checks passed
simonsays1980 pushed a commit to simonsays1980/ray that referenced this pull request Sep 26, 2023
Refactor runtime_env to support remote wheel for py_modules

Signed-off-by: Jonathan Nitisastro <[email protected]>
Signed-off-by: jonathan-anyscale <[email protected]>
Co-authored-by: angelinalg <[email protected]>
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
Refactor runtime_env to support remote wheel for py_modules

Signed-off-by: Jonathan Nitisastro <[email protected]>
Signed-off-by: jonathan-anyscale <[email protected]>
Co-authored-by: angelinalg <[email protected]>
Signed-off-by: Victor <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[runtime env] Support .whl files in Remote URI
4 participants