Skip to content

Commit 4a7f149

Browse files
committed
Fix ZenML Pro project URLs for pipeline runs and model versions
1 parent 641f012 commit 4a7f149

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/zenml/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ def handle_int_env_var(var: str, default: int = 0) -> int:
368368
PIPELINES = "/pipelines"
369369
PIPELINE_SPEC = "/pipeline-spec"
370370
PLUGIN_FLAVORS = "/plugin-flavors"
371+
PROJECTS = "/projects"
371372
REFRESH = "/refresh"
372373
RUNS = "/runs"
373374
RUN_TEMPLATES = "/run_templates"

src/zenml/orchestrators/step_run_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def log_model_version_dashboard_url(
352352
"""
353353
from zenml.utils.dashboard_utils import get_model_version_url
354354

355-
if model_version_url := get_model_version_url(model_version.id):
355+
if model_version_url := get_model_version_url(model_version):
356356
logger.info(
357357
"Dashboard URL for Model Version `%s (%s)`:\n%s",
358358
model_version.model.name,

src/zenml/utils/dashboard_utils.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import os
1717
from typing import Optional
1818
from urllib.parse import urlparse
19-
from uuid import UUID
2019

2120
from zenml import constants
2221
from zenml.client import Client
@@ -26,6 +25,7 @@
2625
from zenml.logger import get_logger
2726
from zenml.models import (
2827
ComponentResponse,
28+
ModelVersionResponse,
2929
PipelineRunResponse,
3030
ServerDeploymentType,
3131
StackResponse,
@@ -118,7 +118,7 @@ def get_run_url(run: PipelineRunResponse) -> Optional[str]:
118118
"""
119119
cloud_url = get_cloud_dashboard_url()
120120
if cloud_url:
121-
return f"{cloud_url}{constants.RUNS}/{run.id}"
121+
return f"{cloud_url}{constants.PROJECTS}/{run.project.id}{constants.RUNS}/{run.id}"
122122

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

129129

130-
def get_model_version_url(model_version_id: UUID) -> Optional[str]:
130+
def get_model_version_url(
131+
model_version: ModelVersionResponse,
132+
) -> Optional[str]:
131133
"""Function to get the dashboard URL of a given model version.
132134
133135
Args:
134-
model_version_id: the id of the model version.
136+
model_version: the response model of the given model version.
135137
136138
Returns:
137139
the URL to the model version if the dashboard is available, else None.
138140
"""
139141
cloud_url = get_cloud_dashboard_url()
140142
if cloud_url:
141-
return f"{cloud_url}/model-versions/{str(model_version_id)}"
143+
return f"{cloud_url}{constants.PROJECTS}/{model_version.project.id}/model-versions/{str(model_version.id)}"
142144

143145
return None
144146

0 commit comments

Comments
 (0)