我试图在气流DAG中编写一个Python操作符,并将某些参数传递给Python可调用函数。在
我的代码如下所示。在
def my_sleeping_function(threshold):
print(threshold)
fmfdependency = PythonOperator(
task_id='poke_check',
python_callable=my_sleeping_function,
provide_context=True,
op_kwargs={'threshold': 100},
dag=dag)
end = BatchEndOperator(
queue=QUEUE,
dag=dag)
start.set_downstream(fmfdependency)
fmfdependency.set_downstream(end)
但我一直得到下面的错误。在
TypeError: my_sleeping_function() got an unexpected keyword argument 'dag_run'
不知道为什么。在
在阈值参数之后,将**kwargs添加到操作员参数列表中
这就是如何在气流中传递Python操作符的参数。在
相关问题 更多 >
编程相关推荐