Skip to content

Commit

Permalink
Uses v1 constants for Vertex pipeline client. (#4448)
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 408775112
(cherry picked from commit 5d53523)

Co-authored-by: jiyongjung <jiyongjung@google.com>
  • Loading branch information
jay90099 and jiyongjung authored Nov 10, 2021
1 parent 14cd066 commit 17ef159
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tfx/orchestration/kubeflow/v2/vertex_client_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

from absl import logging
from google.cloud.aiplatform import pipeline_jobs
from google.cloud.aiplatform.compat.types import pipeline_state_v1beta1
from google.cloud.aiplatform_v1.types import pipeline_state


_PIPELINE_COMPLETE_STATES = frozenset([
pipeline_state_v1beta1.PipelineState.PIPELINE_STATE_SUCCEEDED,
pipeline_state_v1beta1.PipelineState.PIPELINE_STATE_FAILED,
pipeline_state_v1beta1.PipelineState.PIPELINE_STATE_CANCELLED,
pipeline_state_v1beta1.PipelineState.PIPELINE_STATE_PAUSED,
pipeline_state.PipelineState.PIPELINE_STATE_SUCCEEDED,
pipeline_state.PipelineState.PIPELINE_STATE_FAILED,
pipeline_state.PipelineState.PIPELINE_STATE_CANCELLED,
pipeline_state.PipelineState.PIPELINE_STATE_PAUSED,
])


Expand All @@ -49,7 +50,7 @@ def poll_job_status(job_id: str, timeout: datetime.timedelta,

job = pipeline_jobs.PipelineJob.get(resource_name=job_id)
if (job.state ==
pipeline_state_v1beta1.PipelineState.PIPELINE_STATE_SUCCEEDED):
pipeline_state.PipelineState.PIPELINE_STATE_SUCCEEDED):
logging.info('Job succeeded: %s', job)
return
elif job.state in _PIPELINE_COMPLETE_STATES:
Expand Down

0 comments on commit 17ef159

Please sign in to comment.