airflow.decorators.sensor

Module Contents

Classes

DecoratedSensorOperator

Wraps a Python callable and captures args/kwargs when called for execution.

Functions

sensor_task([python_callable])

Wrap a function into an Airflow operator.

class airflow.decorators.sensor.DecoratedSensorOperator(*, task_id, **kwargs)[source]

Bases: airflow.providers.standard.sensors.python.PythonSensor

Wraps a Python callable and captures args/kwargs when called for execution.

Parameters
  • python_callable – A reference to an object that is callable

  • task_id (str) – task Id

  • op_args – a list of positional arguments that will get unpacked when calling your callable (templated)

  • op_kwargs – a dictionary of keyword arguments that will get unpacked in your function (templated)

  • kwargs_to_upstream – For certain operators, we might need to upstream certain arguments that would otherwise be absorbed by the DecoratedOperator (for example python_callable for the PythonOperator). This gives a user the option to upstream kwargs as needed.

template_fields: collections.abc.Sequence[str] = ('op_args', 'op_kwargs')[source]
template_fields_renderers: ClassVar[dict[str, str]][source]
custom_operator_name = '@task.sensor'[source]
shallow_copy_attrs: collections.abc.Sequence[str] = ('python_callable',)[source]
airflow.decorators.sensor.sensor_task(python_callable=None, **kwargs)[source]

Wrap a function into an Airflow operator.

Accepts kwargs for operator kwarg. Can be reused in a single DAG. :param python_callable: Function to decorate

Was this entry helpful?