From d73c0b642161fcc64f65a0bc9b25bd07e38bfafa Mon Sep 17 00:00:00 2001 From: MichaelClifford Date: Tue, 1 Nov 2022 16:09:59 -0400 Subject: [PATCH] pull ray dashboard url from cluster --- src/codeflare_sdk/cluster/cluster.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/codeflare_sdk/cluster/cluster.py b/src/codeflare_sdk/cluster/cluster.py index 8ae4c003e..455349a95 100644 --- a/src/codeflare_sdk/cluster/cluster.py +++ b/src/codeflare_sdk/cluster/cluster.py @@ -59,7 +59,14 @@ def cluster_uri(self, namespace='default'): return f'ray://{self.config.name}-head-svc.{namespace}.svc:10001' def cluster_dashboard_uri(self, namespace='default'): - return f'http://{self.config.name}-head-svc.{namespace}.svc:8265' + try: + with oc.project(namespace): + route = oc.invoke("get", ["route", "-o","jsonpath='{$.items[0].spec.host}'"]) + route = route.out().strip().strip("'") + return f"http://{route}" + except: + return "Dashboard route not available yet. Did you run cluster.up()?" + # checks whether the ray cluster is ready