distributed 2021.10.0

ParametersBackRef
worker_client(timeout=None, separate_thread=True)

This context manager is intended to be called within functions that we run on workers. When run as a context manager it delivers a client Client object that can submit other tasks directly from that worker.

Parameters

timeout : Number or String

Timeout after which to error out. Defaults to the distributed.comm.timeouts.connect configuration value.

separate_thread : bool, optional

Whether to run this function outside of the normal thread pool defaults to True

Get client for this thread

See Also

get_client
get_worker
secede

Examples

This example is valid syntax, but we were not able to check execution
>>> def func(x):
...  with worker_client(timeout="10s") as c: # connect from worker back to scheduler
...  a = c.submit(inc, x) # this task can submit more tasks
...  b = c.submit(dec, x)
...  result = c.gather([a, b]) # and gather results
...  return result
This example is valid syntax, but we were not able to check execution
>>> future = client.submit(func, 1)  # submit func(1) on cluster
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

distributed.worker.get_client distributed.worker.get_worker distributed.worker_client.worker_client

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /distributed/worker_client.py#12
type: <class 'function'>
Commit: