Search code examples
pythondistributeddaskdask-distributed

Can I retrieve a distributed.client instance if I know its id?


With dask there is an id associated with each instance of distributed.client. Calling .id on a client will show its id. Can I retrieve a client instance if I know its id?


Solution

  • This is not generally recommended, using internal implementation.

    For global clients (as opposed to temporary ones), you can look in the variable distributed.client._global_clients. The values of this dictionary-like are the clients, and you can check each one to see if its ID matches the one you are after

    client = [c for c in distributed.client._global_clients.values()
              if c.id == id_i_am_seeking][0]