airflow.sensors.python

Module Contents

Classes

PythonSensor

Waits for a Python callable to return True.

class airflow.sensors.python.PythonSensor(*, python_callable, op_args=None, op_kwargs=None, templates_dict=None, **kwargs)[source]

Bases: airflow.sensors.base.BaseSensorOperator

Waits for a Python callable to return True.

User could put input argument in templates_dict e.g templates_dict = {'start_ds': 1970} and access the argument by calling kwargs['templates_dict']['start_ds'] in the callable

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

  • op_kwargs (Mapping[str, Any] | None) – a dictionary of keyword arguments that will get unpacked in your function

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

  • templates_dict (dict | None) – a dictionary where the values are templates that will get templated by the Airflow engine sometime between __init__ and execute takes place and are made available in your callable’s context after the template has been applied.

See also

For more information on how to use this sensor, take a look at the guide: PythonSensor

template_fields: Sequence[str] = ('templates_dict', 'op_args', 'op_kwargs')[source]
poke(context)[source]

Function defined by the sensors while deriving this class should override.

Was this entry helpful?