已弃用的REST API

警告

该REST API自2.0版本起已弃用。请考虑使用稳定版REST API。 有关迁移的更多信息,请参阅UPDATING.md

警告

请注意,这些API端点没有访问控制。经过身份验证的用户拥有完全访问权限。

在Airflow 2.0之前,这个REST API被称为"实验性"API,但现在稳定版REST API已经可用,它已被重命名。

该API的端点可在/api/experimental/获取。

版本2.0变更:默认情况下此REST API已被禁用。在迁移到稳定版REST API时如需恢复这些API,请将[api]配置节中的enable_experimental_api选项设为True

端点

POST /api/experimental/dags/<DAG_ID>/dag_runs

为给定的DAG ID创建一个dag_run。 注意:如果在请求体中未指定execution_date,Airflow默认对每个DAG_ID每秒只创建一个DAG。 如需在一秒内创建多个DagRun,应将参数"replace_microseconds"设为"false"(字符串形式的布尔值)。

execution_date 必须使用 YYYY-mm-DDTHH:MM:SS.ssssss 格式指定。

使用配置触发DAG的示例:

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

以毫秒级精度触发DAG,示例:

curl -X POST  \
    'http://localhost:8080/api/experimental/dags/<DAG_ID>/dag_runs' \
    --header 'Content-Type: application/json' \
    --header 'Cache-Control: no-cache' \
    --data '{"replace_microseconds":"false"}'
GET /api/experimental/dags/<DAG_ID>/dag_runs

返回指定DAG ID对应的Dag运行列表。

GET /api/experimental/dags/<string:dag_id>/dag_runs/<string:execution_date>

返回一个包含dag_run公共实例变量的JSON。的格式应为YYYY-mm-DDTHH:MM:SS,例如:"2016-11-16T11:34:15"

GET /api/experimental/test

检查REST API服务器是否正常工作。返回状态'OK'。

GET /api/experimental/dags/<DAG_ID>/tasks/<TASK_ID>

返回任务的信息。

GET /api/experimental/dags/<DAG_ID>/dag_runs/<string:execution_date>/tasks/<TASK_ID>

返回一个包含任务实例公共变量的JSON。的格式应为YYYY-mm-DDTHH:MM:SS,例如:"2016-11-16T11:34:15"

GET /api/experimental/dags/<DAG_ID>/paused/<string:paused>

’ 必须设为 'true' 来暂停DAG,设为 'false' 来取消暂停。

GET /api/experimental/dags/<DAG_ID>/paused

返回DAG的暂停状态

GET /api/experimental/latest_runs

返回为UI格式化的每个DAG的最新DagRun。

GET /api/experimental/pools

获取所有池。

GET /api/experimental/pools/<string:name>

通过给定名称获取池。

POST /api/experimental/pools

创建一个池。

DELETE /api/experimental/pools/<string:name>

删除池。

GET /api/experimental/lineage/<DAG_ID>/<string:execution_date>/

返回该DAG的血缘信息。

这篇内容对您有帮助吗?