Airflow

On this page 7

Airflow, formally Apache Airflow, is an open-source workflow orchestration platform in which pipelines are defined as Python code, structured as directed acyclic graphs (DAGs) of tasks, and executed on a schedule or in response to data events. Among automation platforms, it occupies the code-first, data-engineering end of the spectrum: it coordinates batch jobs such as extracting data, running transformations, training models and refreshing reports.

Airflow does not move or process data itself in the ideal design. It orchestrates other systems, such as databases, warehouses, Spark clusters or cloud services, and tracks the state, retries and history of every task. This separation explains both its strengths, which are visibility and control over complex dependencies, and its typical misuse, which is pushing heavy computation into the orchestrator.

How Airflow represents and runs workflows

A DAG is a Python file that declares tasks and the dependencies between them. Each task is an instance of an operator, a reusable template for one kind of work, such as running SQL, calling an HTTP endpoint or executing a Python function. The TaskFlow API lets developers turn plain Python functions into tasks with a decorator, which keeps simple pipelines short and readable.

Every execution of a DAG is a DAG run, usually tied to a logical date or data interval, and every execution of a task inside it is a task instance with its own state, such as queued, running, success, failed or up for retry. This model makes backfills possible: the same DAG can be run for past intervals to reprocess historical data.

ComponentResponsibilityOperational note
SchedulerParses DAGs, creates runs and queues ready tasksHeart of the system; needs reliable resources
ExecutorDecides how and where tasks runLocal, Celery or Kubernetes variants
WorkersExecute task codeScale with workload
Metadata databaseStores DAG runs, task states and historyUsually PostgreSQL or MySQL
Web interface and APIMonitoring, logs, manual triggersMain operator tool
TriggererWaits on external events for deferrable tasksSaves worker slots during long waits
Core components of an Airflow deployment

Scheduling, sensors and data-aware triggers

Airflow supports several ways to start a DAG run. Time-based schedules use cron expressions or presets such as daily, while data-aware scheduling starts a DAG when an upstream task updates a declared data asset. In Airflow 3, released in 2025, these objects are called assets; earlier versions called them datasets.

MechanismHow it worksTypical use
Cron or preset scheduleRun at fixed times per data intervalNightly warehouse loads
Asset-based schedulingRun when upstream data is updatedChaining pipelines owned by different teams
SensorTask that waits until a condition is metWait for a file to land in storage
Deferrable operatorReleases its worker while waitingLong waits on external jobs
Manual or API triggerRun on demand with parametersAd hoc reprocessing
Ways to start and coordinate work in Airflow

Classic sensors occupy a worker slot for the entire wait, which can block a cluster when many of them poll at once. Using reschedule mode or deferrable operators frees resources and is the recommended approach for waits longer than a few minutes.

Airflow compared with other automation platforms

Airflow and tools such as n8n, Zapier, Make, Power Automate and Node-RED all automate workflows, but they target different users and workloads. Airflow assumes Python skills, batch processing and infrastructure ownership; the others favor visual editors and event-driven integrations between business applications.

PlatformAuthoring styleTypical workloadHosting
AirflowPython code, DAGsBatch data pipelines and ML workflowsSelf-hosted or managed cloud services
n8nVisual nodes with code optionsBusiness and API integrationsSelf-hosted or cloud
ZapierNo-code stepsSaaS app automationsCloud only
MakeVisual scenariosMulti-step SaaS integrationsCloud only
Power AutomateLow-code flows and RPAMicrosoft 365 and desktop tasksCloud and desktop
Node-REDFlow-based wiringIoT and event streamsSelf-hosted, often on edge devices
Airflow versus neighboring automation platforms

Airflow is a weak fit for low-latency, event-by-event processing, such as reacting to each incoming webhook within seconds. Its scheduling overhead and run-based model suit pipelines that run minutes to hours, not thousands of small real-time events.

Practical design guidelines

Reliable Airflow pipelines follow a few principles that experienced teams treat as non-negotiable. The most important is idempotency: running a task twice for the same interval must produce the same result, so that retries and backfills are safe.

GuidelinePracticeReason
Idempotent tasksOverwrite partitions instead of appendingRetries do not duplicate data
Light DAG filesNo heavy queries or API calls at import timeThe scheduler parses files repeatedly
Small XCom payloadsPass references, not datasetsMetadata database is not a data store
Explicit retriesSet retries and retry delay per taskTransient failures recover automatically
External computeRun heavy work in warehouses or containersKeeps workers stable
Design guidelines for Airflow pipelines

Teams also benefit from testing DAGs in continuous integration, at least by importing every file and checking for cycles and missing dependencies, before deploying them to a shared environment.

Limitations and common mistakes

  • Using Airflow as a processing engine. Large data transformations inside workers cause memory errors and slow scheduling.
  • Misunderstanding the logical date. A daily run for one interval starts after that interval ends, which confuses many newcomers.
  • Top-level code in DAG files. Database calls at import time slow down the whole scheduler.
  • Unbounded catchup. Enabling catchup on an old start date can launch hundreds of runs at once.
  • Underestimating operations. Self-hosting requires upgrades, database care and monitoring.

Because of the operational burden, many organizations use managed Airflow services from cloud providers. These remove infrastructure work but not the need for disciplined DAG design.

In plain words

Airflow is like a very reliable project coordinator for computer jobs. It knows which job must finish before the next one can start, starts each one at the right time and tries again if something fails.

It also keeps a detailed record, so anyone can see which steps succeeded, which failed and why. The jobs themselves are done by other systems; Airflow makes sure they happen in the right order and nothing is forgotten.

A real-world example

A retail chain collects sales data from 300 stores every night. Analysts need a fresh dashboard by 7 a.m., but the data arrives at different times and must be cleaned, merged with inventory records and loaded into a warehouse.

The data team builds one Airflow DAG with about 20 tasks. A deferrable sensor waits for each region’s files, transformation tasks run SQL in the warehouse, a quality check stops the pipeline if totals look implausible, and a final task refreshes the dashboard. Each task retries three times with a 10-minute delay. When a store system fails one night, only that region’s tasks are rerun, and the dashboard is still ready on time for every other region, with a clear alert explaining the gap.