如何在本地集群中动态添加工作者

问题描述 投票:1回答:1

我有一个本地集群。如何使用Client对象将更多工作线程添加到此本地群集。

dask dask-distributed
1个回答
1
投票

您将不会使用Client对象,而是使用Cluster。然后使用cluster.scale(...)

In [1]: from dask.distributed import Client, LocalCluster

In [2]: cluster = LocalCluster()

In [3]: client = Client(cluster)

In [4]: client
Out[4]: <Client: 'tcp://127.0.0.1:37971' processes=12 threads=96, memory=1.62 TB>

In [5]: cluster.scale(20)

In [6]: client
Out[6]: <Client: 'tcp://127.0.0.1:37971' processes=20 threads=160, memory=2.70 TB>

您还可以查看自适应缩放:https://docs.dask.org/en/latest/setup/adaptive.html

© www.soinside.com 2019 - 2024. All rights reserved.