Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion sky/skylet/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@
# set UV_SYSTEM_PYTHON to false in case the
# user provided docker image set it to true.
# unset PYTHONPATH in case the user provided docker image set it.
SKY_UV_CMD = ('UV_SYSTEM_PYTHON=false '
# UV_LINK_MODE=copy avoids a uv >=0.10.5 bug where clone/reflink mode
# strips execute permissions on XFS filesystems, breaking Ray binaries.
SKY_UV_CMD = ('UV_LINK_MODE=copy UV_SYSTEM_PYTHON=false '
f'{SKY_UNSET_PYTHONPATH_AND_SET_CWD} {SKY_UV_INSTALL_DIR}/uv')
# This won't reinstall uv if it's already installed, so it's safe to re-run.
SKY_UV_INSTALL_CMD = (f'{SKY_UV_CMD} -V >/dev/null 2>&1 || '
Expand Down
4 changes: 2 additions & 2 deletions sky/templates/kubernetes-ray.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -922,15 +922,15 @@ available_node_types:

# set UV_SYSTEM_PYTHON to false in case the user provided docker image set it to true.
# unset PYTHONPATH and set CWD to $HOME to avoid user image interfering with SkyPilot runtime.
VIRTUAL_ENV=~/skypilot-runtime UV_SYSTEM_PYTHON=false {{sky_unset_pythonpath_and_set_cwd}} ~/.local/bin/uv pip install skypilot[kubernetes,remote]
VIRTUAL_ENV=~/skypilot-runtime UV_LINK_MODE=copy UV_SYSTEM_PYTHON=false {{sky_unset_pythonpath_and_set_cwd}} ~/.local/bin/uv pip install skypilot[kubernetes,remote]
# Wait for `patch` package to be installed before applying ray patches
until dpkg -l | grep -q "^ii patch "; do
sleep 0.1
echo "Waiting for patch package to be installed..."
done
# Apply Ray patches for progress bar fix
# ~/.sky/python_path is seeded by conda_installation_commands
VIRTUAL_ENV=~/skypilot-runtime UV_SYSTEM_PYTHON=false {{sky_unset_pythonpath_and_set_cwd}} ~/.local/bin/uv pip list | grep "ray " | grep 2.9.3 2>&1 > /dev/null && {
VIRTUAL_ENV=~/skypilot-runtime UV_LINK_MODE=copy UV_SYSTEM_PYTHON=false {{sky_unset_pythonpath_and_set_cwd}} ~/.local/bin/uv pip list | grep "ray " | grep 2.9.3 2>&1 > /dev/null && {
Comment on lines 923 to +933
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

To improve maintainability and avoid repetition, you could define a Jinja2 variable for the common uv command prefix and reuse it for both uv invocations.

                {%- set uv_cmd_prefix = "VIRTUAL_ENV=~/skypilot-runtime UV_LINK_MODE=copy UV_SYSTEM_PYTHON=false " + sky_unset_pythonpath_and_set_cwd + " ~/.local/bin/uv" %}
                # set UV_SYSTEM_PYTHON to false in case the user provided docker image set it to true.
                # unset PYTHONPATH and set CWD to $HOME to avoid user image interfering with SkyPilot runtime.
                {{ uv_cmd_prefix }} pip install skypilot[kubernetes,remote]
                # Wait for `patch` package to be installed before applying ray patches
                until dpkg -l | grep -q "^ii  patch "; do
                  sleep 0.1
                  echo "Waiting for patch package to be installed..."
                done
                # Apply Ray patches for progress bar fix
                # ~/.sky/python_path is seeded by conda_installation_commands
                {{ uv_cmd_prefix }} pip list | grep "ray " | grep 2.9.3 2>&1 > /dev/null && {

{{sky_unset_pythonpath_and_set_cwd}} $(cat ~/.sky/python_path) -c "from sky.skylet.ray_patches import patch; patch()" || exit 1;
}
touch /tmp/ray_skypilot_installation_complete
Expand Down
Loading