Challenge - 5 Problems
ExternalTaskSensor Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate2:00remaining
What is the output when ExternalTaskSensor waits for a non-existent DAG?
You have an ExternalTaskSensor configured to wait for a task in a DAG that does not exist. What will happen when the sensor runs?
Apache Airflow
sensor = ExternalTaskSensor(
task_id='wait_for_task',
external_dag_id='non_existent_dag',
external_task_id='some_task',
mode='reschedule',
timeout=30
)
sensor.execute(context={})Attempts:
2 left
💡 Hint
Think about how sensors behave when the external task or DAG is not yet available.
✗ Incorrect
ExternalTaskSensor checks for the external DAG on the first poke. If the DAG does not exist, it raises AirflowException immediately.
🧠 Conceptual
intermediate1:30remaining
Which parameter controls the mode of ExternalTaskSensor to free worker slots while waiting?
In Airflow's ExternalTaskSensor, which parameter should you set to 'reschedule' mode to avoid occupying a worker slot while waiting for the external task?
Attempts:
2 left
💡 Hint
This parameter changes how the sensor behaves during waiting periods.
✗ Incorrect
The 'mode' parameter controls whether the sensor occupies a worker slot ('poke') or frees it while waiting ('reschedule'). Setting mode='reschedule' frees the slot.
🔀 Workflow
advanced2:30remaining
Identify the correct ExternalTaskSensor configuration for cross-DAG dependency with execution date tolerance
You want to configure an ExternalTaskSensor to wait for a task in another DAG but allow a 10-minute delay in execution date matching. Which configuration is correct?
Attempts:
2 left
💡 Hint
execution_delta shifts the execution date to look for the external task.
✗ Incorrect
execution_delta shifts the execution date backward by 10 minutes, allowing the sensor to wait for a task that ran up to 10 minutes earlier.
❓ Troubleshoot
advanced2:00remaining
Why does ExternalTaskSensor fail with 'No active runs found' error?
You configured ExternalTaskSensor to wait for a task in another DAG, but it fails with 'No active runs found' error. What is the most likely cause?
Attempts:
2 left
💡 Hint
Check the external DAG's run status and execution dates.
✗ Incorrect
The sensor looks for an active DAG run matching the execution date. If none exists, it raises 'No active runs found'.
✅ Best Practice
expert3:00remaining
What is the best practice to avoid deadlocks when using ExternalTaskSensor for cross-DAG dependencies?
When using ExternalTaskSensor to create dependencies between DAGs, what is the best practice to avoid deadlocks and ensure smooth execution?
Attempts:
2 left
💡 Hint
Think about how execution dates affect cross-DAG dependencies and waiting.
✗ Incorrect
Aligning execution dates with execution_delta or execution_date_fn prevents sensors from waiting for tasks that never run, avoiding deadlocks.