Skip to content
Bronze 5 min read · Schedules 3 practice problems ↓

Catchup, backfill and end_date

When a pipeline is deployed with a start date in the past, or when old data must be reprocessed, Airflow can create runs for past dates. This lesson shows catchup, backfills, and how to run them without overloading anything.

Pipelines in production · Airflow · Bronze · Schedules, lesson 2 of 2

Read first: Schedules and logical dates (skip if you know it)

In plain words first

A cleaner who returns from two weeks off can clean only today, or clean every day they missed, one by one. Doing all fourteen at once would block the corridor.

catchup decides whether Airflow creates the missed runs when a DAGDAG: A pipeline in Airflow: a set of tasks and the order they run in, defined in a Python file and run on a schedule. Learn more → is deployed; a backfill is asking for past runs on purpose, at a controlled pace.

Deployed late: which runs exist?

A DAG with a start date in the past is deployed today. Should it run for every day it missed? catchup decides. In Airflow 3 it is False by default: the schedulerscheduler: The Airflow process that reads DAG files, creates runs when they are due, and queues the tasks whose upstream tasks are done. Learn more → creates a run for the most recent schedule that has passed, then one for every schedule after it. With catchup=True it creates a run for every schedule since start_date.

Python · dags/royalties_daily.py · catchup off (the default): only the latest slot, then onwards
import pendulum
from airflow.sdk import DAG
from airflow.providers.standard.operators.bash import BashOperator

with DAG(
    dag_id="royalties_daily",
    schedule="@daily",
    start_date=pendulum.datetime(2026, 3, 1, tz="UTC"),
):
    compute = BashOperator(
        task_id="compute_royalties", bash_command="royalties --day {{ ds }}"
    )

What the scheduler does · deployed Mar 5, 10:00 UTC · grid as of Mar 6, 01:00 UTC · @daily (CronTriggerTimetable)

task \ runMar 5
00:00
Mar 6
00:00
compute_royalties

success· the bar on top is the run's state; a number is how many tries

Catching up, one day at a time

Turn catchup on and the same deploy creates runs from 1 March. By default up to 16 runs of a DAG can be active at once (max_active_runs), so a long catch-up starts many runs together and every one of them hits the same warehouse. max_active_runs=1 makes them go in order: the next run is created when the previous one finishes. end_date stops the schedule.

Python · dags/royalties_backfill.py · catchup with one run at a time, stopping after 4 March
import pendulum
from airflow.sdk import DAG
from airflow.providers.standard.operators.bash import BashOperator

with DAG(
    dag_id="royalties_backfill",
    schedule="@daily",
    start_date=pendulum.datetime(2026, 3, 1, tz="UTC"),
    end_date=pendulum.datetime(2026, 3, 4, tz="UTC"),
    catchup=True,
    max_active_runs=1,
):
    compute = BashOperator(
        task_id="compute_royalties", bash_command="royalties --day {{ ds }}"
    )

What the scheduler does · deployed Mar 10, 08:00 UTC · grid as of Mar 10, 10:00 UTC · failing: compute_royalties in the 2026-03-02 run · @daily (CronTriggerTimetable)

task \ runMar 1
00:00
Mar 2
00:00
Mar 3
00:00
Mar 4
00:00
compute_royalties

successfailed· the bar on top is the run's state; a number is how many tries

The 2 March run fails, and the 3 March run starts anyway: runs are independent. When each day builds on the previous one (a running total, a snapshot table), set depends_on_past=True on the tasktask: One step of a DAG, such as running a query or calling an API. Each run of a task for one date is a task instance. Learn more →: it then waits until the same task succeeded in the previous run, so one bad day stops the days after it instead of producing wrong results on top of it.

Backfilling on purpose

Catchup is decided when the DAG is deployed. To reprocess a range later (a bug fix, a new column), run a backfill. In Airflow 3 the scheduler runs backfills, so they show up in the UI like any other runs and survive your terminal closing:

