Skip to content

Commit 93929d2

Browse files
print correct dashboard link (#28)
1 parent b75cb42 commit 93929d2

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/codeflare_sdk/cluster/cluster.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,10 @@ def _get_app_wrappers(filter:List[AppWrapperStatus], namespace='default') -> Lis
175175

176176
def _map_to_ray_cluster(cluster) -> RayCluster:
177177
cluster_model = cluster.model
178+
179+
with oc.project(cluster.namespace()), oc.timeout(10*60):
180+
route = oc.selector(f'route/ray-dashboard-{cluster.name()}').object().model.spec.host
181+
178182
return RayCluster(
179183
name=cluster.name(), status=RayClusterStatus(cluster_model.status.state.lower()),
180184
#for now we are not using autoscaling so same replicas is fine
@@ -186,7 +190,8 @@ def _map_to_ray_cluster(cluster) -> RayCluster:
186190
0].template.spec.containers[0].resources.requests.memory,
187191
worker_cpu=cluster_model.spec.workerGroupSpecs[0].template.spec.containers[0].resources.limits.cpu,
188192
worker_gpu=0, #hard to detect currently how many gpus, can override it with what the user asked for
189-
namespace=cluster.namespace())
193+
namespace=cluster.namespace(),
194+
dashboard = route)
190195

191196

192197
def _map_to_app_wrapper(cluster) -> AppWrapper:

src/codeflare_sdk/cluster/model.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class RayCluster:
3232
worker_cpu: int
3333
worker_gpu: int
3434
namespace: str
35+
dashboard: str
3536

3637
@dataclass
3738
class AppWrapper:

src/codeflare_sdk/utils/pretty_print.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def print_clusters(clusters:List[RayCluster], verbose=True):
4242
for cluster in clusters:
4343
status = "Active :white_heavy_check_mark:" if cluster.status == RayClusterStatus.READY else "InActive :x:"
4444
name = cluster.name
45-
dashboard = f"https://codeflare-raydashboard.research.ibm.com?rayclustername={name}"
45+
dashboard = cluster.dashboard
4646
mincount = str(cluster.min_workers)
4747
maxcount = str(cluster.max_workers)
4848
memory = cluster.worker_mem_min+"~"+cluster.worker_mem_max

0 commit comments

Comments
 (0)