Failure callbacks

A callback is a function called automatically by Airflow on an event: failure, success, or retry of a task or DAG (on_failure_callback, on_success_callback). It is used to send an alert, log, or trigger a corrective action, with access to the run's context.

Example

def alerte(context):
    print('Failure:', context['task_instance'].task_id)

Related concepts

The whole glossary