Skip to content

print correct dashboard link #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/codeflare_sdk/cluster/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelClifford can we just call the cluster.dashboard_uri() method here rather than trying to get the route again. I think we are already doing the same logic in both teh places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atinsood My original goal was to use the cluster.dashboard_uri() here. But the "cluster" object that gets passed to _map_to_ray_cluster is the raycluster API object from openshift not the Cluster class we've defined in our SDK. So, right now we can't reuse that method here, unfortunately.

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
Expand All @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/codeflare_sdk/cluster/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class RayCluster:
worker_cpu: int
worker_gpu: int
namespace: str
dashboard: str

@dataclass
class AppWrapper:
Expand Down
2 changes: 1 addition & 1 deletion src/codeflare_sdk/utils/pretty_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down