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

[core] Allow uv cache at installation #49176

Merged
merged 10 commits into from
Dec 12, 2024

Conversation

dentiny
Copy link
Contributor

@dentiny dentiny commented Dec 10, 2024

See issue: #49131

This PR provides an option to enable cache for uv.

Signed-off-by: hjiang <dentinyhao@gmail.com>
@dentiny dentiny force-pushed the hjiang/allow-uv-cache branch from 43b39b3 to 6d44972 Compare December 10, 2024 00:44
@dentiny dentiny requested a review from jjyao December 10, 2024 00:45
@dentiny dentiny added the go add ONLY when ready to merge, run all tests label Dec 10, 2024
python,
"-m",
"uv",
"pip",
"install",
"--no-cache",
"" if self._uv_config.get("enable_uv_cache", False) else "--no-cache",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a valid use case where we don't want cache?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, cache lies in shared filesystem, managed by pip or uv.
The side-effect for cache is larger disk consumption.

Copy link

@sfriedowitz sfriedowitz Dec 10, 2024

Choose a reason for hiding this comment

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

Another option that might be worth considering to add is the link mode, which can have a pretty significant impact on cache installation performance depending on filesystem characteristics. Although this can also be configured by an env var (UV_LINK_MODE), so I would understand not wanting to expand the number of arguments here.

Copy link
Collaborator

Choose a reason for hiding this comment

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

uv pip install --help displays tons of options. Instead of explicitly add support for each of them, one way is that we can have a single uv_pip_install_options argument which is a list of strings (default is ["--no-cache"]), this way user has the most flexibility to specify whatever options they want. One downside is that user is more likely to shoot themselves in the foot but as long as we can surface good error messages it should be fine. WDYT @sfriedowitz @pcmoritz?

Choose a reason for hiding this comment

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

That would work great for my use case!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! I updated my implementation based on the suggestion.

@dentiny dentiny requested a review from jjyao December 10, 2024 01:32
Signed-off-by: hjiang <hjiang@anyscale.com>
@dentiny dentiny force-pushed the hjiang/allow-uv-cache branch from bbcfd66 to 6f4a7d6 Compare December 10, 2024 10:07
Signed-off-by: hjiang <dentinyhao@gmail.com>
Signed-off-by: hjiang <dentinyhao@gmail.com>
@dentiny dentiny requested a review from a team as a code owner December 10, 2024 22:28
@dentiny dentiny requested a review from pcmoritz December 10, 2024 22:28
Signed-off-by: hjiang <hjiang@anyscale.com>
Signed-off-by: hjiang <hjiang@anyscale.com>
Signed-off-by: hjiang <hjiang@anyscale.com>
@dentiny dentiny requested review from sfriedowitz and jjyao December 11, 2024 07:13
Copy link
Collaborator

@jjyao jjyao left a comment

Choose a reason for hiding this comment

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

LG

doc/source/ray-core/handling-dependencies.rst Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/uv.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/validation.py Outdated Show resolved Hide resolved
python/ray/_private/runtime_env/validation.py Outdated Show resolved Hide resolved
Signed-off-by: hjiang <hjiang@anyscale.com>
@dentiny dentiny requested a review from jjyao December 11, 2024 22:43
python/ray/_private/runtime_env/uv.py Outdated Show resolved Hide resolved
Signed-off-by: hjiang <hjiang@anyscale.com>
@dentiny
Copy link
Contributor Author

dentiny commented Dec 12, 2024

Hi @jjyao , could you please help me merge the PR? Thank you!

@jjyao
Copy link
Collaborator

jjyao commented Dec 12, 2024

Waiting for approval from doc team.

@dentiny dentiny requested review from angelinalg and removed request for sfriedowitz December 12, 2024 05:49
@dentiny dentiny requested a review from sfriedowitz December 12, 2024 05:50
Signed-off-by: hjiang <dentinyhao@gmail.com>
@jjyao jjyao enabled auto-merge (squash) December 12, 2024 20:50
@jjyao jjyao merged commit 691047a into ray-project:master Dec 12, 2024
6 checks passed
ujjawal-khare pushed a commit to ujjawal-khare-27/ray that referenced this pull request Dec 17, 2024
Signed-off-by: hjiang <dentinyhao@gmail.com>
Signed-off-by: ujjawal-khare <ujjawal.khare@dream11.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants