What happens in Airflow when a task misses its SLA?
Think about how Airflow handles SLA misses without interrupting the workflow.
When a task misses its SLA, Airflow triggers an SLA miss callback and logs the event. It does not stop the DAG run or retry the task automatically. This allows the workflow to continue while notifying about the delay.
Given the following SLA miss callback function in Airflow, what will be the subject line of the notification email sent?
def sla_miss_callback(dag, task_list, blocking_task_list, slas, blocking_tis):
return f"SLA Miss Alert: DAG {dag.dag_id} missed SLA for tasks {', '.join(task_list)}"
# Assume dag.dag_id = 'data_pipeline', task_list = ['task1', 'task2']Look carefully at the string formatting in the callback function.
The callback function returns a formatted string with the DAG ID and the list of tasks that missed the SLA, joined by commas. This exact string is used as the email subject.
Which Airflow configuration setting must be enabled to send email notifications on SLA misses?
Think about what is required beyond just a config flag to send emails.
Airflow requires a defined sla_miss_callback function and a properly configured email backend to send SLA miss notifications. There is no direct config flag like 'enable_sla_miss_email'.
You configured SLA miss notifications in Airflow, but no emails are received when SLAs are missed. What is the most likely cause?
Consider all parts needed for SLA notifications to work.
Missing SLA notifications can be caused by no SLA defined, missing callback function, or incorrect email server settings. All these must be correctly set for notifications to work.
Order the steps Airflow takes when a task misses its SLA.
Think about detection, callback, notification, and workflow continuation order.
First, Airflow detects the SLA miss, then triggers the callback, which sends notifications or logs the event, and finally the DAG run continues without stopping.