PROFESSIONAL-DATA-ENGINEER · Question #301
You orchestrate ETL pipelines by using Cloud Composer. One of the tasks in the Apache Airflow directed acyclic graph (DAG) relies on a third-party service. You want to be notified when the task does…
The correct answer is C. Assign a function with notification logic to the on_failure_callback parameter tor the operator responsible for the task at risk. on_failure_callback is the correct parameter because it triggers immediately and exclusively when a task fails - exactly the condition described. You assign it a Python function containing your notification logic (e.g., sending an email or Slack alert), and Airflow calls it…
Question
Options
- AAssign a function with notification logic to the on_retry_callback parameter for the operator responsible for the task at risk.
- BConfigure a Cloud Monitoring alert on the sla_missed metric associated with the task at risk to trigger a notification.
- CAssign a function with notification logic to the on_failure_callback parameter tor the operator responsible for the task at risk.
- DAssign a function with notification logic to the sla_miss_callback parameter for the operator responsible for the task at risk.
How the community answered
(42 responses)- B2% (1)
- C93% (39)
- D5% (2)
Explanation
on_failure_callback is the correct parameter because it triggers immediately and exclusively when a task fails - exactly the condition described. You assign it a Python function containing your notification logic (e.g., sending an email or Slack alert), and Airflow calls it automatically on failure.
Why the distractors are wrong:
- A (
on_retry_callback) fires when a task is retried, not when it ultimately fails - you'd miss the final failure event if retries are exhausted silently. - B (Cloud Monitoring SLA metric) addresses SLA misses (tasks that run too long), not task failures - a different problem entirely.
- D (
sla_miss_callback) is a DAG-level parameter for SLA breach notifications, not task failure; it also monitors timing, not success/failure state.
Memory tip: Think of the callbacks as matching their names literally - on_failure_callback = "call this when it fails", on_retry_callback = "call this when it retries". Since the question asks about "does not succeed" (i.e., fails), on_failure_callback is the direct match.
Topics
Community Discussion
No community discussion yet for this question.