Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions airflow-core/docs/core-concepts/sensors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,67 @@ The ``poke`` and ``reschedule`` modes can be configured directly when you instan
Much like Operators, Airflow has a large set of pre-built Sensors you can use, both in core Airflow as well as via our *providers* system.

.. seealso:: :doc:`../authoring-and-scheduling/deferring`

BaseSensorOperator parameters
-----------------------------

All sensors in Airflow ultimately inherit from ``BaseSensorOperator`` (directly or indirectly).
This base class defines the common behavior and parameters that control
how a sensor waits, retries, and manages worker resources.

As of the Task SDK refactor, ``BaseSensorOperator`` is implemented in the
Task SDK. Because provider documentation is generated separately, these
parameters may not always be directly visible on individual provider
sensor API pages. However, they apply to *all* sensors.

Common parameters
^^^^^^^^^^^^^^^^^

The following parameters are provided by ``BaseSensorOperator`` and are
available on all sensors:

``poke_interval``
Time in seconds between successive checks. In ``poke`` mode, the sensor
sleeps between checks while occupying a worker slot. In ``reschedule``
mode, the task is deferred and rescheduled after this interval.

``timeout``
Maximum time in seconds the sensor is allowed to run before failing.
This timeout is measured from the first execution attempt, not per poke.

``mode``
Determines how the sensor occupies worker resources.

* ``poke`` (default): occupies a worker slot for the entire duration
* ``reschedule``: releases the worker slot between checks

``soft_fail``
If set to ``True``, the sensor will be marked as ``SKIPPED`` instead of
``FAILED`` when the timeout is reached.

``exponential_backoff``
If enabled, the time between checks increases exponentially up to
``max_wait``. This is useful when polling external systems with
unpredictable availability.

``max_wait``
Upper bound (in seconds) for the delay between checks when
``exponential_backoff`` is enabled.

For the authoritative API reference, see the Task SDK documentation for
``BaseSensorOperator``:

https://airflow.apache.org/docs/task-sdk/stable/api.html#airflow.sdk.BaseSensorOperator

Example
^^^^^^^

.. code-block:: python

BashSensor(
task_id="wait_for_file",
bash_command="test -f /data/input.csv",
poke_interval=60,
timeout=60 * 60,
mode="reschedule",
)