Pass parameters to Airflow Experimental REST api when creating dag run

北城以北 提交于 2019-12-07 04:39:25

问题


Looks like Airflow has an experimental REST api that allow users to create dag runs with https POST request. This is awesome.

Is there a way to pass parameters via HTTP to the create dag run? Judging from the official docs, found here, it would seem the answer is "no" but I'm hoping I'm wrong.


回答1:


I had the same issue. "conf" value must be in string

curl -X POST \
    http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs \
    -H 'Cache-Control: no-cache' \
    -H 'Content-Type: application/json' \
    -d '{"conf":"{\"key\":\"value\"}"}'



回答2:


Judging from the source code, it would appear as though parameters can be passed into the dag run.

If the body of the http request contains json, and that json contains a top level key conf the value of the conf key will be passed to as configuration trigger_dag. More on how this works can be found here.



来源:https://stackoverflow.com/questions/50121593/pass-parameters-to-airflow-experimental-rest-api-when-creating-dag-run

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!