Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve PersistentResource exception logging to include cluster name #4833

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions google/cloud/aiplatform/vertex_ray/util/_gapic_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,21 +107,30 @@ def get_persistent_resource(
response = None
if num_attempts >= tolerance:
raise ValueError(
"[Ray on Vertex AI]: Invalid cluster_resource_name (404 not found)."
"[Ray on Vertex AI]: Invalid cluster_resource_name %s (404 not"
" found)." % persistent_resource_name
)
if response:
if response.error.message:
logging.error("[Ray on Vertex AI]: %s" % response.error.message)
raise RuntimeError("[Ray on Vertex AI]: Cluster returned an error.")
logging.error("[Ray on Vertex AI]: %s - %s",
persistent_resource_name, response.error.message)
raise RuntimeError(
"[Ray on Vertex AI]: Cluster %s returned an error."
% persistent_resource_name
)

print("[Ray on Vertex AI]: Cluster State =", response.state)
if response.state == PersistentResource.State.RUNNING:
return response
elif response.state == PersistentResource.State.STOPPING:
raise RuntimeError("[Ray on Vertex AI]: The cluster is stopping.")
raise RuntimeError(
"[Ray on Vertex AI]: Cluster %s is stopping."
% persistent_resource_name
)
elif response.state == PersistentResource.State.ERROR:
raise RuntimeError(
"[Ray on Vertex AI]: The cluster encountered an error."
"[Ray on Vertex AI]: Cluster %s encountered an error."
% persistent_resource_name
)
# Polling decay
sleep_time = polling_delay(num_attempts=num_attempts, time_scale=150.0)
Expand Down
Loading