0
0
Apache Airflowdevops~5 mins

Task failure callbacks in Apache Airflow - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is a task failure callback in Airflow?
A task failure callback is a function that runs automatically when a task fails. It helps you respond to failures, like sending alerts or cleaning up resources.
Click to reveal answer
beginner
How do you define a task failure callback in an Airflow DAG?
You define a Python function and assign it to the task's on_failure_callback parameter. This function receives context about the failed task.
Click to reveal answer
intermediate
What kind of information can you access inside a task failure callback function?
You can access the task instance, execution date, exception details, and other context data to understand why the task failed.
Click to reveal answer
intermediate
Why use task failure callbacks instead of just checking logs?
Callbacks let you automate responses like sending emails or notifications immediately after failure, saving time and reducing manual checks.
Click to reveal answer
beginner
Can you use the same failure callback for multiple tasks?
Yes, you can reuse the same failure callback function for many tasks to keep your code simple and consistent.
Click to reveal answer
What parameter do you use to set a failure callback on an Airflow task?
Aon_retry_callback
Bon_success_callback
Con_failure_callback
Don_complete_callback
What does the failure callback function receive as input?
AThe task context dictionary
BThe task logs only
CThe DAG definition
DThe Airflow scheduler
Which of these is a common use for task failure callbacks?
AUpdating Airflow version
BSending alert emails
CChanging task priority
DStarting a new DAG run
Can a failure callback stop the task from failing?
ANo, it only runs before the task
BYes, it can fix the error automatically
CYes, it prevents failure if set
DNo, it runs after failure happens
Is it possible to share one failure callback function across multiple tasks?
AYes, it promotes code reuse
BNo, each task needs a unique callback
COnly if tasks are in the same DAG
DOnly for tasks with the same operator
Explain how to create and use a task failure callback in Airflow.
Think about what happens when a task fails and how you can respond automatically.
You got /4 concepts.
    Describe why task failure callbacks are useful in managing Airflow workflows.
    Consider how you handle problems in daily tasks and how automation helps.
    You got /4 concepts.