|
37 | 37 | class TestPreviewPipelineJobSchedule(e2e_base.TestEndToEnd): |
38 | 38 | _temp_prefix = "tmpvrtxsdk-e2e-pjs" |
39 | 39 |
|
40 | | - def test_create_get_list(self, shared_state): |
| 40 | + def test_create_get_pause_resume_update_list(self, shared_state): |
41 | 41 | # Components: |
42 | 42 | def train( |
43 | 43 | number_of_epochs: int, |
@@ -77,22 +77,34 @@ def training_pipeline(number_of_epochs: int = 2): |
77 | 77 | ) |
78 | 78 |
|
79 | 79 | max_run_count = 2 |
| 80 | + cron_expression = "*/5 * * * *" |
80 | 81 | pipeline_job_schedule.create( |
81 | | - cron_expression="*/5 * * * *", |
| 82 | + cron_expression=cron_expression, |
82 | 83 | max_run_count=max_run_count, |
83 | 84 | max_concurrent_run_count=2, |
84 | 85 | ) |
85 | 86 |
|
86 | 87 | shared_state.setdefault("resources", []).append(pipeline_job_schedule) |
87 | 88 |
|
| 89 | + # Pausing the pipeline job schedule. |
88 | 90 | pipeline_job_schedule.pause() |
89 | 91 | assert pipeline_job_schedule.state == gca_schedule.Schedule.State.PAUSED |
90 | 92 |
|
| 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. |
91 | 102 | pipeline_job_schedule.resume(catch_up=True) |
92 | 103 | assert pipeline_job_schedule.state == gca_schedule.Schedule.State.ACTIVE |
93 | 104 |
|
94 | 105 | pipeline_job_schedule.wait() |
95 | 106 |
|
| 107 | + # Confirming that correct number of runs were scheduled and completed by this pipeline job schedule. |
96 | 108 | list_jobs_with_read_mask = pipeline_job_schedule.list_jobs( |
97 | 109 | enable_simple_view=True |
98 | 110 | ) |
|
0 commit comments