气流会以编程方式使停顿失效吗? [英] Airflow unpause dag programmatically?

查看:82
本文介绍了气流会以编程方式使停顿失效吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个数据包,我们将部署到多个不同的气流实例,在airflow.cfg中,我们有 dags_are_paused_at_creation = True ,但是对于这个特定的数据包,我们希望它无需手动单击即可将其打开。有没有办法以编程方式完成它?

I have a dag that we'll deploy to multiple different airflow instances and in our airflow.cfg we have dags_are_paused_at_creation = True but for this specific dag we want it to be turned on without having to do so manually by clicking on the UI. Is there a way to do it programmatically?

推荐答案

airflow-rest-api-plugin插件也可以用于以编程方式暂停任务。

airflow-rest-api-plugin plugin can also be used to programmatically pause tasks.


暂停DAG

Pauses a DAG

气流版本:1.7.0或更大

Available in Airflow Version: 1.7.0 or greater

获取-http:// {HOST}:{PORT} / admin / rest_api / api?api = pause

GET - http://{HOST}:{PORT}/admin/rest_api/api?api=pause

查询参数:

dag_id-字符串-dag的ID

dag_id - string - The id of the dag

subdir(可选) -字符串-
从中查找dag的文件位置或目录

subdir (optional) - string - File location or directory from which to look for the dag

示例:

http:// {HOST}:{PORT} / admin / rest_api / api?api = pause& dag_id = test_id

http://{HOST}:{PORT}/admin/rest_api/api?api=pause&dag_id=test_id

请参阅更多详细信息:
https://github.com/teamclairvoyant/airflow-rest -api-plugin

See for more details: https://github.com/teamclairvoyant/airflow-rest-api-plugin

这篇关于气流会以编程方式使停顿失效吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