distributed 2021.10.0

ParametersReturnsBackRef
get_client(address=None, timeout=None, resolve_address=True) -> 'Client'

This client connects to the same scheduler to which the worker is connected

Parameters

address : str, optional

The address of the scheduler to connect to. Defaults to the scheduler the worker is connected to.

timeout : int or str

Timeout (in seconds) for getting the Client. Defaults to the distributed.comm.timeouts.connect configuration value.

resolve_address : bool, default True

Whether to resolve :None:None:`address` to its canonical form.

Returns

Client

Get a client while within a task.

See Also

get_worker
secede
worker_client

Examples

This example is valid syntax, but we were not able to check execution
>>> def f():
...  client = get_client(timeout="10s")
...  futures = client.map(lambda x: x + 1, range(10)) # spawn many tasks
...  results = client.gather(futures)
...  return sum(results)
This example is valid syntax, but we were not able to check execution
>>> future = client.submit(f)  # doctest: +SKIP
... future.result() # doctest: +SKIP 55
See :

Back References

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

distributed.worker.Worker._get_client distributed.worker.secede distributed.worker.get_worker distributed.worker_client.worker_client distributed.worker.get_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.py#3847
type: <class 'function'>
Commit: