Skip to content

Commit 41a3a83

Browse files
yinghsienwucopybara-github
authored andcommitted
fix: Handle Ray image parsing error
PiperOrigin-RevId: 566427303
1 parent 3af889a commit 41a3a83

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

google/cloud/aiplatform/preview/vertex_ray/cluster_init.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,9 @@ def get_ray_cluster(cluster_resource_name: str) -> resources.Cluster:
249249
cluster = _gapic_utils.persistent_resource_to_cluster(persistent_resource=response)
250250
if cluster:
251251
return cluster
252-
raise ValueError("[Ray on Vertex AI]: The cluster is not a Ray cluster.")
252+
raise ValueError(
253+
"[Ray on Vertex AI]: Please delete and recreate the cluster (The cluster is not a Ray cluster or the cluster image is outdated)."
254+
)
253255

254256

255257
def list_ray_clusters() -> List[resources.Cluster]:

google/cloud/aiplatform/preview/vertex_ray/util/_gapic_utils.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,18 @@ def persistent_resource_to_cluster(
154154
image_uri = persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
155155
"head-node"
156156
]
157-
if image_uri is None:
157+
if not image_uri:
158158
image_uri = persistent_resource.resource_runtime_spec.ray_spec.image_uri
159-
python_version, ray_version = _validation_utils.get_versions_from_image_uri(
160-
image_uri
161-
)
159+
try:
160+
python_version, ray_version = _validation_utils.get_versions_from_image_uri(
161+
image_uri
162+
)
163+
except IndexError:
164+
logging.info(
165+
"[Ray on Vertex AI]: The image of cluster %s is outdated. It is recommended to delete and recreate the cluster to obtain the latest image.",
166+
persistent_resource.name,
167+
)
168+
return
162169
cluster.python_version = python_version
163170
cluster.ray_version = ray_version
164171

0 commit comments

Comments
 (0)