【问题标题】:Possible to set different executor for each Airflow DAG?可以为每个 Airflow DAG 设置不同的执行者吗?
【发布时间】:2016-08-03 17:29:33
【问题描述】:

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

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

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

【问题讨论】:

标签: airflow


【解决方案1】:

如果您的 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有什么不同。

【讨论】:

    【解决方案2】:

    似乎调度器只会启动一个执行器实例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-13
      • 1970-01-01
      • 1970-01-01
      • 2021-07-14
      • 1970-01-01
      • 1970-01-01
      • 2021-08-07
      相关资源
      最近更新 更多