Skip to content

Commit f27f946

Browse files
committed
[Core] Upgrade the bundled Ray to 2.56.1
Ray 2.9.3 is from January 2024 and carries CVE-2025-62593, a dashboard RCE (CVSS 9.4, in CISA KEV) fixed in 2.52.0. 2.56.1 is the newest release that still supports Python 3.8-3.11. The seven patches were re-triaged against the new source rather than regenerated blindly: - cli.py is deleted. It rewrote `ray job submit` output, and nothing has called `ray job submit` since #4318. - resource_demand_scheduler loses one of its two hunks: the `assert not unfulfilled` it removed is gone upstream. - The remaining five still apply, and are regenerated against ray-2.56.1. Four of them (autoscaler, command_runner, resource_demand_scheduler, updater) only run under ProvisionerVersion.RAY_AUTOSCALER, which is IBM alone -- untested here, see the PR description. monkey_patch_hash_launch_conf now delegates to Ray's own hash_launch_conf instead of copying it. `ray up` runs against whatever Ray the client has, and Ray has already changed this digest once (sha1/hexdigest -> sha256/base32hex); a copy silently disagrees with the hash Ray's node_launcher writes for worker nodes. Only the ssh_proxy_command exclusion stays ours. Images and docs are bumped alongside, and a test asserts every such pin still agrees with SKY_REMOTE_RAY_VERSION -- a stale one fails silently, since the patch guards simply skip.
1 parent 3679604 commit f27f946

24 files changed

Lines changed: 183 additions & 129 deletions

