-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
on_failure_callback
on DAG level is not executed
#16983
Comments
Thanks for opening your first issue here! Be sure to follow the issue template! |
Can you test this on airflow 2.1.1? |
@ephraimbuddy I can confirm that the issue exists on 2.1.1 |
I think the root cause might be from this airflow/airflow/jobs/scheduler_job.py Line 1063 in 6ab00bf
apparently callback is disabled. |
If you are not going to make a PR for this, I can try to make an investigation and fix this. |
@samgans I might not have time to investigate more on this issue, but it might be more complicated than it sounds, my comment above is only the surface, underneath it's more about message passing in multiple processes of |
@trucnguyenlam Callback execution is disabled here, but that disabled callback is returned as the second value here ( |
@uranusjr yeah, I also came to that conclusion yesterday but didn't have time to go further, the callback somehow lost on the connection to |
@uranusjr how is it going with the investigation? |
UPD: I have been testing the interaction and found that if we are passing the callable to the Continue review... |
The
|
@ephraimbuddy I think there is some misleading here, it is a valid argument for a DAG object Line 267 in 16564ca
|
Oops |
on_failure_callback
is not executedon_failure_callback
on DAG level is not executed
So this too works fine, however, the logs end in : Lines 829 to 830 in 938510f
I tested with your dag. Let me know what you think |
@ephraimbuddy thanks for providing more information, I will check out the log location if it's executed, could you also let me know if there is a way to log those in the main scheduler log (only if it's applicable)? |
I'm not sure there's a way to get the log into the main scheduler log, however, you can ask on Discussion or slack |
@ephraimbuddy I checked the location of the log, the callback does get handled. So it is technically working for me. Thanks. |
Cool. Let's close the issue then |
Apache Airflow version: 2.0.1 and 2.1.1
Kubernetes version (if you are using kubernetes) (use
kubectl version
): 1.20.4Environment:
uname -a
): Linux 5.4.117-58.216.amzn2.x86_64What happened:
Airflow dag failed and
on_failure_callback
was not triggered.Logs were also not shown which may be related to issue #13692.
In the worker pod logs I get the following error messages:
What you expected to happen:
I expected the callback function to be called and executed.
It sounds like the
null
hostname issue contributed to this happening but I am not familiar enough with Airflow internals to say for sure. I had a dig through the source code and it looks like some queries are made to list out tasks and other metadata.airflow/airflow/models/dag.py
Line 822 in b0f7f91
How to reproduce it:
Create a dag with a function that fails and an error callback function
Run the dag and check if the
on_failure_callback
is called.The text was updated successfully, but these errors were encountered: