Skip to the page

Orchestration and dbt · mid

Timeouts, sensors and alerts that fire

A task that hangs never fails, so no retry and no alert happen. Put timeouts on every task and outside call, use deferrable or rescheduled sensors, and alert on things that do not happen.

The notes

What you must know

  • A hung HTTP call with no timeout can keep a task running for hours. Without execution_timeout the task never fails, so retries never start and the failure alert never fires.
  • Fix: timeouts on every outside call (requests.get(url, timeout=(5, 60))), execution_timeout on every task, and retries with retry_delay and exponential backoff.
  • Airflow 3 removed SLAs. Deadline Alerts (3.1) replace them, for example alert if a DAG run is not done 2 hours after it was queued.
  • Add freshness checks on output tables (dbt source freshness or a monitor), independent of Airflow, routed to on-call and not to an email list.
  • A sensor in the default poke mode holds a worker slot for its whole wait. Late partner files can take every slot so real work cannot start.
  • Reschedule mode gives the slot back between checks. Deferrable sensors (deferrable=True) hand the wait to the triggerer, an asyncio process that can watch thousands of waits.
  • The default sensor timeout is 7 days. Set hours, with soft_fail where skipping is acceptable. Put sensors in a small pool so they cannot starve other tasks.
  • Airflow 3 adds event-driven scheduling with asset watchers (for example a queue message when a file lands) so no sensor needs to wait.
  • When a task is stuck: read the log, find what it waits on, mark it failed so it retries, check the step is safe to repeat, run late downstream DAGs in priority order, and tell users the ETA.

The red pen

Common traps: mistake → fix

  • Mistake: Add more retries for a hung task

    Fix: a hung task never fails; add timeouts.

  • Mistake: Add more workers for sensor starvation

    Fix: change the sensor mode or use deferrable sensors.

  • Mistake: Lower the poke interval to be faster

    Fix: it only uses the slot more.

Easy to hard

Questions interviewers ask, easy to hard

  1. A task hung for six hours and nobody noticed. What do you do and what do you change?
  2. Every worker slot is used by sensors. Why and how do you fix it?
  3. What is a deferrable sensor?
  4. How do you alert when a pipeline does not run at all?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview