Content-Length: 353981 | pFad | https://github.com/googleapis/python-aiplatform/commit/ba6582856b1d7f9a6ac8f90a3fa5ea6723ac64ab

14 feat: Add display experiment run button for Ipython environments · googleapis/python-aiplatform@ba65828 · GitHub
Skip to content

Commit ba65828

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: Add display experiment run button for Ipython environments
PiperOrigin-RevId: 639147169
1 parent 28a3c56 commit ba65828

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

google/cloud/aiplatform/metadata/metadata.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,8 @@ def start_run(
492492
run_name=run, experiment=self.experiment, tensorboard=tensorboard
493493
)
494494

495+
_ipython_utils.display_experiment_run_button(self._experiment_run)
496+
495497
return self._experiment_run
496498

497499
def end_run(

google/cloud/aiplatform/utils/_ipython_utils.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
if typing.TYPE_CHECKING:
2626
from google.cloud.aiplatform.metadata import experiment_resources
27+
from google.cloud.aiplatform.metadata import experiment_run_resource
2728
from google.cloud.aiplatform import model_evaluation
2829

2930
_LOGGER = base.Logger(__name__)
@@ -168,6 +169,36 @@ def display_experiment_button(experiment: "experiment_resources.Experiment") ->
168169
display_link("View Experiment", uri, "science")
169170

170171

172+
def display_experiment_run_button(
173+
experiment_run: "experiment_run_resource.ExperimentRun",
174+
) -> None:
175+
"""Function to generate a link bound to the Vertex experiment run"""
176+
if not is_ipython_available():
177+
return
178+
try:
179+
project = experiment_run.project
180+
location = experiment_run.location
181+
experiment_name = experiment_run._experiment._metadata_context.name
182+
run_name = experiment_run.name
183+
if (
184+
run_name is None
185+
or experiment_name is None
186+
or project is None
187+
or location is None
188+
):
189+
return
190+
except AttributeError:
191+
_LOGGER.warning("Unable to fetch experiment run metadata")
192+
return
193+
194+
uri = (
195+
"https://console.cloud.google.com/vertex-ai/experiments/locations/"
196+
+ f"{location}/experiments/{experiment_name}/"
197+
+ f"runs/{experiment_name}-{run_name}?project={project}"
198+
)
199+
display_link("View Experiment Run", uri, "science")
200+
201+
171202
def display_model_evaluation_button(
172203
evaluation: "model_evaluation.ModelEvaluation",
173204
) -> None:

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/googleapis/python-aiplatform/commit/ba6582856b1d7f9a6ac8f90a3fa5ea6723ac64ab

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy