'airflow sla_miss_callback function doesn't trigger and doesn't show up in dag details page

I would like to send alerts via my custom callback function that I'm calling during dag initialization as show below-

dag = DAG('tutorial', default_args=default_args, schedule_interval=timedelta(days=1), sla_miss_callback=my_sla_miss_cb_func)

My def signature is as follows-

def my_sla_miss_cb_func(): ...custom_logic....

I've got sla attribute for the tasks I would like to monitor and I see that I get SLA MISS emails when I give email_on_failure=True but my_sla_miss_cb_func function doesn't get called/triggered.

Also, sla_miss_callback attribute doesn't show up in Details page in airflow UI.

I'm using airflow 1.7.1.3



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source