DataEng Hub
AirflowintermediateArticle · 2 min read

Orchestrating dependencies in Airflow without sensors

Sensors burn worker slots to poll for things that could simply announce themselves. Datasets, deferrable operators and event-driven triggers do it better.

Balaji S.
Lead Data Engineer

TL;DR

  • A classic sensor occupies a worker slot while doing nothing — at scale, sensors are your capacity problem.
  • Datasets (Airflow 2.4+) let a producer DAG schedule its consumers directly: no polling at all.
  • When you must wait on something external, use deferrable operators/sensors so the wait happens in the triggerer, not a worker.

The problem

A platform team at NorthBridge Retail had 140 DAGs, and 60 of them started with an ExternalTaskSensor or an S3/ADLS key sensor. At 8 a.m., sensors held half the worker slots while actual work queued behind them.

Option 1 — Datasets: let the producer schedule the consumer

# producer DAG
from airflow.datasets import Dataset
 
silver_orders = Dataset("adls://lake/silver/orders")
 
load_orders = PythonOperator(
    task_id="load_orders",
    python_callable=load,
    outlets=[silver_orders],
)
# consumer DAG — no sensor, no schedule guessing
with DAG(
    dag_id="build_gold_sales",
    schedule=[silver_orders],
    ...
):
    ...

The consumer runs when the data is updated — not at a time you hoped the producer would be done.

Option 2 — deferrable operators for external waits

Waiting on something Airflow doesn't produce (a vendor SFTP drop, an ADF pipeline)? Use the deferrable variant so the poll runs in the lightweight triggerer process:

wait_for_file = WasbBlobSensor(
    task_id="wait_vendor_file",
    container_name="inbound",
    blob_name="vendor/{{ ds }}/orders.csv",
    deferrable=True,          # frees the worker slot while waiting
    timeout=60 * 60 * 4,
)

Option 3 — push, don't poll

If the upstream system can call a webhook, skip waiting entirely: an Azure Function or Logic App hits the Airflow REST API to trigger the DAG when the file lands. The DAG then starts with work, not with waiting.

Trade-offs

Approach Latency Infra cost Coupling
Classic sensor poll interval worker slot per wait low
Dataset schedule immediate none producer must be in Airflow
Deferrable sensor poll interval triggerer only low
Event push immediate webhook plumbing upstream must cooperate

When not to use this

Tiny deployments with a handful of DAGs won't feel sensor pain; don't rebuild a working system for purity. Refactor when sensors start competing with real tasks for slots.

Further reading

#sensors#datasets#deferrable#orchestration

Keep going

One practical note a week

Get new articles, problems and guides in your inbox.