gpt4 book ai didi

python - 在 Apache Airflow 中运行超过 32 个并发任务

转载 作者:太空宇宙 更新时间:2023-11-04 00:07:23 30 4
gpt4 key购买 nike

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

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

Airflow .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 个。

enter image description here

最佳答案

如果您有 2 个工作人员和 celeryd_concurrency = 16,那么您将被限制为 32 个任务。如果 non_pooled_task_slot_count = 32 你也会受到限制。当然,parallelismdag_concurrency 不仅需要在网络服务器和调度程序上设置为 32 以上,还需要在 worker 上设置。

关于python - 在 Apache Airflow 中运行超过 32 个并发任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53640246/

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