airflow.providers.standard.sensors.python

PythonSensor

等待一个 Python 可调用对象返回 True。

模块内容

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

基类: airflow.sensors.base.BaseSensorOperator

等待一个 Python 可调用对象返回 True。

用户可以将输入参数放入 templates_dict,例如 templates_dict = {'start_ds': 1970},然后在可调用对象中通过调用 kwargs['templates_dict']['start_ds'] 来访问该参数。

参数:
  • python_callable (Callable) – 对一个可调用对象的引用

  • op_kwargs (collections.abc.Mapping[str, Any] | None) – 一个关键字参数字典,将在您的函数中展开

  • op_args (list | None) – 一个位置参数列表,将在调用您的可调用对象时展开

  • templates_dict (dict | None) – 一个字典,其值是模板,将在 __init__execute 之间由 Airflow 引擎进行模板化,并在模板应用后在您的可调用对象的上下文中可用。

另请参阅

有关如何使用此 Sensor 的更多信息,请参阅指南:PythonSensor

template_fields: collections.abc.Sequence[str] = ('templates_dict', 'op_args', 'op_kwargs')[source]
python_callable[source]
op_args = [][source]
op_kwargs[source]
templates_dict = None[source]
poke(context)[source]

派生此类时重写此方法。

此条目有帮助吗?