Airflow orchestration

DAGs, data-interval-aware scheduling, idempotent task design, backfills, sensors vs deferrable operators, SLA alerts. "How do you backfill 6 months safely?" is a favorite.

About 24 min read3-question knowledge check

The mental model

Airflow is a factory foreman with a wall calendar, not a cron daemon. Cron answers one question — "is it 2am yet?" — and fires a script into the void. Airflow answers a different question: "for the *data interval* that just closed, has every upstream task that this task depends on succeeded, and if so, run it — and if it fails, retry it, and if the whole thing needs re-running for a day three weeks ago, do exactly that day again the same way." The unit Airflow reasons about is not "now"; it is a window of time that has ended and the work owed for it.

That single shift is why Airflow feels strange at first. The analogy that sticks: a payroll department. Payroll does not process "today's pay" — it processes *the pay period that closed*. When a run for the June 1–2 period executes, it must use June 1–2's timesheets no matter what wall-clock day the run actually happens — whether it ran on time on June 3rd, or you are re-running it in August because a bug was found. The **logical date** (for interval schedules, the start of the data interval; the older name execution_date is deprecated) is the pay period; datetime.now() is the day the clerk happened to sit down. A pipeline that reads now() is a payroll clerk who pays everyone based on the day they opened the spreadsheet — correct only by luck, and catastrophic on a backfill.

The WHY behind everything else follows from this: a task must be a pure function of its data interval. Given the same interval, it must produce the same result no matter how many times it runs. Airflow gives you retries, backfills, and catch-up for free — but only if your tasks are idempotent. If they are not, every one of those features becomes a way to silently corrupt data. Airflow's power and its footguns are the same feature seen from two sides.

The full lesson continues with 15 more sections
  • Deep dive
  • Internal architecture
  • Real-world use cases
  • Best practices
  • Common mistakes
  • Performance
  • Security
  • Production troubleshooting
  • Advantages & disadvantages
  • Alternatives
  • Interview expectations
  • Interview questions
  • Facts to remember
  • Cheat sheet
  • Quick revision