Skip to content
Open
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 agentplatform/batch_prediction/_batch_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _dashboard_uri(self) -> Optional[str]:
project = fields.pop("project")
job = list(fields.values())[0]
return (
"https://console.cloud.google.com/ai/platform/locations/"
"https://console.cloud.google.com/agent-platform/locations/"
f"{location}/{self._job_type}/{job}?project={project}"
)

Expand Down
2 changes: 1 addition & 1 deletion google/cloud/aiplatform/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def _dashboard_uri(self) -> Optional[str]:
location = fields.pop("location")
project = fields.pop("project")
job = list(fields.values())[0]
url = f"https://console.cloud.google.com/ai/platform/locations/{location}/{self._job_type}/{job}?project={project}"
url = f"https://console.cloud.google.com/agent-platform/locations/{location}/{self._job_type}/{job}?project={project}"
return url

def _log_job_state(self):
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/aiplatform/training_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ def _dashboard_uri(self) -> str:
"""Helper method to compose the dashboard uri where training can be
viewed."""
fields = self._parse_resource_name(self.resource_name)
url = f"https://console.cloud.google.com/ai/platform/locations/{fields['location']}/training/{fields['training_pipeline']}?project={fields['project']}"
url = f"https://console.cloud.google.com/agent-platform/locations/{fields['location']}/training/{fields['training_pipeline']}?project={fields['project']}"
return url

@property
Expand Down
2 changes: 1 addition & 1 deletion google/cloud/aiplatform/utils/console_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
def custom_job_console_uri(custom_job_resource_name: str) -> str:
"""Helper method to create console uri from custom job resource name."""
fields = jobs.CustomJob._parse_resource_name(custom_job_resource_name)
return f"https://console.cloud.google.com/ai/platform/locations/{fields['location']}/training/{fields['custom_job']}?project={fields['project']}"
return f"https://console.cloud.google.com/agent-platform/locations/{fields['location']}/training/{fields['custom_job']}?project={fields['project']}"


def custom_job_tensorboard_console_uri(
Expand Down
44 changes: 44 additions & 0 deletions tests/unit/aiplatform/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,24 @@ def test_cancel_mock_job(self, fake_job_cancel_mock):

fake_job_cancel_mock.assert_called_once_with(name=_TEST_JOB_RESOURCE_NAME)

@pytest.mark.usefixtures("fake_job_getter_mock")
def test_dashboard_uri_uses_agent_platform_path(self):
fake_job = self.FakeJob(job_name=_TEST_JOB_RESOURCE_NAME)
uri = fake_job._dashboard_uri()
assert "/agent-platform/" in uri
assert "/ai/platform/" not in uri

@pytest.mark.usefixtures("fake_job_getter_mock")
def test_dashboard_uri_format(self):
fake_job = self.FakeJob(job_name=_TEST_JOB_RESOURCE_NAME)
uri = fake_job._dashboard_uri()
expected = (
f"https://console.cloud.google.com/agent-platform/locations/"
f"{_TEST_LOCATION}/{self.FakeJob._job_type}/{_TEST_ID}"
f"?project={_TEST_PROJECT}"
)
assert uri == expected


@pytest.fixture
def get_batch_prediction_job_mock():
Expand Down Expand Up @@ -1321,6 +1339,32 @@ def test_batch_predict_job_with_publisher_model(
== _TEST_PUBLISHER_MODEL_NAME
)

def test_batch_prediction_dashboard_uri_uses_agent_platform_path(
self, get_batch_prediction_job_mock
):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)
bp = jobs.BatchPredictionJob(
batch_prediction_job_name=_TEST_BATCH_PREDICTION_JOB_NAME
)
uri = bp._dashboard_uri()
assert "/agent-platform/" in uri
assert "/ai/platform/" not in uri

def test_batch_prediction_dashboard_uri_format(
self, get_batch_prediction_job_mock
):
aiplatform.init(project=_TEST_PROJECT, location=_TEST_LOCATION)
bp = jobs.BatchPredictionJob(
batch_prediction_job_name=_TEST_BATCH_PREDICTION_JOB_NAME
)
uri = bp._dashboard_uri()
expected = (
f"https://console.cloud.google.com/agent-platform/locations/"
f"{_TEST_LOCATION}/batch-predictions/{_TEST_ID}"
f"?project={_TEST_PROJECT}"
)
assert uri == expected


@pytest.fixture
def get_mdm_job_mock():
Expand Down
2 changes: 1 addition & 1 deletion vertexai/batch_prediction/_batch_prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def _dashboard_uri(self) -> Optional[str]:
project = fields.pop("project")
job = list(fields.values())[0]
return (
"https://console.cloud.google.com/ai/platform/locations/"
"https://console.cloud.google.com/agent-platform/locations/"
f"{location}/{self._job_type}/{job}?project={project}"
)

Expand Down
Loading