lukeknxt opened a new issue, #22970: URL: https://github.com/apache/airflow/issues/22970
### Apache Airflow version 2.2.3 ### What happened When a task instance is in a failed state (or any other non running state), and then it's marked as successful through the UI, the `on_success_callback` set on the task instance is not run. ### What you think should happen instead The `on_success_callback` should run when marking a task instance successful from the UI regardless of its state. ### How to reproduce - Create a DAG - Add a task with an `on_success_callback` that throws an exception (so it fails) - Run the DAG in the UI - Wait for the task instance to fail for that DAG run - Mark the task instance successful in the UI for that DAG run ### Operating System Debian 10 (Buster) ### Versions of Apache Airflow Providers `apache-airflow-providers-databricks==2.5.0` This is the main provider we care about at the moment. ### Deployment Other Docker-based deployment ### Deployment details _No response_ ### Anything else From my observations, it seems as though the `on_success_callback` _is_ run when a task instance is in a `RUNNING` state, and then is marked successful from the UI, but not when the task instance is in any other state. From some brief digging this behaviour appears to be related to [the `heartbeat_callback`](https://github.com/apache/airflow/blob/e09b4f144d1edefad50a58ebef56bd40df4eb39c/airflow/jobs/local_task_job.py#L236) based on [this old bug report](https://issues.apache.org/jira/browse/AIRFLOW-6821) but I can't see any equivalent logic for when the task _isn't_ running. For context - we are using this behaviour to track issues occurring in Airflow with a 3rd party tool where marking a task instance as successful is effectively an "ignore", and our `on_success_callback` lets us register that ignore to another tool that tracks alerting. ### Are you willing to submit PR? - [X] 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]
