gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 17:13:09 26 4
gpt4 key购买 nike

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

# The executor class that airflow should use. Choices include
# SequentialExecutor, LocalExecutor, CeleryExecutor
executor = LocalExecutor

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

最佳答案

如果您的 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()
)

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

关于airflow - 可以为每个 Airflow DAG 设置不同的执行器吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38750172/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com