Skip to content

Commit

Permalink
status cmd prints cluster name as hyperlink to den
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandra Belousov authored and Alexandra Belousov committed Sep 3, 2024
1 parent 569809f commit a381902
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions runhouse/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import ray

import requests
import rich.markdown

import typer
import yaml
Expand Down Expand Up @@ -452,13 +453,33 @@ def _print_cloud_properties(cluster_config: dict):
)


def _get_resource_link_in_den_ui(cluster_name: str, api_server_url: str):
cluster_uri = rns_client.format_rns_address(cluster_name)
link_to_den_dashboard = f"{api_server_url}/resources/{cluster_uri}"
return link_to_den_dashboard


def _print_status(status_data: dict, current_cluster: Cluster) -> None:
"""Prints the status of the cluster to the console"""
cluster_config = status_data.get("cluster_config")
env_servlet_processes = status_data.get("env_servlet_processes")

if "name" in cluster_config.keys():
console.print(cluster_config.get("name"))
cluster_name = cluster_config.get("name", None)

if cluster_name:
api_server_url = cluster_config.get(
"api_server_url", rh.configs.get("api_server_url")
)
api_server_url = api_server_url.replace(
"api", "www"
) # convert the api link to the ui link.
cluster_link_in_den_ui = _get_resource_link_in_den_ui(
cluster_name=cluster_name, api_server_url=api_server_url
)
cluster_name_hyperlink = rich.markdown.Text(
cluster_name, style=f"link {cluster_link_in_den_ui} white"
)
console.print(cluster_name_hyperlink)

# print headline
daemon_headline_txt = (
Expand Down

0 comments on commit a381902

Please sign in to comment.