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 (Optional[Mapping[str, Any]]) – a dictionary of keyword arguments that will get unpacked in your function

  • op_args (Optional[List]) – a list of positional arguments that will get unpacked when calling your callable

  • templates_dict (Optional[Dict]) – 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.

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

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

Was this entry helpful?