liveBook · Manning

Max active runs

As explained in Data Pipelines with Apache Airflow, Second Edition

max_active_runs_per_dag is an Airflow DAG setting that limits the number of simultaneously active runs of a DAG.

Historical backfills can create hundreds of parallel DAG runs, crowding out other workflows or overloading external systems. Set a DAG's max_active_runs to cap how many runs may be active simultaneously. section 3.6

When the limit is reached, Airflow does not create new DAG runs until earlier runs complete. An unset DAG-level value inherits core.max_active_runs_per_dag, which defaults to 16. section 3.6 section 15.4.4

Limit concurrent backfill runs

dag = DAG('my_dag', max_active_tasks=10, max_active_runs=2) This configuration allows at most two active runs of my_dag, with at most ten task instances running in parallel across those runs. section 3.6

Use the setting alongside other concurrency controls:

  • Use max_active_tasks to limit parallel task instances within a DAG. section 3.6
  • Use pools to constrain particular task groups, especially resource-intensive work. section 3.6 section 15.4.4
  • Account for global parallelism and Celery worker concurrency when estimating actual capacity. section 15.4.4
Table 15.2 Overview of Airflow configurations related to running number of tasks

Configuration item

Default value

Description

AIRFLOW__CORE__ MAX_ACTIVE_TASKS_PER_DAG

16

The maximum number of tasks to be in the queued or running state per DAG

AIRFLOW__CORE__ MAX_ACTIVE_RUNS_PER_DAG

16

The maximum number of parallel DAG runs per DAG

AIRFLOW__CORE__ PARALLELISM

32

The maximum number of task instances to run in parallel globally

AIRFLOW__CELERY__ WORKER_CONCURRENCY

16

The maximum number of tasks per Celery worker

Compare max_active_runs_per_dag with DAG task limits, global parallelism, and Celery worker concurrency. section 15.4.4

How Data Pipelines with Apache Airflow, Second Edition covers it

How deep it goes
Explains the run-creation cap, default inheritance, and interaction with task, pool, global, and worker limits.
Examples
Uses a DAG configured with max_active_tasks=10 and max_active_runs=2, plus a concurrency-settings comparison table.
What it assumes
Assumes familiarity with DAGs, task instances, and backfilling; distinguishes run-level limits from task- and worker-level limits.
What you can do after
Operate/configure Airflow by limiting concurrent DAG runs and combining the limit with pools and task-capacity settings.
How it connects
Connects DAGs, backfilling, max_active_tasks, pools, parallelism, and Celery worker concurrency.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Data Pipelines with Apache Airflow, Second Edition. The section links point to the parts of the book it draws on.