我有一个数据包,我们将部署到多个不同的气流实例,在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 - {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
{HOST}:{PORT}/admin/rest_api/api?api=pause&dag_id=test_id
请参阅更多详细信息: github/teamclairvoyant/airflow-rest -api-plugin
See for more details: github/teamclairvoyant/airflow-rest-api-plugin
更多推荐
气流会以编程方式使停顿失效吗?
发布评论