AIrflow-task_instance.try_number不起作用 [英] AIrflow - task_instance.try_number is not working
本文介绍了AIrflow-task_instance.try_number不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试向气流任务发送参数,以识别最后一次执行。
I am trying to send parameter to an airflow task in order to identify the last execution.
以下代码总是发送{ try_number: 1}作为POST数据。
The following code always send {"try_number": "1"} as POST data.
气流版本:1.10.2
Airflow version: 1.10.2
感谢
xxx = SimpleHttpOperator(
task_id='XXX',
endpoint='/backend/XXX',
http_conn_id='backend_url',
data=json.dumps({"try_number": "{{ti.try_number}}"}),
headers={"Content-Type": "application/json"},
response_check=lambda response: response.json().get('status') == 'ok',
dag=dag,
)
推荐答案
问题在于渲染视图
我查看的是渲染结果,而不是查看运算符的实际值。
The problem is with the rendered view, I looked at the rendered result's instead of viewing the actual value of the operator.
我将输出推送到新的XCOM(xcom_push = True),现在我可以看到正确的值:
I pushed the output to new XCOM (xcom_push=True) and now I can see the right value:
{状态 : ok, try_number: 15}
这篇关于AIrflow-task_instance.try_number不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文