Skip to content

Commit

Permalink
feat: Add pipeline_job_name to allow PipelineJob.get(pipeline_job_name)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 643162661
  • Loading branch information
vertex-sdk-bot authored and Copybara-Service committed Jun 13, 2024
1 parent f0f13f2 commit 32e3b22
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/unit/aiplatform/test_language_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,8 @@ def test_tune_text_embedding_model(
model = language_models_module.TextEmbeddingModel.from_pretrained(
base_model_version_id
)
tuning_job = model.tune_model(**tune_args)
tuning_result = model.tune_model(**tune_args)

call_kwargs = mock_pipeline_service_create.call_args[1]
pipeline_arguments = dict(
call_kwargs["pipeline_job"].runtime_config.parameter_values
Expand All @@ -2402,7 +2403,8 @@ def test_tune_text_embedding_model(
assert pipeline_arguments == expected_pipeline_args

# Testing the tuned model
tuned_model = tuning_job.deploy_tuned_model()
assert tuning_result.pipeline_job_name.startswith("sample-test-pipeline")
tuned_model = tuning_result.deploy_tuned_model()
assert (
tuned_model._endpoint_name
== test_constants.EndpointConstants._TEST_ENDPOINT_NAME
Expand Down
5 changes: 5 additions & 0 deletions vertexai/language_models/_language_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3932,6 +3932,11 @@ def _get_tuned_model_name(self) -> str:
self._tuned_model_name = vertex_model_name
return vertex_model_name

@property
def pipeline_job_name(self) -> str:
"""Pipeline job name."""
return self._job.name

@property
def _status(self) -> Optional[aiplatform_types.pipeline_state.PipelineState]:
"""Job status."""
Expand Down

0 comments on commit 32e3b22

Please sign in to comment.