【问题标题】:Running more than 32 concurrent tasks in Apache Airflow在 Apache Airflow 中运行超过 32 个并发任务
【发布时间】:2018-12-05 20:29:17
【问题描述】:

我正在运行 Apache Airflow 1.8.1。我想在我的实例上运行超过 32 个并发任务,但无法让任何配置工作。

我正在使用 CeleryExecutor,UI 中的 Airflow 配置显示 parallelismdag_concurrency 为 64,并且我已经多次重新启动 Airflow 调度程序、Web 服务器和工作程序(我实际上是在本地测试这个Vagrant 机器,但也在 EC2 实例上进行了测试)。

气流.cfg

# The amount of parallelism as a setting to the executor. This defines
# the max number of task instances that should run simultaneously
# on this airflow installation
parallelism = 64

# The number of task instances allowed to run concurrently by the scheduler
dag_concurrency = 64

示例 DAG。我已经直接在 DAG 中尝试了不使用和使用 concurrency 参数。

from datetime import datetime

from airflow import DAG
from airflow.operators.bash_operator import BashOperator

dag = DAG(
    'concurrency_dev',
    default_args={
        'owner': 'airflow',
        'depends_on_past': False,
        'start_date': datetime(2018, 1, 1),
    },
    schedule_interval=None,
    catchup=False
)

for i in range(0, 40):
    BashOperator(
        task_id='concurrency_dev_{i}'.format(i=i),
        bash_command='sleep 60',
        dag=dag
    )

无论如何,只有 32 个任务同时执行。

【问题讨论】:

  • 你用的是什么执行器?您设置的配置是否反映在 Airflow Admin -> 配置面板中?还要确保重新启动网络服务器和调度程序以获取新配置。
  • 感谢您的回复@andscoop。我进行了编辑以回答您的问题。

标签: python airflow


【解决方案1】:

如果您有 2 名工作人员和 celeryd_concurrency = 16,那么您只能执行 32 个任务。如果non_pooled_task_slot_count = 32 你也会受到限制。 当然 parallelismdag_concurrency 不仅需要在 webservers 和 scheduler 上设置在 32 以上,而且在 worker 上也是如此。

【讨论】:

  • celeryd_concurrency 配置就是这样,谢谢。
猜你喜欢
  • 1970-01-01
  • 2019-08-12
  • 1970-01-01
  • 2020-06-21
  • 1970-01-01
  • 2017-06-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多