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] [5/N] Check uv existence before installation #48632

Merged
merged 5 commits into from
Nov 8, 2024

Conversation

dentiny
Copy link
Contributor

@dentiny dentiny commented Nov 7, 2024

This PR checks uv existence before installation, if uv version not specified by the users.

@@ -62,6 +64,28 @@ async def _install_uv(
logger.info("Installing package uv to %s", virtualenv_path)
await check_output_cmd(uv_install_cmd, logger=logger, cwd=cwd, env=pip_env)

# TODO(hjiang): Add an integration test for existence check after
# PR (https://github.com/ray-project/ray/pull/48619) gets merged.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My planned way to test:

  • In integration test with ray.remote having uv specified, making sure all packages correctly installed;
  • Call _check_uv_existence to make sure uv does exist in virtual env.

@dentiny dentiny added the go add ONLY when ready to merge, run all tests label Nov 7, 2024
async def _check_uv_existence(
self, path: str, cwd: str, env: dict, logger: logging.Logger
) -> bool:
"""Check and return the existence of `uv` in system executable path."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is checking the existence of uv inside the virtualenv we create for the runtime env right

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

@@ -91,6 +93,28 @@ async def _install_uv(
logger.info("Installing package uv to %s", virtualenv_path)
await check_output_cmd(uv_install_cmd, logger=logger, cwd=cwd, env=pip_env)

# TODO(hjiang): Add an integration test for existence check after
# PR (https://github.com/ray-project/ray/pull/48619) gets merged.
Copy link
Collaborator

Choose a reason for hiding this comment

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

48619 is merged now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just realize it's not a good way to test:

  • Runtime env agent runs in a separate process, which means at integration test, I have no access to UvProcessor
  • After task completion, the runtime env is deleted, so virtual env is expected to not found

python/ray/_private/runtime_env/uv.py Outdated Show resolved Hide resolved
@jjyao jjyao enabled auto-merge (squash) November 8, 2024 21:57
@jjyao jjyao merged commit ecbc176 into ray-project:master Nov 8, 2024
6 checks passed
JP-sDEV pushed a commit to JP-sDEV/ray that referenced this pull request Nov 14, 2024
mohitjain2504 pushed a commit to mohitjain2504/ray that referenced this pull request Nov 15, 2024
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.

2 participants