Airflow中的CeleryExecutor并未在subdag中并行化任务

Fla*_*vio 4 airflow airflow-scheduler

我们使用的是Airflow:1.10.0,经过一些分析,为什么我们的一些ETL流程花了这么长时间,我们看到子域使用a SequentialExecutor代替使用,BaseExecutor或者在配置时CeleryExecutor

我想知道这是Bug还是Airflow的预期行为。具有并行执行任务的功能没有任何意义,但是在某些特定类型的任务中,此功能会丢失。

执行SugDag(在Subdag中缩放)

Cha*_*man 7

在子目录中使用SequentialExecutor是一种典型的模式,其思想是您经常执行许多类似的相关任务,而不必一定要增加添加到celery队列中的开销,等等。请参见“其他技巧子文档的Airflow文档中的“”部分:https ://airflow.apache.org/concepts.html#subdags

默认情况下,subdags设置为使用顺序执行器(请参阅:https : //github.com/apache/incubator-airflow/blob/v1-10-stable/airflow/operators/subdag_operator.py#L38),但是您可以更改它。

要使用celery执行器,请在subdag创建中添加以下内容:

from airflow.executors.celery_executor import CeleryExecutor
mysubdag = SubDagOperator(
    executor=CeleryExecutor()
    ...
)
Run Code Online (Sandbox Code Playgroud)