Module Contents

class airflow.sensors.python.PythonSensor(*, python_callable: Callable, op_args: Optional[List] = None, op_kwargs: Optional[Dict] = None, templates_dict: Optional[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

  • python_callable (python callable) -- A reference to an object that is callable

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

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

  • templates_dict (dict of str) -- 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 = ['templates_dict', 'op_args', 'op_kwargs'][source]
poke(self, context: Dict)[source]

Was this entry helpful?