Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure teardown tasks are executed when DAG run is set to failed #45530

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jscheffl
Copy link
Contributor

@jscheffl jscheffl commented Jan 9, 2025

Related to Slack topic: https://apache-airflow.slack.com/archives/CCR6P6JRL/p1736440079894049

We noticed that if a DAG run is set to failed, all tasks are either set to failed or skipped. But if Teardown Tasks are used in a DAG, they are not executed. This could lead to infrastructure or external dependencies not properly cleaned-up.

This PR changes the behavior and does NOT fail/skip teardown tasks if a DAG is set to failed.
A side effect as consequence might be that the DAG is after the call NOT failed, else if it would set it to failed, then any teardown task (even if not skipped/failed) will not scheduled anymore.

@jscheffl jscheffl added the AIP-52 Automatic setup and teardown tasks label Jan 9, 2025
@jscheffl jscheffl added this to the Airflow 2.10.5 milestone Jan 9, 2025
@boring-cyborg boring-cyborg bot added the area:API Airflow's REST/HTTP API label Jan 9, 2025
@jscheffl jscheffl added the backport-to-v2-10-test Mark PR with this label to backport to v2-10-test branch label Jan 9, 2025
@jscheffl jscheffl requested a review from dstandish January 9, 2025 22:28
@jscheffl jscheffl force-pushed the bugfix/ensure-teardown-is-executed-when-dag-set-failed branch from b9d8425 to 196b89c Compare January 9, 2025 23:08
@jscheffl jscheffl marked this pull request as ready for review January 9, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AIP-52 Automatic setup and teardown tasks area:API Airflow's REST/HTTP API backport-to-v2-10-test Mark PR with this label to backport to v2-10-test branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant