pythonmpidaskdask-distributedmpi4py

Dask: Get scheduler address from 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!


Solution

  • 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.