Shell · February again, only the days that failed, two at a time
airflow backfill create --dag-id royalties_daily \
  --from-date 2026-02-01 --to-date 2026-02-28 \
  --reprocess-behavior failed \
  --max-active-runs 2
--reprocess-behaviorDays that already have a run
noneLeft alone: only missing days are created
failedFailed runs are run again
completedEvery day is run again, successful ones too

A backfill only gives correct results if each run produces the same output whenever it runs, which is what Templates and idempotentidempotent: Safe to run again: running a step twice gives the same result as running it once. Learn more → reruns is about.

Common mistakes

  • catchup=True on a DAG with a start date years ago — A daily DAG with start_date 2021-01-01 creates over 1,800 runs the moment it is deployed. Set a realistic start_date, or backfill on purpose.
  • A long catch-up with the default max_active_runs — Up to 16 days start at once and hit the same warehouse together. Set max_active_runs to 1 to 4.
  • Expecting a failed day to stop the next ones — 2 March fails and 3 March runs anyway, building its running total on a missing day. Set depends_on_past=True on the task.
  • Backfilling a DAG whose tasks use the current date — A task that reads datetime.now() processes today's data for every backfilled day of March. Use the run's date: {{ ds }}.

Key takeaways

  • In Airflow 3, catchup defaults to False: a late deploy creates a run for the latest slot, then one for every slot after it.
  • Catchup is decided at deploy; to reprocess a range later, use airflow backfill create, which runs in the scheduler and shows in the UI.
  • A backfill's rerun option chooses what runs again: none (only missing days), failed, or completed (every day).
  • end_date stops the schedule, and a backfill is only correct if each run gives the same output whenever it runs.

Interview prep

THE QUESTION

"A DAG with start_date six months ago is deployed today. What runs does it create, and how would you load the six months?"

In Airflow 3 catchup defaults to False, so it creates a run for the most recent scheduled time and continues from there; nothing for the six months. To load history, either set catchup=True with a sensible max_active_runs (say 1 to 4) so the scheduler works through it at a controlled pace, or keep catchup off and run airflow backfill create for the range, choosing --reprocess-behavior and --max-active-runs. Either way the tasks must be idempotent and use the run's dates, and depends_on_past helps when each day builds on the previous one.

Avoid: "catchup is on by default". It was in Airflow 2; Airflow 3 defaults to catchup=False.

Follow-ups · answer out loud, then open

Follow-up"What does --reprocess-behavior do in airflow backfill create?"
It decides what happens to dates that already have runs: none creates only missing runs, failed reruns the failed ones too, completed reruns every date in the range, including successful ones.
Scenario"A backfill of a year must not overload the warehouse and must stop at the first bad day. How?"
Run it with max active runs of 1 (or a small number), and set depends_on_past=True on the tasks that build on the previous day, so a failure stops later days instead of producing wrong results on top of it. Make the tasks idempotent so failed days can simply be rerun.
Trap"depends_on_past makes the whole run wait for the previous run."
It works per task: a task instance waits for the same task in the previous run to succeed (or be skipped). Other tasks in the run are not affected unless they set it too.

Check yourself

3 questions

A @daily DAG with start_date 1 March is deployed on 5 March at 10:00, catchup not set. Which runs are created that day?

Show the answer

Only 5 March. catchup defaults to False: the most recent slot that has passed, 5 March 00:00.

What does max_active_runs=1 do during a catch-up?

Show the answer

Runs the days one after another. The next run is created when the active one finishes.

Which option makes a task wait until it succeeded in the previous run?

Show the answer

depends_on_past. depends_on_past checks the same task in the previous run.

Practise this

Problems that use this, graded on hidden tests

See all 4 problems →

Keep going

Up next · new module: Tasks · 5 min read
Operators and TaskFlow
BashOperator, PythonOperator and @task: when to use which, and where providers come in.

Related lessons

Previous: Schedules and logical dates

Primary sources: Catchup · Backfill