From 71a95f4bf7f1446e80bb5c24d23c1695bc4fc031 Mon Sep 17 00:00:00 2001 From: Zhanghao Wu Date: Thu, 17 Oct 2024 23:11:46 -0700 Subject: [PATCH] [Core] Raise error for none existing cluster when endpoint is called (#4117) raise error for none existing cluster --- sky/backends/backend_utils.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sky/backends/backend_utils.py b/sky/backends/backend_utils.py index 2521fcbcfe5..caa6c9292d5 100644 --- a/sky/backends/backend_utils.py +++ b/sky/backends/backend_utils.py @@ -2772,6 +2772,10 @@ def get_endpoints(cluster: str, cluster_records = get_clusters(include_controller=True, refresh=False, cluster_names=[cluster]) + if not cluster_records: + with ux_utils.print_exception_no_traceback(): + raise exceptions.ClusterNotUpError( + f'Cluster {cluster!r} not found.', cluster_status=None) assert len(cluster_records) == 1, cluster_records cluster_record = cluster_records[0] if (not skip_status_check and