Skip to content

Commit 810b144

Browse files
committed
Fix: Add validation of success status
1 parent d37486e commit 810b144

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

dags/tpu_observability/jobset_healthiness_validation.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
SCHEDULE = SchedulingHelper.arrange_schedule_time(DAG_ID)
3939

4040
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)'"
4142

4243
# Keyword arguments are generated dynamically at runtime (pylint does not
4344
# know this signature).
@@ -164,6 +165,33 @@
164165
jobset_config=jobset_config,
165166
)
166167

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+
167195
with TaskGroup(group_id="inject_and_validate_failure") as failure_test:
168196
cleanup_for_failure = jobset.end_workload.override(
169197
task_id="cleanup_before_failure_injection"
@@ -214,6 +242,7 @@
214242
suspend_action,
215243
validate_suspended,
216244
resume_action,
245+
success_test,
217246
failure_test,
218247
cleanup_workload,
219248
cleanup_node_pool,

0 commit comments

Comments
 (0)