【发布时间】:2019-07-09 03:26:07
【问题描述】:
我的 DAG 中有一个 python 运算符。 python 可调用函数返回一个布尔值。但是,当我运行 DAG 时,出现以下错误。
TypeError: 'bool' 对象不可调用
我修改了函数以不返回任何内容,但我再次收到以下错误
错误 - 'NoneType' 对象不可调用
下面是我的日记
def check_poke(threshold,sleep_interval):
flag=snowflake_poke(1000,10).poke()
#print(flag)
return flag
dependency = PythonOperator(
task_id='poke_check',
#python_callable=check_poke(129600,600),
provide_context=True,
python_callable=check_poke(129600,600),
dag=dag)
end = BatchEndOperator(
queue=QUEUE,
dag=dag)
start.set_downstream(dependency)
dependency.set_downstream(end)
无法弄清楚我错过了什么。有人可以帮我解决这个问题...对气流来说还很陌生。
我在 dag 中编辑了 python 运算符,如下所示
dependency = PythonOperator(
task_id='poke_check',
provide_context=True,
python_callable=check_poke(129600,600),
dag=dag)
但是现在,我得到了一个不同的错误。
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/airflow/models.py", line 1245, in run
result = task_copy.execute(context=context)
File "/usr/local/lib/python2.7/dist-packages/airflow/operators/python_operator.py", line 66, in execute
return_value = self.python_callable(*self.op_args, **self.op_kwargs)
TypeError: () takes no arguments (25 given)
[2019-02-15 05:30:25,375] {models.py:1298} INFO - Marking task as UP_FOR_RETRY
[2019-02-15 05:30:25,393] {models.py:1327} ERROR - () takes no arguments (25 given)
【问题讨论】:
-
显然这个问题演变成this