Data Engineering Reference/Workflow Orchestration

Airflow: DAG Design & Operations

DAGs, operators, sensors, XComs, pools, and executor models — plus why Airflow orchestrates but doesn't process data.

3/5Overview: 30m

Airflow's job

Airflow orchestrates — it decides when and in what order tasks run. It does not process petabytes itself. Heavy lifting stays in Spark, Flink, dbt, or warehouse SQL.

Airflow DAG ├── Sensor: wait for S3 partition dt={{ ds }} ├── Operator: trigger EMR/Databricks job ├── Operator: run dbt test └── Operator: publish freshness metric

Core concepts

ConceptMeaning
DAGDirected acyclic graph of tasks
OperatorTemplate for work (Bash, Python, SparkSubmit)
SensorWaits for external condition (file lands, partition exists)
Task instanceOne run of one task for one execution_date
ExecutorWhere tasks run (Celery, K8s, local)

DAG design principles

  1. Idempotent tasks — retry-safe (see subtopic 2)
  2. Atomic partitions — one task writes one dt partition
  3. Avoid heavy work in PythonOperator — trigger remote jobs
  4. Explicit dependencies — no hidden ordering
  5. catchup=False for new DAGs unless you mean backfill
  6. Pools/queues — limit concurrent Spark submits

XCom: use sparingly

XCom passes small metadata between tasks. Never pass large DataFrames — use storage paths as handoff.

Alternatives (names to know)

ToolAngle
DagsterSoftware-defined assets, type-safe
PrefectDynamic flows, modern API
LuigiLegacy Spotify batch
Step FunctionsAWS-native orchestration

Airflow remains the FAANG interview default — know Dagster's asset graph as the modern contrast.

Link to Observability

Pipeline alerts: task duration anomaly, SLA miss on execution_date, data freshness metric — not just "task failed."

Interview answer template

"Airflow triggers a Databricks job for silver, then dbt Cloud for gold. Sensors gate on upstream landing. PythonOperator only passes the partition path via XCom — all compute is remote."

Further Reading

Hands-On Tasks (Optional)

Pipeline design drills and whiteboard exercises — DAG sketches, partition plans, backfill strategies. Assumes Databases and SQL fundamentals are in place.

  • Sketch a daily ETL DAG

    Draw tasks: wait for source partition → Spark bronze→silver → dbt gold → data quality check → notify on failure. Mark which are sensors vs operators and external dependencies.

    15m