气流任务重叠

时间:2017-07-06 14:43:43

标签: python python-3.x airflow

我只希望一个DAG能够在下一个DAG触发之前运行。

我经常有多个重叠的dag运行。

我怎样才能做到这一点?

2 个答案:

答案 0 :(得分:0)

对于Dag X一次只能运行1个dag,请在DAG上设置concurrency

这样的东西会保持在1:

dag = DAG(
    dag_id='my_dag',
    schedule_interval=None,
    start_date=datetime(2017,1,1),
    concurrency=1
)

答案 1 :(得分:0)

阅读完文档后,max_active_runs似乎正是我所寻找的:

// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

因此,

class DAG(BaseDag, LoggingMixin):
    ...
    param concurrency: the number of task instances allowed to run
    concurrently
    :type concurrency: int
    :param max_active_runs: maximum number of active DAG runs, beyond this
    number of DAG runs in a running state, the scheduler won't create
    new active DAG runs

dag = DAG(
    dag_id='my_dag',
    schedule_interval=None,
    start_date=datetime(2017,1,1),
    max_active_runs=1,
    )