Skip to content

Commit f1207f1

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: make final updates to include Ray v2.47.1 support on SDK, make 2.47.1 the default Ray version.
PiperOrigin-RevId: 785583340
1 parent 8e473c2 commit f1207f1

9 files changed

Lines changed: 70 additions & 23 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Format: //devtools/kokoro/config/proto/build.proto
2+
3+
# Run unit tests for Ray 2.47.1 on Python 3.11
4+
env_vars: {
5+
key: "NOX_SESSION"
6+
value: "unit_ray-3.11(ray='2.47.1')"
7+
}
8+
9+
# Run unit tests in parallel, splitting up by file
10+
env_vars: {
11+
key: "PYTEST_ADDOPTS"
12+
value: "-n=auto --dist=loadscope"
13+
}

google/cloud/aiplatform/vertex_ray/cluster_init.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@
5353

5454
def create_ray_cluster(
5555
head_node_type: Optional[resources.Resources] = resources.Resources(),
56-
python_version: Optional[str] = "3.10",
57-
ray_version: Optional[str] = "2.42",
56+
python_version: Optional[str] = None,
57+
ray_version: Optional[str] = "2.47",
5858
network: Optional[str] = None,
5959
service_account: Optional[str] = None,
6060
cluster_name: Optional[str] = None,
@@ -78,15 +78,15 @@ def create_ray_cluster(
7878
node_count=1,
7979
accelerator_type="NVIDIA_TESLA_T4",
8080
accelerator_count=1,
81-
custom_image="us-docker.pkg.dev/my-project/ray-cpu-image.2.33:latest", # Optional
81+
custom_image="us-docker.pkg.dev/my-project/ray-2-47-cpu-py3.11:latest", # Optional
8282
)
8383
8484
worker_node_types = [Resources(
8585
machine_type="n1-standard-8",
8686
node_count=2,
8787
accelerator_type="NVIDIA_TESLA_T4",
8888
accelerator_count=1,
89-
custom_image="us-docker.pkg.dev/my-project/ray-gpu-image.2.33:latest", # Optional
89+
custom_image="us-docker.pkg.dev/my-project/ray-2-47-gpu-py3.11:latest", # Optional
9090
)]
9191
9292
cluster_resource_name = vertex_ray.create_ray_cluster(
@@ -95,7 +95,7 @@ def create_ray_cluster(
9595
service_account="my-service-account@my-project-number.iam.gserviceaccount.com", # Optional
9696
cluster_name="my-cluster-name", # Optional
9797
worker_node_types=worker_node_types,
98-
ray_version="2.33",
98+
ray_version="2.47",
9999
)
100100
101101
After a ray cluster is set up, you can call
@@ -109,7 +109,7 @@ def create_ray_cluster(
109109
head_node_type: The head node resource. Resources.node_count must be 1.
110110
If not set, default value of Resources() class will be used.
111111
python_version: Python version for the ray cluster.
112-
ray_version: Ray version for the ray cluster. Default is 2.42.0.
112+
ray_version: Ray version for the ray cluster. Default is 2.47.1.
113113
network: Virtual private cloud (VPC) network. For Ray Client, VPC
114114
peering is required to connect to the Ray Cluster managed in the
115115
Vertex API service. For Ray Job API, VPC network is not required
@@ -162,7 +162,7 @@ def create_ray_cluster(
162162
local_ray_verion = _validation_utils.get_local_ray_version()
163163
if ray_version != local_ray_verion:
164164
if custom_images is None and head_node_type.custom_image is None:
165-
install_ray_version = "2.42.0"
165+
install_ray_version = "2.47.1"
166166
logging.info(
167167
"[Ray on Vertex]: Local runtime has Ray version %s"
168168
", but the requested cluster runtime has %s. Please "

google/cloud/aiplatform/vertex_ray/util/_validation_utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
)
4141
_V2_9_WARNING_MESSAGE = (
4242
"In March 2025, using Ray version = 2.9 will result in an error. "
43-
"Please use Ray version = 2.33.0, 2.42.0, or 2.47.1 (default) instead."
43+
"Please use Ray version = 2.33.0, 2.42.0 or 2.47.1 (default) instead."
4444
)
4545

4646

@@ -107,6 +107,11 @@ def get_image_uri(ray_version, python_version, enable_cuda):
107107
list(SUPPORTED_RAY_VERSIONS.values())[1],
108108
)
109109
)
110+
if python_version is None:
111+
for pv, ray_versions in SUPPORTED_RAY_VERSIONS_FROM_PYTHON_VERSIONS.items():
112+
if ray_version in ray_versions:
113+
python_version = pv
114+
break
110115
if python_version not in SUPPORTED_RAY_VERSIONS_FROM_PYTHON_VERSIONS:
111116
raise ValueError(
112117
"[Ray on Vertex AI]: The supported Python versions are 3.10 or 3.11."

google/cloud/aiplatform/vertex_ray/util/resources.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,23 @@ class NodeImages:
7070
"""Custom images for a ray cluster.
7171
7272
We currently support Ray v2.9, v2.33, v2.42 and python v3.10.
73-
We also support python v3.11 for Ray v2.42.
73+
We also support python v3.11 for Ray v2.42 and v2.47.
7474
The custom images must be extended from the following base images:
7575
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-9.py310:latest",
7676
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-9.py310:latest",
7777
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-33.py310:latest",
7878
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-33.py310:latest",
7979
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-42.py310:latest",
8080
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-42.py310:latest",
81-
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-42.py311:latest", or
82-
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-42.py311:latest". In
81+
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-42.py311:latest",
82+
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-42.py311:latest".
83+
"{region}-docker.pkg.dev/vertex-ai/training/ray-cpu.2-47.py311:latest", or
84+
"{region}-docker.pkg.dev/vertex-ai/training/ray-gpu.2-47.py311:latest". In
8385
order to use custom images, need to specify both head and worker images.
8486
8587
Attributes:
86-
head: image for head node (eg. us-docker.pkg.dev/my-project/ray-cpu.2-33.py310-tf:latest).
87-
worker: image for all worker nodes (eg. us-docker.pkg.dev/my-project/ray-gpu.2-33.py310-tf:latest).
88+
head: image for head node (eg. us-docker.pkg.dev/my-project/ray-cpu.2-47.py311:latest).
89+
worker: image for all worker nodes (eg. us-docker.pkg.dev/my-project/ray-gpu.2-47.py311:latest).
8890
"""
8991

9092
head: str = None
@@ -151,8 +153,8 @@ class Cluster:
151153
service_account: Service account to be used for running Ray programs on
152154
the cluster.
153155
state: Describes the cluster state (defined in PersistentResource.State).
154-
python_version: Python version for the ray cluster (e.g. "3.10").
155-
ray_version: Ray version for the ray cluster (e.g. "2.33").
156+
python_version: Python version for the ray cluster (e.g. "3.11").
157+
ray_version: Ray version for the ray cluster (e.g. "2.47").
156158
head_node_type: The head node resource. Resources.node_count must be 1.
157159
If not set, by default it is a CPU node with machine_type of n1-standard-8.
158160
worker_node_types: The list of Resources of the worker nodes. Should not

noxfile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
UNIT_TEST_LLAMA_INDEX_PYTHON_VERSIONS = ["3.9", "3.10", "3.11", "3.12"]
5858
PYTHON_TO_RAY_VERSIONS = {
5959
"3.10": ["2.9.3", "2.33.0", "2.42.0"],
60-
"3.11": ["2.42.0"],
60+
"3.11": ["2.42.0", "2.47.1"],
6161
}
6262
UNIT_TEST_STANDARD_DEPENDENCIES = [
6363
"mock",
@@ -261,7 +261,7 @@ def unit_genai_minimal_dependencies(session):
261261

262262

263263
@nox.session(python=["3.10", "3.11"])
264-
@nox.parametrize("ray", ["2.9.3", "2.33.0", "2.42.0"])
264+
@nox.parametrize("ray", ["2.9.3", "2.33.0", "2.42.0", "2.47.1"])
265265
def unit_ray(session, ray):
266266
# check if ray version is supported
267267
if ray not in PYTHON_TO_RAY_VERSIONS[session.python]:

testing/constraints-ray-2.47.1.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
ray==2.47.1
2+
# Below constraints are inherited from constraints-3.10.txt
3+
google-api-core
4+
proto-plus==1.22.3
5+
protobuf
6+
mock==4.0.2
7+
google-cloud-storage==2.2.1 # Increased for kfp 2.0 compatibility
8+
packaging==24.1 # Increased to unbreak canonicalize_version error (b/377774673)
9+
grpcio-testing==1.34.0
10+
mlflow==1.30.1 # Pinned to speed up installation
11+
pytest-xdist==3.3.1 # Pinned to unbreak unit tests
12+
IPython # Added to test supernova rich html buttons
13+

tests/unit/vertex_ray/test_cluster_init.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def cluster_eq(returned_cluster, expected_cluster):
290290
assert returned_cluster.state == expected_cluster.state
291291

292292

293-
@pytest.mark.parametrize("ray_version", ["2.9", "2.33", "2.42"])
293+
@pytest.mark.parametrize("ray_version", ["2.9", "2.33", "2.42", "2.47"])
294294
@pytest.mark.usefixtures("google_auth_mock", "get_project_number_mock")
295295
class TestClusterManagement:
296296
def setup_method(self, ray_version):
@@ -322,8 +322,10 @@ def test_create_ray_cluster_1_pool_gpu_success(
322322
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_9
323323
elif ray_version == "2.33":
324324
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_33
325-
else:
325+
elif ray_version == "2.42":
326326
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_42
327+
else:
328+
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_47
327329
test_persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
328330
"head-node"
329331
] = head_node_image
@@ -395,8 +397,10 @@ def test_create_ray_cluster_1_pool_gpu_with_labels_success(
395397
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_9
396398
elif ray_version == "2.33":
397399
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_33
398-
else:
400+
elif ray_version == "2.42":
399401
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_42
402+
else:
403+
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_47
400404

401405
test_persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
402406
"head-node"
@@ -461,9 +465,12 @@ def test_create_ray_cluster_2_pools_success(
461465
elif ray_version == "2.33":
462466
head_node_image = tc.ClusterConstants.TEST_CPU_IMAGE_2_33
463467
worker_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_33
464-
else:
468+
elif ray_version == "2.42":
465469
head_node_image = tc.ClusterConstants.TEST_CPU_IMAGE_2_42
466470
worker_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_42
471+
else:
472+
head_node_image = tc.ClusterConstants.TEST_CPU_IMAGE_2_47
473+
worker_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_47
467474

468475
test_persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
469476
"head-node"
@@ -539,8 +546,10 @@ def test_create_ray_cluster_byosa_success(
539546
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_9
540547
elif ray_version == "2.33":
541548
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_33
542-
else:
549+
elif ray_version == "2.42":
543550
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_42
551+
else:
552+
head_node_image = tc.ClusterConstants.TEST_GPU_IMAGE_2_47
544553

545554
test_persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
546555
"head-node"

tests/unit/vertex_ray/test_constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,12 @@ class ClusterConstants:
129129
TEST_GPU_IMAGE_2_42 = (
130130
"us-docker.pkg.dev/vertex-ai/training/ray-gpu.2-42.py310:latest"
131131
)
132+
TEST_CPU_IMAGE_2_47 = (
133+
"us-docker.pkg.dev/vertex-ai/training/ray-cpu.2-47.py311:latest"
134+
)
135+
TEST_GPU_IMAGE_2_47 = (
136+
"us-docker.pkg.dev/vertex-ai/training/ray-gpu.2-47.py311:latest"
137+
)
132138
TEST_CUSTOM_IMAGE = "us-docker.pkg.dev/my-project/ray-custom-image.2.9:latest"
133139
TEST_PSC_NETWORK_ATTACHMENT = "my-network-attachment"
134140
# RUNNING Persistent Cluster w/o Ray

tests/unit/vertex_ray/test_vertex_ray_client.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
python_version="MOCK_PYTHON_VERSION",
3030
ray_version="MOCK_RAY_VERSION",
3131
ray_commit="MOCK_RAY_COMMIT",
32-
protocol_version="MOCK_PROTOCOL_VERSION",
3332
_num_clients=1,
3433
_context_to_restore=None,
3534
)

0 commit comments

Comments
 (0)