Commit e1b5af4
authored
fix: Correct XPK DAG final status reporting issue (GoogleCloudPlatform#1304)
Correct DAG Status Reporting via Airflow Setup/Teardown API
__The Problem:__ By default, Airflow evaluates the final DAG run status based on the success of its leaf nodes. In our workload runs, `clean_up_workload` acts as a leaf node that is typically triggered with `all_done` rules. When a training workload failed, the cleanup task still completed successfully, causing the Airflow DAG to be incorrectly reported as SUCCESS.
__The Solution:__ We transitioned the cleanup logic to use Airflow's Setup/Teardown API:
Marked `clean_up_workload` as a teardown task linked to `launch_workload` via `.as_teardown(setups=launch_workload)`. This ensures that successful cleanup runs do not mask upstream failures (the DAG run status will now be determined by the actual work task, `wait_for_workload_completion`).
Configured `on_failure_fail_dagrun=True` inside `as_teardown(...)`. This ensures that if the cleanup task itself fails (e.g., if we fail to delete GKE resources, risking resource leaks), the DAG run will be flagged as FAILED.1 parent baf9f2d commit e1b5af4
1 file changed
Lines changed: 25 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
230 | 234 | | |
231 | 235 | | |
232 | 236 | | |
| |||
293 | 297 | | |
294 | 298 | | |
295 | 299 | | |
| 300 | + | |
| 301 | + | |
296 | 302 | | |
297 | 303 | | |
298 | 304 | | |
| |||
302 | 308 | | |
303 | 309 | | |
304 | 310 | | |
305 | | - | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
306 | 317 | | |
307 | 318 | | |
308 | 319 | | |
| |||
471 | 482 | | |
472 | 483 | | |
473 | 484 | | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
474 | 489 | | |
475 | 490 | | |
476 | 491 | | |
| |||
512 | 527 | | |
513 | 528 | | |
514 | 529 | | |
515 | | - | |
| 530 | + | |
516 | 531 | | |
517 | 532 | | |
518 | 533 | | |
| 534 | + | |
519 | 535 | | |
520 | 536 | | |
521 | 537 | | |
| |||
731 | 747 | | |
732 | 748 | | |
733 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
734 | 755 | | |
735 | 756 | | |
736 | 757 | | |
| |||
756 | 777 | | |
757 | 778 | | |
758 | 779 | | |
759 | | - | |
| 780 | + | |
760 | 781 | | |
761 | 782 | | |
762 | 783 | | |
| 784 | + | |
763 | 785 | | |
764 | 786 | | |
765 | 787 | | |
| |||
0 commit comments