【问题标题】:Running `airflow scheduler` launches 33 scheduler processes运行 `airflow scheduler` 会启动 33 个调度程序进程
【发布时间】:2017-03-10 23:01:41
【问题描述】:

当使用LocalExecutorMySQL 后端时,在我的Centos 6 机器上运行airflow scheduler 会创建33 个调度程序进程,例如 deploy 55362 13.5 1.8 574224 73272 ? Sl 18:59 7:42 /usr/local/bin/python2.7 /usr/local/bin/airflow scheduler deploy 55372 0.0 1.5 567928 60552 ? Sl 18:59 0:00 /usr/local/bin/python2.7 /usr/local/bin/airflow scheduler deploy 55373 0.0 1.5 567928 60540 ? Sl 18:59 0:00 /usr/local/bin/python2.7 /usr/local/bin/airflow scheduler ... 这些不同于 Executor 进程和 gunicorn master 和 worker 进程。 使用SequentialExecutorsqlite 后端)运行它只会启动一个调度程序进程。
Airflow 仍然有效(DAG 正在运行),但这些进程的数量之多让我觉得有问题。
当我在数据库中运行 select * from job where state = 'running'; 时,只返回 5 个 SchedulerJob 行。 这正常吗?

【问题讨论】:

    标签: python airflow


    【解决方案1】:

    是的,这很正常。这些是调度程序进程。您可以使用 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 = 32
    

    这些是从调度程序产生的,其 pid 可以在 airflow-scheduler.pid 文件中找到

    所以你看到的 32+1=33 个进程。

    希望这能消除您的疑虑。

    干杯!

    【讨论】:

    • 感谢普里扬克!你是绝对正确的,改变并行参数会改变这些scheduler 进程的数量。我想我很困惑,我认为并行性是指实际运行任务的执行程序进程。
    • @CollinMeyers 他们是“执行者”进程。它们只是在您的 PID 列表中命名为“调度程序”。如果您为 LocalExecutor 启动调度程序,则只会运行 1 个调度程序。
    【解决方案2】:

    从 v1.10.3 开始,这是我发现的。我的设置是:

    parallelism = 32
    max_threads = 4
    

    共有

    • 1(主)+
    • 32(执行者)+
    • 1 (dag_processor_manager) +
    • 4(dag 处理器)

    = 38 个进程!

    【讨论】:

    • 嘿,我讨厌那些 dag 处理器,他们不服从 sql_alchemy_pool_size 。你能告诉我如何限制 dag_processors 的数量吗?
    • 是的,现在我将其限制为 max_threads = 1 。我仍然不清楚为什么以线程的名义创建进程,如果创建了所有进程,那么为什么不在所有进程之间共享同一个数据库连接池?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-08-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多