KubernetesPodOperator on_failure_callback doesnt work on Airflow 2.4.2

644 Views Asked by At

When using the newest Airflow version (2.4.2), the on_failure_callback doesnt get triggered on KubernetesPodOperator tasks. The on_success_callback works just fine.

For each KubernetesPodOperator task I set on_success_callback=send_success_notification() and on_failure_callback=send_failure_notification().

If the task succeeds, the notification gets send. However, in case of failure, the on_failure_callback doesn't get triggered. Is this some bug related to newest version?

1

There are 1 best solutions below

0
On

I know it's a late answer but there's a mistake or typo in the examples:

... I set on_success_callback=send_success_notification() and on_failure_callback=send_failure_notification().

Both the send_success_notification() and send_failure_notification() should be a reference to the function, not a function call. What I mean is you need to drop the brackets () from the end like:

on_success_callback=send_success_notification and on_failure_callback=send_failure_notification