Skip to content

Commit 1336b85

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: Remove the xprof dependency from Vertex Tensorboard uploader.
PiperOrigin-RevId: 741553321
1 parent 98459aa commit 1336b85

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

google/cloud/aiplatform/tensorboard/uploader.py

+11-5
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from typing import ContextManager, Dict, FrozenSet, Generator, Iterable, Optional, Tuple
2626
import uuid
2727

28+
from google.api_core import exceptions
2829
from google.cloud import storage
2930
from google.cloud.aiplatform import base
3031
from google.cloud.aiplatform.compat.services import (
@@ -323,11 +324,16 @@ def _end_experiment_runs(self):
323324
for run_name in self._experiment_runs:
324325
if run_name:
325326
logging.info("Ending run %s", run_name)
326-
run = experiment_run_resource.ExperimentRun.get(
327-
project=self._project, location=self._location, run_name=run_name
328-
)
329-
if run:
330-
run.update_state(state=gca_execution.Execution.State.COMPLETE)
327+
try:
328+
run = experiment_run_resource.ExperimentRun.get(
329+
project=self._project,
330+
location=self._location,
331+
run_name=run_name,
332+
)
333+
if run:
334+
run.update_state(state=gca_execution.Execution.State.COMPLETE)
335+
except exceptions.MethodNotImplemented:
336+
logging.warning("Failed to end run %s", run_name)
331337

332338
def start_uploading(self):
333339
"""Blocks forever to continuously upload data from the logdir.

google/cloud/aiplatform/tensorboard/uploader_constants.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
from tensorboard.plugins.image import metadata as images_metadata
1414
from tensorboard.plugins.scalar import metadata as scalar_metadata
1515
from tensorboard.plugins.text import metadata as text_metadata
16-
from tensorboard_plugin_profile import profile_plugin
1716

17+
PROFILE_PLUGIN_NAME = "profile"
1818
ALLOWED_PLUGINS = frozenset(
1919
[
2020
scalar_metadata.PLUGIN_NAME,
@@ -24,7 +24,7 @@
2424
hparams_metadata.PLUGIN_NAME,
2525
images_metadata.PLUGIN_NAME,
2626
graphs_metadata.PLUGIN_NAME,
27-
profile_plugin.PLUGIN_NAME,
27+
PROFILE_PLUGIN_NAME,
2828
]
2929
)
3030

0 commit comments

Comments
 (0)