Dask:从客户端获取调度程序地址

发布于 2025-01-19 11:11:50 字数 660 浏览 7 评论 0原文

我正在使用Dask-MPI在HPC上部署。我想掌握与另一个库一起使用的调度程序地址。对于LocalCluster(或任何其他明确群集定义),EG:

from dask.distributed import Client, LocalCluster

cluster = LocalCluster()
client = Client(cluster)

address = cluster.scheduler_address

但是dask-mpi是初始化的,而无需群集对象, 这很简单。 :

from dask.distributed import Client
from dask_mpi import initialize

initialize()
client = Client()

尝试访问基础client.cluster无济于事,因为在这种情况下,它将其设置为none

是否有其他方法可以从client或其他地方获取调度程序地址?谢谢!

I'm using dask-mpi to deploy on my HPC. I'd like to get hold of the scheduler address to use with another library. This is simple in the case of a LocalCluster (or any other explicit cluster definition) e.g.:

from dask.distributed import Client, LocalCluster

cluster = LocalCluster()
client = Client(cluster)

address = cluster.scheduler_address

But dask-mpi is initialised without a cluster object:

from dask.distributed import Client
from dask_mpi import initialize

initialize()
client = Client()

Trying to access the underlying client.cluster doesn't help as, in this case, it's set to None.

Is there some other way to get hold of the scheduler address from the client or elsewhere? Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

日记撕了你也走了 2025-01-26 11:11:50

目前尚未记录(至少我在 docs 中找不到它),但我发现 Client 对象具有 scheduler 属性。地址和其他属性可以这样获取:

from dask.distributed import Client
client = Client()
address = client.scheduler.address

我认为 client.scheduler 应该返回 Scheduler 对象,但我还没有做更多的挖掘。

It's not currently documented (at least I couldn't find it in the docs), but I've found out that a Client object has a scheduler property. The address, and other properties, can be obtained like:

from dask.distributed import Client
client = Client()
address = client.scheduler.address

I would suppose client.scheduler should return a Scheduler object, but I haven't done much more digging, yet.

请远离我 2025-01-26 11:11:50

这不是一个直接的解决方案,直接来自 docs,但一种方法是指定在哪里写入调度程序文件:

mpirun -np 4 dask-mpi --scheduler-file ~/dask-scheduler.json

该文件将包含连接信息:

from dask.distributed import Client
client = Client(scheduler_file='~/dask-scheduler.json')

It's not a direct solution and comes straight from docs, but one way is to specify where to write the scheduler file:

mpirun -np 4 dask-mpi --scheduler-file ~/dask-scheduler.json

The file will contain the connection info:

from dask.distributed import Client
client = Client(scheduler_file='~/dask-scheduler.json')
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文