Skip to content

Fix ZenML Pro project URLs for pipeline runs and model versions #3426

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 2 commits into from
Mar 18, 2025
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
2 changes: 1 addition & 1 deletion src/zenml/config/server_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ def get_server_config(cls) -> "ServerConfiguration":
)
server_config.feature_gate_implementation_source = "zenml.zen_server.feature_gate.zenml_cloud_feature_gate.ZenMLCloudFeatureGateInterface"
server_config.reportable_resources = DEFAULT_REPORTABLE_RESOURCES
server_config.dashboard_url = f"{server_pro_config.dashboard_url}/workspaces/{server_pro_config.workspace_id}"
server_config.dashboard_url = f"{server_pro_config.dashboard_url}/workspaces/{server_pro_config.workspace_name}"
server_config.metadata.update(
dict(
account_id=str(server_pro_config.organization_id),
Expand Down
1 change: 1 addition & 0 deletions src/zenml/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ def handle_int_env_var(var: str, default: int = 0) -> int:
PIPELINES = "/pipelines"
PIPELINE_SPEC = "/pipeline-spec"
PLUGIN_FLAVORS = "/plugin-flavors"
PROJECTS = "/projects"
REFRESH = "/refresh"
RUNS = "/runs"
RUN_TEMPLATES = "/run_templates"
Expand Down
2 changes: 1 addition & 1 deletion src/zenml/orchestrators/step_run_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def log_model_version_dashboard_url(
"""
from zenml.utils.dashboard_utils import get_model_version_url

if model_version_url := get_model_version_url(model_version.id):
if model_version_url := get_model_version_url(model_version):
logger.info(
"Dashboard URL for Model Version `%s (%s)`:\n%s",
model_version.model.name,
Expand Down
12 changes: 7 additions & 5 deletions src/zenml/utils/dashboard_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import os
from typing import Optional
from urllib.parse import urlparse
from uuid import UUID

from zenml import constants
from zenml.client import Client
Expand All @@ -26,6 +25,7 @@
from zenml.logger import get_logger
from zenml.models import (
ComponentResponse,
ModelVersionResponse,
PipelineRunResponse,
ServerDeploymentType,
StackResponse,
Expand Down Expand Up @@ -118,7 +118,7 @@ def get_run_url(run: PipelineRunResponse) -> Optional[str]:
"""
cloud_url = get_cloud_dashboard_url()
if cloud_url:
return f"{cloud_url}{constants.RUNS}/{run.id}"
return f"{cloud_url}{constants.PROJECTS}/{run.project.id}{constants.RUNS}/{run.id}"

dashboard_url = get_server_dashboard_url()
if dashboard_url:
Expand All @@ -127,18 +127,20 @@ def get_run_url(run: PipelineRunResponse) -> Optional[str]:
return None


def get_model_version_url(model_version_id: UUID) -> Optional[str]:
def get_model_version_url(
model_version: ModelVersionResponse,
) -> Optional[str]:
"""Function to get the dashboard URL of a given model version.

Args:
model_version_id: the id of the model version.
model_version: the response model of the given model version.

Returns:
the URL to the model version if the dashboard is available, else None.
"""
cloud_url = get_cloud_dashboard_url()
if cloud_url:
return f"{cloud_url}/model-versions/{str(model_version_id)}"
return f"{cloud_url}{constants.PROJECTS}/{model_version.project.id}/model-versions/{str(model_version.id)}"

return None

Expand Down
Loading