Skip to content

Commit a2168b5

Browse files
committed
add: error handling for cluster not found
1 parent 4d76f96 commit a2168b5

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

src/codeflare_sdk/cli/commands/delete.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def raycluster(name, namespace):
1818
"""
1919
Delete a specified RayCluster from the Kubernetes cluster
2020
"""
21-
cluster = get_cluster(name, namespace)
21+
try:
22+
cluster = get_cluster(name, namespace)
23+
except FileNotFoundError:
24+
click.echo(f"Cluster {name} not found in {namespace} namespace")
25+
return
2226
cluster.down()
2327
click.echo(f"Cluster deleted successfully")

src/codeflare_sdk/cli/commands/details.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def cli():
1515
@click.pass_context
1616
def raycluster(ctx, name, namespace):
1717
"""Get the details of a specified RayCluster"""
18-
namespace = namespace or "default"
19-
cluster = get_cluster(name, namespace)
18+
try:
19+
cluster = get_cluster(name, namespace)
20+
except FileNotFoundError:
21+
click.echo(f"Cluster {name} not found in {namespace} namespace")
22+
return
2023
cluster.details()

src/codeflare_sdk/cli/commands/status.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ def cli():
1515
@click.pass_context
1616
def raycluster(ctx, name, namespace):
1717
"""Get the status of a specified RayCluster"""
18-
namespace = namespace or "default"
19-
cluster = get_cluster(name, namespace)
18+
try:
19+
cluster = get_cluster(name, namespace)
20+
except FileNotFoundError:
21+
click.echo(f"Cluster {name} not found in {namespace} namespace")
22+
return
2023
cluster.status()

0 commit comments

Comments
 (0)