blob: fb0ae614f2430c540fad5b471b184244e69f40f0 [file] [log] [blame]
:mod:`airflow.contrib.sensors.python_sensor`
============================================
.. py:module:: airflow.contrib.sensors.python_sensor
Module Contents
---------------
.. py:class:: PythonSensor(python_callable, op_args=None, op_kwargs=None, provide_context=False, templates_dict=None, *args, **kwargs)
Bases: :class:`airflow.sensors.base_sensor_operator.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 the callable
:param python_callable: A reference to an object that is callable
:type python_callable: python callable
:param op_kwargs: a dictionary of keyword arguments that will get unpacked
in your function
:type op_kwargs: dict
:param op_args: a list of positional arguments that will get unpacked when
calling your callable
:type op_args: list
:param provide_context: if set to true, Airflow will pass a set of
keyword arguments that can be used in your function. This set of
kwargs correspond exactly to what you can use in your jinja
templates. For this to work, you need to define `**kwargs` in your
function header.
:type provide_context: bool
:param templates_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.
:type templates_dict: dict of str
.. attribute:: template_fields
:annotation: = ['templates_dict', 'op_args', 'op_kwargs']
.. method:: poke(self, context)