JoostDuisters opened a new issue, #46937: URL: https://github.com/apache/airflow/issues/46937
### Apache Airflow version 2.10.5 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? I've recently upgraded to Airflow version 2.10.5. There seems to be an issue with marking DagRuns as successful . Recently we've observed the following: - When an intermediate step fails, it get's marked as failed as it should - The teardown step runs and gets marked as successful - The DagRun is marked as unsuccessful as a result - Problem: when we try to mark the DagRun as successful through the UI, it marks all the failed and skipped tasks as successful, but it fails to mark the DagRun as successful. We have narrowed it down to this code-change: https://github.com/apache/airflow/pull/45530, and in specific these lines: https://github.com/apache/airflow/blob/c141383d5bf70e59d03d64490f9e68cefcdabda3/airflow/api/common/mark_tasks.py#L218-L223 So according to this logic, it won't update the DagRun status if there are more tasks than non-teardown tasks, with the assumption that the teardown task will still run, and this would then update the DagRun status afterwards. However the teardown task won't run because it has already succeeded. ### What you think should happen instead? I should be able to manually set a DagRun with teardown tasks to successful through the UI. ### How to reproduce This minimal example allows you to reproduce the error: ``` from airflow.operators.bash import BashOperator from airflow.models import DAG with DAG(dag_id="test_teardown", tags=["debug", "teardown"]): success = BashOperator(task_id='success', bash_command='exit 0') failure = BashOperator(task_id='failure', bash_command='exit 1') teardown = BashOperator(task_id='teardown', bash_command='exit 0') success >> failure >> teardown.as_teardown() ``` Steps to reproduce: - Trigger Dag and wait for it to fail - Mark state on DagRun as success - Notice DagRun status still failed Some screenshots: <img width="315" alt="Image" src="https://github.com/user-attachments/assets/bad79dd5-330b-4677-9e7d-6695444d041d" /> <img width="308" alt="Image" src="https://github.com/user-attachments/assets/d5607d42-9cc5-4137-99e2-e5b4a5f511ca" /> ### Operating System I'm running this inside docker-compose ### Versions of Apache Airflow Providers This minimal example does not use any providers. ### Deployment Docker-Compose ### Deployment details I use this docker compose file from the airflow docs: https://airflow.apache.org/docs/apache-airflow/2.10.5/docker-compose.yaml ### Anything else? - The problem also happens when you try to change the status via the `List Dag Run` tab - The behaviour is as expected as per the PR when you mark a running DagRun as successful - The response of the rest request looks like this (status 200): `{"message": "Marked success on 1 task instances", "status": "success"}` - Just marking the failed task as success doesn't fix the problem A helpful workaround for anyone else facing this issue: you can clear the teardown task (after all the tasks are marked as successful), once this runs successfully the DagStatus goes to successful. ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
