0

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?

billiam
  • 132
  • 1
  • 15

1 Answers1

1

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]
mdurant
  • 27,272
  • 5
  • 45
  • 74
  • Thanks! The reason I asked is because I assumed that creating too many client instances may become problematic. Is this true? – billiam Mar 28 '19 at 20:08
  • 1
    Presumably there is a limit, but I haven't heard of it being an issue. – mdurant Mar 28 '19 at 20:51