|
38 | 38 | SCHEDULE = SchedulingHelper.arrange_schedule_time(DAG_ID) |
39 | 39 |
|
40 | 40 | FAIL_WORKLOAD = "python3 -c 'import logging; import sys; logging.error(\"Simulating Failure\"); sys.exit(1)'" |
| 41 | +SUCCESS_WORKLOAD = "python3 -c 'import logging; import sys; logging.info(\"Simulating Success\"); sys.exit(0)'" |
41 | 42 |
|
42 | 43 | # Keyword arguments are generated dynamically at runtime (pylint does not |
43 | 44 | # know this signature). |
|
164 | 165 | jobset_config=jobset_config, |
165 | 166 | ) |
166 | 167 |
|
| 168 | + with TaskGroup(group_id="inject_and_validate_success") as success_test: |
| 169 | + cleanup_for_success = jobset.end_workload.override( |
| 170 | + task_id="cleanup_before_success_injection" |
| 171 | + )( |
| 172 | + node_pool=cluster_info, |
| 173 | + jobset_config=jobset_config, |
| 174 | + ) |
| 175 | + |
| 176 | + start_success_job = jobset.run_workload.override( |
| 177 | + task_id="start_success_job" |
| 178 | + )( |
| 179 | + node_pool=cluster_info, |
| 180 | + jobset_config=jobset_config, |
| 181 | + workload_type=SUCCESS_WORKLOAD, |
| 182 | + ) |
| 183 | + |
| 184 | + validate_succeeded_metric = jobset.wait_for_jobset_metrics.override( |
| 185 | + task_id="wait_for_succeeded_count" |
| 186 | + )( |
| 187 | + metric_name=ReplicatedJobStatus.SUCCEEDED, |
| 188 | + expected_value="USE_CONFIG_REPLICAS", |
| 189 | + node_pool=cluster_info, |
| 190 | + jobset_config=jobset_config, |
| 191 | + ) |
| 192 | + |
| 193 | + chain(cleanup_for_success, start_success_job, validate_succeeded_metric) |
| 194 | + |
167 | 195 | with TaskGroup(group_id="inject_and_validate_failure") as failure_test: |
168 | 196 | cleanup_for_failure = jobset.end_workload.override( |
169 | 197 | task_id="cleanup_before_failure_injection" |
|
214 | 242 | suspend_action, |
215 | 243 | validate_suspended, |
216 | 244 | resume_action, |
| 245 | + success_test, |
217 | 246 | failure_test, |
218 | 247 | cleanup_workload, |
219 | 248 | cleanup_node_pool, |
|
0 commit comments