Pass parameters to Airflow Experimental REST api when creating dag run

后端 未结 2 808
不思量自难忘°
不思量自难忘° 2020-12-31 10:02

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

2条回答
  •  南方客
    南方客 (楼主)
    2020-12-31 10:04

    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 as configuration to trigger_dag. More on how this works can be found here.

    Note the value of the conf key must be a string, e.g.

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

提交回复
热议问题