Skip to content

Api

zenml.api

Public Python API of ZenML.

Everything defined/imported here should be highly import-optimized so we don't slow down the CLI.

show(ngrok_token=None)

Show the ZenML dashboard.

Parameters:

Name Type Description Default
ngrok_token Optional[str]

An ngrok auth token to use for exposing the ZenML dashboard on a public domain. Primarily used for accessing the dashboard in Colab.

None
Source code in zenml/api.py
def show(ngrok_token: Optional[str] = None) -> None:
    """Show the ZenML dashboard.

    Args:
        ngrok_token: An ngrok auth token to use for exposing the ZenML dashboard
            on a public domain. Primarily used for accessing the dashboard in
            Colab.
    """
    from zenml.utils.dashboard_utils import show_dashboard
    from zenml.utils.networking_utils import get_or_create_ngrok_tunnel
    from zenml.zen_server.utils import get_active_server_details

    url, port = get_active_server_details()

    if ngrok_token and port:
        ngrok_url = get_or_create_ngrok_tunnel(
            ngrok_token=ngrok_token, port=port
        )
        logger.debug(f"Tunneling dashboard from {url} to {ngrok_url}.")
        url = ngrok_url

    url = f"{url}:{port}" if port else url
    show_dashboard(url)