可以为每个Airflow DAG设置不同的执行器吗?

Des*_*Cox 6 airflow

我希望将另一个DAG添加到现有的Airflow服务器。服务器当前正在使用LocalExecutor,但我可能希望DAG使用CeleryExecutor。似乎配置文件airflow.cfg只允许一个执行程序:

# The executor class that airflow should use. Choices include
# SequentialExecutor, LocalExecutor, CeleryExecutor
executor = LocalExecutor
Run Code Online (Sandbox Code Playgroud)

是否可以配置Airflow,以使现有DAG可以继续使用LocalExecutor,而我的新DAG可以使用CeleryExecutor或自定义执行程序类?我没有找到任何这样做的人的例子,也没有在Airflow文档中找到任何东西。

小智 5

如果您的 DAG 中有一个 SubDAG,您可以将特定的执行程序传递给该 SubDagOperator。例如,要使用 SequentialExecutor:

bar_subdag = SubDagOperator(
    task_id='bar',
    subdag=my_subdag('foo', 'bar', default_args),
    default_args=default_args,
    dag=foo_dag,
    executor=SequentialExecutor()
)
Run Code Online (Sandbox Code Playgroud)

这是在 1.8 上,不确定 1.9 是否不同。


小智 1

似乎调度程序只会启动执行程序的一个实例。