Deferrable Operator and Sensor
A deferrable Airflow operator suspends its work while a trigger waits for a condition. A triggerer runs the asynchronous trigger; when it fires, the scheduler arranges for the task to resume on a worker. This frees a worker during the deferred phase.
A sensor in poke mode keeps a worker while polling. Reschedule mode releases it between timed checks. Deferral uses a trigger to signal resumption and requires a running triggerer and an operator with the appropriate implementation. Adding async to a TaskFlow function does not provide this mechanism.
Local variables do not automatically survive deferral; supported state must be serialized for resumption. Pool settings decide whether deferred tasks consume slots. Waiting still consumes triggerer and external-service resources, so measure those limits too.
A successful wait proves only the chosen condition. A file marker must identify the intended interval and version, and its meaning must justify readiness. Configure missing-condition timeouts and verify the data before publication. A trigger is not a substitute for source completeness checks.
For a file expected in an hour, poke mode can hold a worker for that wait. Reschedule mode checks periodically, so the next check adds detection delay. A supported deferrable sensor moves the wait to a triggerer and later resumes; it can still poll the external service. Choose from acceptable detection delay, available triggerer capacity, and the provider operatorโs behavior, rather than assuming deferral eliminates all polling.
See Production Airflow: Idempotency, Retries, and Backfills for worked examples.
Further reading
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
