From 1d4be196a29ebad2ba3750f4d973a2185e40a39b Mon Sep 17 00:00:00 2001 From: MichaelClifford Date: Thu, 3 Nov 2022 15:44:57 -0400 Subject: [PATCH] print correct dashboard link --- src/codeflare_sdk/cluster/cluster.py | 7 ++++++- src/codeflare_sdk/cluster/model.py | 1 + src/codeflare_sdk/utils/pretty_print.py | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/codeflare_sdk/cluster/cluster.py b/src/codeflare_sdk/cluster/cluster.py index 455349a95..fc2c20dac 100644 --- a/src/codeflare_sdk/cluster/cluster.py +++ b/src/codeflare_sdk/cluster/cluster.py @@ -175,6 +175,10 @@ def _get_app_wrappers(filter:List[AppWrapperStatus], namespace='default') -> Lis def _map_to_ray_cluster(cluster) -> RayCluster: cluster_model = cluster.model + + with oc.project(cluster.namespace()), oc.timeout(10*60): + route = oc.selector(f'route/ray-dashboard-{cluster.name()}').object().model.spec.host + return RayCluster( name=cluster.name(), status=RayClusterStatus(cluster_model.status.state.lower()), #for now we are not using autoscaling so same replicas is fine @@ -186,7 +190,8 @@ def _map_to_ray_cluster(cluster) -> RayCluster: 0].template.spec.containers[0].resources.requests.memory, worker_cpu=cluster_model.spec.workerGroupSpecs[0].template.spec.containers[0].resources.limits.cpu, worker_gpu=0, #hard to detect currently how many gpus, can override it with what the user asked for - namespace=cluster.namespace()) + namespace=cluster.namespace(), + dashboard = route) def _map_to_app_wrapper(cluster) -> AppWrapper: diff --git a/src/codeflare_sdk/cluster/model.py b/src/codeflare_sdk/cluster/model.py index 0459d841f..0482bc1ca 100644 --- a/src/codeflare_sdk/cluster/model.py +++ b/src/codeflare_sdk/cluster/model.py @@ -32,6 +32,7 @@ class RayCluster: worker_cpu: int worker_gpu: int namespace: str + dashboard: str @dataclass class AppWrapper: diff --git a/src/codeflare_sdk/utils/pretty_print.py b/src/codeflare_sdk/utils/pretty_print.py index f7fa6aab5..c202f26d4 100644 --- a/src/codeflare_sdk/utils/pretty_print.py +++ b/src/codeflare_sdk/utils/pretty_print.py @@ -42,7 +42,7 @@ def print_clusters(clusters:List[RayCluster], verbose=True): for cluster in clusters: status = "Active :white_heavy_check_mark:" if cluster.status == RayClusterStatus.READY else "InActive :x:" name = cluster.name - dashboard = f"https://codeflare-raydashboard.research.ibm.com?rayclustername={name}" + dashboard = cluster.dashboard mincount = str(cluster.min_workers) maxcount = str(cluster.max_workers) memory = cluster.worker_mem_min+"~"+cluster.worker_mem_max