55from rich .panel import Panel
66from rich import box
77from typing import List
8- from ..cluster .model import RayCluster , AppWrapper
8+ from ..cluster .model import RayCluster , AppWrapper , RayClusterStatus
99
10- def _print_no_cluster_found ():
10+ def print_no_resources_found ():
11+ console = Console ()
12+ console .print (Panel ("[red]No resources found" ))
13+
14+
15+ def print_appwrappers_status ():
1116 pass
1217
1318def print_clusters (clusters :List [RayCluster ], verbose = True ):
19+ if not clusters == 0 :
20+ print_no_resources_found ()
21+ return #shortcircuit
22+
1423 console = Console ()
1524 title_printed = False
1625 #FIXME handle case where no clusters are found
1726 if len (clusters ) == 0 :
18- _print_no_cluster_found ()
27+ print_no_resources_found ()
1928 return #exit early
2029
2130 for cluster in clusters :
22- status = "Active :white_heavy_check_mark:" if cluster .status . lower () == 'ready' else "InActive :x:"
31+ status = "Active :white_heavy_check_mark:" if cluster .status == RayClusterStatus . READY else "InActive :x:"
2332 name = cluster .name
2433 dashboard = f"https://codeflare-raydashboard.research.ibm.com?rayclustername={ name } "
2534 mincount = str (cluster .min_workers )
@@ -38,7 +47,7 @@ def print_clusters(clusters:List[RayCluster], verbose=True):
3847 table0 .add_row ("" )
3948 table0 .add_row ("[bold underline]" + name ,status )
4049 table0 .add_row ()
41- table0 .add_row (f"[bold]URI:[/bold] ray://{ name } -head.codeflare. svc:1001" )
50+ table0 .add_row (f"[bold]URI:[/bold] ray://{ name } -head- svc:1001" ) #format that is used to generate the name of the service
4251 table0 .add_row ()
4352 table0 .add_row (f"[link={ dashboard } blue underline]Dashboard:link:[/link]" )
4453 table0 .add_row ("" ) #empty row for spacing
0 commit comments