Dockerfile_k8s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ RUN ARCH=${TARGETARCH:-$(case "$(uname -m)" in \
7373
$HOME/.local/bin/uv venv ~/skypilot-runtime --seed --python=3.10 && \
7474
source ~/skypilot-runtime/bin/activate && \
7575
$HOME/.local/bin/uv pip install 'skypilot-nightly[remote,kubernetes]' \
76-
'ray[default]==2.9.3' 'pycryptodome==3.12.0' && \
76+
'ray[default]==2.56.1' 'pycryptodome==3.12.0' && \
7777
$HOME/.local/bin/uv pip uninstall skypilot-nightly && \
7878
curl -LO "https://dl.k8s.io/release/v1.33.12/bin/linux/$ARCH/kubectl" && \
7979
# Install kubectl to user's local bin instead of system path to avoid

Dockerfile_k8s_gpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ RUN ARCH=${TARGETARCH:-$(case "$(uname -m)" in \
7878
$HOME/.local/bin/uv venv ~/skypilot-runtime --seed --python=3.10 && \
7979
source ~/skypilot-runtime/bin/activate && \
8080
$HOME/.local/bin/uv pip install 'skypilot-nightly[remote,kubernetes]' \
81-
'ray[default]==2.9.3' 'pycryptodome==3.12.0' && \
81+
'ray[default]==2.56.1' 'pycryptodome==3.12.0' && \
8282
$HOME/.local/bin/uv pip uninstall skypilot-nightly && \
8383
curl -LO "https://dl.k8s.io/release/v1.33.12/bin/linux/$ARCH/kubectl" && \
8484
# Install kubectl to user's local bin instead of system path to avoid

docs/source/reference/architecture/internals.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ SkyPilot starts its Ray cluster when provisioning nodes:
7575

7676
- On the head node: ``ray start --head`` with port 6380 and custom resource configurations
7777
- On worker nodes: ``ray start --address`` connecting to the head node's internal IP
78-
- Ray version is set to ``2.9.3`` in ``SKY_REMOTE_RAY_VERSION``
78+
- Ray version is set to ``2.56.1`` in ``SKY_REMOTE_RAY_VERSION``
7979
- Runtime environment: ``skypilot-runtime`` conda environment
8080

8181
**Important considerations for users:**

docs/source/reference/kubernetes/kubernetes-getting-started.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ FAQs
454454
RUN export PIP_DISABLE_PIP_VERSION_CHECK=1 && \
455455
python3 -m venv ~/skypilot-runtime && \
456456
PYTHON_EXEC=$(echo ~/skypilot-runtime)/bin/python && \
457-
$PYTHON_EXEC -m pip install 'skypilot-nightly[remote,kubernetes]' 'ray[default]==2.9.3' 'pycryptodome==3.12.0' && \
457+
$PYTHON_EXEC -m pip install 'skypilot-nightly[remote,kubernetes]' 'ray[default]==2.56.1' 'pycryptodome==3.12.0' && \
458458
$PYTHON_EXEC -m pip uninstall skypilot-nightly -y && \
459459
curl -LO "https://dl.k8s.io/release/v1.28.11/bin/linux/amd64/kubectl" && \
460460
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \

sky/backends/monkey_patches/monkey_patch_ray_up.py

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
a cluster is first created. This then makes it possible for us to support
1010
changing the proxy command without changing the launch hash in the future.
1111
12-
2. The _should_create_new_head() function inside Ray autoscaler to avoid the ray up
12+
2. The _should_create_new_head() function inside Ray autoscaler to avoid the ray up
1313
checking the launch hash when creating the head node.
1414
1515
Reasons:
@@ -26,32 +26,21 @@
2626
the logic for considering what worker nodes to restart/"reuse" is in node_provider.py's
2727
create_node(), the same code for deciding what head node to restart/"reuse".
2828
"""
29-
import hashlib
30-
import json
31-
import os
32-
3329
from ray.autoscaler import sdk
30+
from ray.autoscaler._private import util as ray_autoscaler_util
3431

3532

36-
# Ref: https://github.com/ray-project/ray/blob/releases/2.4.0/python/ray/autoscaler/_private/util.py#L396-L408
33+
# Delegate to Ray's own implementation rather than copying it: `ray up` runs
34+
# against whatever Ray the client has installed, and Ray has already changed
35+
# this digest once (sha1/hexdigest -> sha256/base32hex). A copy would silently
36+
# disagree with the hash Ray's own node_launcher writes for worker nodes.
3737
def monkey_patch_hash_launch_conf(node_conf, auth):
38-
hasher = hashlib.sha1()
39-
# For hashing, we replace the path to the key with the key
40-
# itself. This is to make sure the hashes are the same even if keys
41-
# live at different locations on different machines.
42-
full_auth = auth.copy()
43-
full_auth.pop('ssh_proxy_command', None) # NOTE: skypilot changes.
44-
for key_type in ['ssh_private_key', 'ssh_public_key']:
45-
if key_type in auth:
46-
with open(os.path.expanduser(auth[key_type]),
47-
encoding='utf-8') as key:
48-
full_auth[key_type] = key.read()
49-
hasher.update(
50-
json.dumps([node_conf, full_auth], sort_keys=True).encode('utf-8'))
51-
return hasher.hexdigest()
38+
# NOTE: skypilot change -- exclude ssh_proxy_command from the hash.
39+
auth = {k: v for k, v in auth.items() if k != 'ssh_proxy_command'}
40+
return ray_autoscaler_util.hash_launch_conf(node_conf, auth)
5241

5342

54-
# Ref: https://github.com/ray-project/ray/blob/releases/2.4.0/python/ray/autoscaler/_private/commands.py#L854-L912
43+
# Ref: https://github.com/ray-project/ray/blob/ray-2.56.1/python/ray/autoscaler/_private/commands.py#L999-L1057
5544
def monkey_patch_should_create_new_head(
5645
head_node_id,
5746
new_launch_hash,

sky/catalog/images/provisioners/skypilot.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,16 @@ PYTHON_EXEC=$(echo ~/skypilot-runtime)/bin/python
5656
$PYTHON_EXEC -m pip install "skypilot-nightly[remote]"
5757

5858
# Install Ray
59+
# Keep RAY_VERSION in sync with SKY_REMOTE_RAY_VERSION in skylet.constants.
5960
# Pin click<8.3.0: click 8.3.0+ breaks Ray CLI due to deepcopy issues with
6061
# Sentinel values. See https://github.com/ray-project/ray/issues/56747.
62+
RAY_VERSION=2.56.1
6163
RAY_ADDRESS=127.0.0.1:6380
62-
$PYTHON_EXEC -m pip install --exists-action w -U "ray[default]==2.9.3" "click<8.3.0"
64+
$PYTHON_EXEC -m pip install --exists-action w -U "ray[default]==$RAY_VERSION" "click<8.3.0"
6365
export PATH=$PATH:$HOME/.local/bin
6466
source ~/skypilot-runtime/bin/activate
6567
which ray > ~/.sky/ray_path || exit 1
66-
$PYTHON_EXEC -m pip list | grep "ray " | grep 2.9.3 2>&1 > /dev/null && {
68+
$PYTHON_EXEC -m pip list | grep "ray " | grep $RAY_VERSION 2>&1 > /dev/null && {
6769
$PYTHON_EXEC -c "from sky.skylet.ray_patches import patch; patch()" || exit 1
6870
}
6971

sky/provision/docker_utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
# Configure environment variables. A docker image can have environment variables
1717
# set in the Dockerfile with `ENV``. We need to export these variables to the
1818
# shell environment, so that our ssh session can access them.
19-
# Filter out RAY_RUNTIME_ENV_HOOK to prevent Ray version conflicts.
20-
# Docker images with Ray 2.48.0+ set this for UV package manager support,
21-
# but it causes FAILED_DRIVER errors with SkyPilot's Ray 2.9.3.
19+
# Filter out RAY_RUNTIME_ENV_HOOK to prevent Ray version conflicts. Docker
20+
# images with Ray 2.48.0+ set this for UV package manager support, pointing at
21+
# the image's own Ray rather than the one in SkyPilot's runtime venv, which
22+
# causes FAILED_DRIVER errors.
2223
# See: https://github.com/skypilot-org/skypilot/pull/7181
2324
SETUP_ENV_VARS_CMD = (
2425
'prefix_cmd() '

sky/skylet/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# i.e. the PORT_DICT_STR above.
5555
SKY_REMOTE_RAY_PORT_FILE = '.sky/ray_port.json'
5656
SKY_REMOTE_RAY_TEMPDIR = '/tmp/ray_skypilot'
57-
SKY_REMOTE_RAY_VERSION = '2.9.3'
57+
SKY_REMOTE_RAY_VERSION = '2.56.1'
5858

5959
# To avoid user image causing issue with the SkyPilot runtime, we run SkyPilot
6060
# commands the following prefix:

sky/skylet/ray_patches/apply_patches.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
_PATCHES = [
2525
('ray._private.log_monitor', 'log_monitor.py.patch'),
2626
('ray._private.worker', 'worker.py.patch'),
27-
('ray.dashboard.modules.job.cli', 'cli.py.patch'),
2827
('ray.autoscaler._private.autoscaler', 'autoscaler.py.patch'),
2928
('ray.autoscaler._private.command_runner', 'command_runner.py.patch'),
3029
('ray.autoscaler._private.resource_demand_scheduler',

sky/skylet/ray_patches/autoscaler.py.diff

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
--- a/autoscaler.py
22
+++ b/autoscaler.py
33
@@ -1,3 +1,6 @@
4-
+# From https://github.com/ray-project/ray/blob/ray-2.9.3/python/ray/autoscaler/_private/autoscaler.py
4+
+# From https://github.com/ray-project/ray/blob/ray-2.56.1/python/ray/autoscaler/_private/autoscaler.py
55
+# Sky patch changes:
66
+# - enable upscaling_speed to be 0.0
77
import copy
88
import logging
99
import math
10-
@@ -1071,7 +1074,7 @@
10+
@@ -1117,7 +1120,7 @@
1111
upscaling_speed = self.config.get("upscaling_speed")
1212
aggressive = self.config.get("autoscaling_mode") == "aggressive"
1313
target_utilization_fraction = self.config.get("target_utilization_fraction")

0 commit comments

Comments
 (0)