

This is particularly useful when you have conflicting dependencies between Airflow itself and tasks you need to run.
#Airflow 2 code#
Airflow handles getting the code into the container and returning xcom - you just worry about your function. The decorator is one such decorator that allows you to run a function in a docker container. To support this feature, a new component has been added to Airflow, the triggerer, which is the daemon process that runs the asyncio event loop.Īirflow 2.2.0 ships with 2 deferrable sensors, DateTimeSensorAsync and TimeDeltaSensorAsync, both of which are drop-in replacements for the existing corresponding sensor.ĭeferrable Operators & Triggers Custom decorators and 2.2.0 allows providers to create custom decorators in the TaskFlow interface. This allows simple things like monitoring a job in an external system or watching for an event to be much cheaper. Most importantly, this results in the worker slot, and most notably any resources used by it, to be returned to Airflow.

More information can be found at: Customizing DAG Scheduling with Timetables Deferrable Tasks (AIP-40)ĭeferrable tasks allows operators or sensors to defer themselves until a light-weight async check passes, at which point they can resume executing. If you write your own timetables, keep in mind they should be idempotent and fast as they are used in the scheduler to create DagRuns.
