I am able to find out the worker address. But I want to know the name. Is there any method to find out?
from dask.distributed import Client, LocalCluster
cluster = LocalCluster(name='AAA',n_workers=1,threads_per_worker=2)
client = Client(cluster)
client
To get the name, you can do
from distributed import get_worker
client.run(lambda: get_worker().name)
However, this will not be the name you gave, but a numerical index 0, 1.... ; you seem to be trying to give the same name across a whole cluster (even with just one worker), so that doesn't work. You could do it if you were starting the worker process yourself on the command line or programatically.
There is also an alternative .id
attribute, which is a unique UUID-based string for each worker.