AWS Lambda and Apache Airflow integration

2019-04-07 00:37发布

问题:

wondered if anyone could shed some light on this issue:

I'm trying to locate the Airflow REST API URL to initiate a DAG to Run from AWS Lambda Function.

So far from looking at all the relevant documentation provided from the Apache Incubator Site, the only guidance to solved the problem is by using this URL structure in the Lambda (python 3.6) Code:

Apache Experimental API: https://airflow.apache.org/api.html#endpoints

based on that link the syntax should read:

http://airflow_hostname/api/experimental/dags/<DAG_ID>/

However this fails to initiate the Specific DAG in from my AWS Lambda Function, any help/guidance or pointers would be great.

回答1:

In the Airflow 1.10 the following post request will work:

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\"}"}'

You need to pass an empty JSON string otherwise the post request will fail.