0
0
Apache Airflowdevops~20 mins

ExternalTaskSensor for cross-DAG dependencies in Apache Airflow - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
ExternalTaskSensor Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2: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={})
AThe sensor completes successfully without waiting because the external DAG is missing.
BThe sensor raises AirflowException immediately because the external DAG is not found.
CThe sensor waits until timeout and then raises AirflowSensorTimeout.
DThe sensor retries indefinitely without timeout.
Attempts:
2 left
💡 Hint
Think about how sensors behave when the external task or DAG is not yet available.
🧠 Conceptual
intermediate
1: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?
Amode
Bsoft_fail
Ctimeout
Dpoke_interval
Attempts:
2 left
💡 Hint
This parameter changes how the sensor behaves during waiting periods.
🔀 Workflow
advanced
2: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?
AExternalTaskSensor(external_dag_id='dag_b', external_task_id='task_b', execution_date_fn=lambda dt: dt - timedelta(minutes=10))
BExternalTaskSensor(external_dag_id='dag_b', external_task_id='task_b', execution_delta=timedelta(minutes=-10))
CExternalTaskSensor(external_dag_id='dag_b', external_task_id='task_b', execution_date_fn=lambda dt: dt + timedelta(minutes=10))
DExternalTaskSensor(external_dag_id='dag_b', external_task_id='task_b', execution_delta=timedelta(minutes=10))
Attempts:
2 left
💡 Hint
execution_delta shifts the execution date to look for the external task.
Troubleshoot
advanced
2: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?
AThe external DAG has no active DAG runs matching the execution date the sensor is waiting for.
BThe external task_id is misspelled in the sensor configuration.
CThe sensor's poke_interval is too short causing premature failure.
DThe sensor is running in 'poke' mode instead of 'reschedule' mode.
Attempts:
2 left
💡 Hint
Check the external DAG's run status and execution dates.
Best Practice
expert
3: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?
AUse mode='poke' to keep the sensor active and avoid missing external task completion.
BSet timeout to None so the sensor waits indefinitely for the external task.
CUse execution_delta or execution_date_fn to align execution dates and avoid circular waits.
DTrigger all dependent DAGs manually to avoid sensor waits.
Attempts:
2 left
💡 Hint
Think about how execution dates affect cross-DAG dependencies and waiting.