Middle
What is the difference between a sensor and a trigger in Airflow?
sobes.tech AI
Answer from AI
In Apache Airflow, a Sensor is a special type of operator that waits for a specific event or condition, such as the appearance of a file or the completion of a task. Sensors operate in a waiting mode and block the execution of the DAG until the condition is met.
A Trigger in Airflow is a mechanism that allows tasks to be launched asynchronously without blocking the worker, thereby freeing up resources. Triggers are used in conjunction with Deferrable Operators, which can suspend task execution and resume it when an event occurs.
Thus, a Sensor is a synchronous wait for an event that blocks the worker, while a Trigger is an asynchronous mechanism that allows more efficient resource utilization while waiting.