Skip to content

Commit 708a67b

Browse files
speedstorm1copybara-github
authored andcommitted
feat: Add Ray 2.33 support to SDK Client Builder, remove deprecated protocol_version from ray client context.
PiperOrigin-RevId: 672234821
1 parent 7fda11f commit 708a67b

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

google/cloud/aiplatform/vertex_ray/client_builder.py

+27-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
# Copyright 2023 Google LLC
3+
# Copyright 2024 Google LLC
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License");
66
# you may not use this file except in compliance with the License.
@@ -16,6 +16,8 @@
1616
#
1717
import grpc
1818
import logging
19+
import ray
20+
1921
from typing import Dict
2022
from typing import Optional
2123
from google.cloud import aiplatform
@@ -45,16 +47,30 @@ def __init__(
4547
persistent_resource_id,
4648
" failed to start Head node properly.",
4749
)
48-
49-
super().__init__(
50-
dashboard_url=dashboard_uri,
51-
python_version=ray_client_context.python_version,
52-
ray_version=ray_client_context.ray_version,
53-
ray_commit=ray_client_context.ray_commit,
54-
protocol_version=ray_client_context.protocol_version,
55-
_num_clients=ray_client_context._num_clients,
56-
_context_to_restore=ray_client_context._context_to_restore,
57-
)
50+
if ray.__version__ == "2.33.0":
51+
super().__init__(
52+
dashboard_url=dashboard_uri,
53+
python_version=ray_client_context.python_version,
54+
ray_version=ray_client_context.ray_version,
55+
ray_commit=ray_client_context.ray_commit,
56+
_num_clients=ray_client_context._num_clients,
57+
_context_to_restore=ray_client_context._context_to_restore,
58+
)
59+
elif ray.__version__ == "2.9.3":
60+
super().__init__(
61+
dashboard_url=dashboard_uri,
62+
python_version=ray_client_context.python_version,
63+
ray_version=ray_client_context.ray_version,
64+
ray_commit=ray_client_context.ray_commit,
65+
protocol_version=ray_client_context.protocol_version,
66+
_num_clients=ray_client_context._num_clients,
67+
_context_to_restore=ray_client_context._context_to_restore,
68+
)
69+
else:
70+
raise ImportError(
71+
f"[Ray on Vertex AI]: Unsupported version {ray.__version__}."
72+
+ "Only 2.33.0 and 2.9.3 are supported."
73+
)
5874
self.persistent_resource_id = persistent_resource_id
5975
self.vertex_sdk_version = str(VERTEX_SDK_VERSION)
6076
self.shell_uri = ray_head_uris.get("RAY_HEAD_NODE_INTERACTIVE_SHELL_URI")

0 commit comments

Comments
 (0)