vilozio opened a new issue #18721:
URL: https://github.com/apache/airflow/issues/18721


   ### Apache Airflow version
   
   2.1.4 (latest released)
   
   ### Operating System
   
   Debian
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### What happened
   
   DAG properties `on_failure_callback` and `on_success_callback` are simple 
object attributes, but there are another depended attributes that are set only 
during initialization of a DAG - `has_on_failure_callback` and 
`has_on_success_callback`.
   
   For example, If we leave `on_failure_callback` attribute empty on 
initialization and then assign a callback to it later for a DAG object, then 
the `has_on_failure_callback` will be left False and during a scheduled dag run 
the callback will be skipped.
   
   
https://github.com/apache/airflow/blob/13a558d658c3a1f6df4b2ee5d894fee65dc103db/airflow/models/dagrun.py#L480
   
   ### What you expected to happen
   
   When we set `on_failure_callback` or `on_success_callback` attribute after 
DAG object initialization, `has_on_failure_callback` and 
`has_on_success_callback` attributes are changed respectfully. 
   
   ### How to reproduce
   
   Create a DAG object without `on_failure_callback` attribute, then separately 
assign a function to this attribute. A scheduled dag run will not call the 
callback function after a DAG failed.
   
   ### Anything else
   
   _No response_
   
   ### 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]


Reply via email to