Skip to content

Commit

Permalink
fix: Handle Ray image parsing error
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 566427303
  • Loading branch information
yinghsienwu authored and copybara-github committed Sep 18, 2023
1 parent 3af889a commit 41a3a83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion google/cloud/aiplatform/preview/vertex_ray/cluster_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,9 @@ def get_ray_cluster(cluster_resource_name: str) -> resources.Cluster:
cluster = _gapic_utils.persistent_resource_to_cluster(persistent_resource=response)
if cluster:
return cluster
raise ValueError("[Ray on Vertex AI]: The cluster is not a Ray cluster.")
raise ValueError(
"[Ray on Vertex AI]: Please delete and recreate the cluster (The cluster is not a Ray cluster or the cluster image is outdated)."
)


def list_ray_clusters() -> List[resources.Cluster]:
Expand Down
15 changes: 11 additions & 4 deletions google/cloud/aiplatform/preview/vertex_ray/util/_gapic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,18 @@ def persistent_resource_to_cluster(
image_uri = persistent_resource.resource_runtime_spec.ray_spec.resource_pool_images[
"head-node"
]
if image_uri is None:
if not image_uri:
image_uri = persistent_resource.resource_runtime_spec.ray_spec.image_uri
python_version, ray_version = _validation_utils.get_versions_from_image_uri(
image_uri
)
try:
python_version, ray_version = _validation_utils.get_versions_from_image_uri(
image_uri
)
except IndexError:
logging.info(
"[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.",
persistent_resource.name,
)
return
cluster.python_version = python_version
cluster.ray_version = ray_version

Expand Down

0 comments on commit 41a3a83

Please sign in to comment.