Skip to content

Commit 1b91e9f

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: Add updateSchedule test to PipelineJobSchedule system test.
PiperOrigin-RevId: 542053580
1 parent 4e7d11a commit 1b91e9f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/system/aiplatform/test_pipeline_job_schedule.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
class TestPreviewPipelineJobSchedule(e2e_base.TestEndToEnd):
3838
_temp_prefix = "tmpvrtxsdk-e2e-pjs"
3939

40-
def test_create_get_list(self, shared_state):
40+
def test_create_get_pause_resume_update_list(self, shared_state):
4141
# Components:
4242
def train(
4343
number_of_epochs: int,
@@ -77,22 +77,34 @@ def training_pipeline(number_of_epochs: int = 2):
7777
)
7878

7979
max_run_count = 2
80+
cron_expression = "*/5 * * * *"
8081
pipeline_job_schedule.create(
81-
cron_expression="*/5 * * * *",
82+
cron_expression=cron_expression,
8283
max_run_count=max_run_count,
8384
max_concurrent_run_count=2,
8485
)
8586

8687
shared_state.setdefault("resources", []).append(pipeline_job_schedule)
8788

89+
# Pausing the pipeline job schedule.
8890
pipeline_job_schedule.pause()
8991
assert pipeline_job_schedule.state == gca_schedule.Schedule.State.PAUSED
9092

93+
# Before updating, confirm the cron_expression is correctly set from the create step.
94+
assert pipeline_job_schedule.cron_expression == cron_expression
95+
96+
# Updating the pipeline job schedule.
97+
new_cron_expression = "* * * * *"
98+
pipeline_job_schedule.update(cron_expression=new_cron_expression)
99+
assert pipeline_job_schedule.cron_expression == new_cron_expression
100+
101+
# Resuming the pipeline job schedule.
91102
pipeline_job_schedule.resume(catch_up=True)
92103
assert pipeline_job_schedule.state == gca_schedule.Schedule.State.ACTIVE
93104

94105
pipeline_job_schedule.wait()
95106

107+
# Confirming that correct number of runs were scheduled and completed by this pipeline job schedule.
96108
list_jobs_with_read_mask = pipeline_job_schedule.list_jobs(
97109
enable_simple_view=True
98110
)

0 commit comments

Comments
 (0)