Reputation: 81
I am trying to send parameter to an airflow task in order to identify the last execution.
The following code always send {"try_number": "1"} as POST data.
Airflow version: 1.10.2
Thanks
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,
)
Upvotes: 0
Views: 961
Reputation: 81
The problem is with the rendered view, I looked at the rendered result's instead of viewing the actual value of the operator.
I pushed the output to new XCOM (xcom_push=True) and now I can see the right value:
{ "status": "ok", "try_number": "15" }
Upvotes: 1