Apache Airflow: A Guide to Workflow Orchestration
Apache Airflow is an open-source platform for building, scheduling and monitoring workflows. It was started at Airbnb to bring order to a growing pile of interdependent data jobs, and later became a project of the Apache Software Foundation. Instead of clicking through a scheduler's interface or chaining cron jobs with fragile shell scripts, you describe your workflow as a piece of Python code, and Airflow takes care of when to run it, in what order, and what to do when something fails.
What a workflow looks like
In Airflow a workflow is a DAG — a directed acyclic graph. Each node is a task, each edge says one task must finish before another starts, and "acyclic" means the chain never loops back on itself. A DAG is written in a Python file and collected by Airflow automatically, so your pipelines live in version control alongside the rest of your code and can be reviewed like any other change.
Tasks are built from operators, which come in families: a Python operator that calls a function, a Bash operator that runs a command, database operators that execute queries, and hundreds of community-provided ones that talk to cloud storage, warehouses and messaging systems. Sensors are a special kind that wait for something to happen — a file to appear, a partition to be filled — before letting the rest of the graph continue. The TaskFlow API lets you write tasks as ordinary Python functions with decorators, which most people find the gentlest way in.
Read more
How it runs
Airflow is not a single program but a set of cooperating services. A scheduler decides which task instances are ready and queues them; workers carry them out; a metadata database records every run, its state and its logs pointers; and a web interface shows the graph, the history and the failures. A triggerer handles tasks that wait efficiently instead of holding a worker idle. Executors determine where work happens — on the same machine, across a cluster, or on external systems such as Kubernetes.
What beginners should know
Start with one small DAG and get it running end to end before adding anything clever. Model your tasks so that running the same task twice is harmless — this property, idempotency, is what makes retries and backfills safe. Keep tasks granular: a task that does one thing is easier to rerun, monitor and reason about than a task that does ten. Pass small values between tasks through XComs, but move real data through storage rather than through the scheduler. Pin your dependencies per pipeline, because a single shared environment becomes a source of quiet breakage as projects multiply. Finally, treat failures as normal: set retries, alerting and clear task names, so that whoever is on call can tell what broke and where to restart.