如何限制“气流”一次只运行一个DAG实例? [英] How to limit Airflow to run only one instance of a DAG run at a time?

查看:103
本文介绍了如何限制“气流”一次只运行一个DAG实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望DAG中的所有任务在下一次运行的第一个任务执行之前全部完成。

I want the all the tasks in the DAG to all finish before the 1st task of the next run gets executed.

我的max_active_runs = 1,但是仍然会发生。

I have max_active_runs = 1, but this still happens.

default_args = {
'depends_on_past': True,
'wait_for_downstream': True,
'max_active_runs': 1,
'start_date': datetime(2018, 03, 04),
'owner': 'tin.nguyen',
'email': ['tin.nguyen@example.com'],
'email_on_failure': True,
'email_on_retry': False,
'retries': 3,
'retry_delay': timedelta(minutes=4)
}

dag = DAG('example', default_args=default_args, schedule_interval = schedule_interval)

(我所有的任务都取决于Airflow版本是1.8.0)

(All of my tasks are dependent on the previous task. Airflow version is 1.8.0)

谢谢

推荐答案

我更改为将 max_active_runs 用作 DAG()的参数,而不是放在 default_arguments ,并且有效。

I changed to put max_active_runs as an argument of DAG() instead of in default_arguments, and it worked.

感谢SimonD给我这个主意,尽管并未在您的答案中直接指出。

Thanks SimonD for giving me the idea, though not directly pointing to it in your answer.

这篇关于如何限制“气流”一次只运行一个DAG实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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