distributed 2021.10.0

ParametersBackRef

The Client connects users to a Dask cluster. It provides an asynchronous user interface around functions and futures. This class resembles executors in concurrent.futures but also allows Future objects within submit/map calls. When a Client is instantiated it takes over all dask.compute and dask.persist calls by default.

It is also common to create a Client without specifying the scheduler address , like Client() . In this case the Client creates a LocalCluster in the background and connects to that. Any extra keywords are passed from Client to LocalCluster in this case. See the LocalCluster documentation for more information.

Parameters

address: string, or Cluster :

This can be the address of a Scheduler server like a string '127.0.0.1:8786' or a cluster object like LocalCluster()

timeout: int :

Timeout duration for initial connection to the scheduler

set_as_default: bool (True) :

Use this Client as the global dask scheduler

scheduler_file: string (optional) :

Path to a file with scheduler information if available

security: Security or bool, optional :

Optional security information. If creating a local cluster can also pass in True , in which case temporary self-signed credentials will be created automatically.

asynchronous: bool (False by default) :

Set to True if using this client within async/await functions or within Tornado gen.coroutines. Otherwise this should remain False for normal use.

name: string (optional) :

Gives the client a name that will be included in logs generated on the scheduler for matters relating to this client

direct_to_workers: bool (optional) :

Whether or not to connect directly to the workers, or to ask the scheduler to serve as intermediary.

heartbeat_interval: int :

Time in milliseconds between heartbeats to scheduler

**kwargs: :

If you do not pass a scheduler address, Client will create a LocalCluster object, passing any extra keyword arguments.

Connect to and submit computation to a Dask cluster

See Also

distributed.LocalCluster
distributed.scheduler.Scheduler

Internal scheduler

Examples

Provide cluster's scheduler node address on initialization:

This example is valid syntax, but we were not able to check execution
>>> client = Client('127.0.0.1:8786')  # doctest: +SKIP

Use submit method to send individual computations to the cluster

This example is valid syntax, but we were not able to check execution
>>> a = client.submit(add, 1, 2)  # doctest: +SKIP
... b = client.submit(add, 10, 20) # doctest: +SKIP

Continue using submit or map on results to build up larger computations

This example is valid syntax, but we were not able to check execution
>>> c = client.submit(add, a, b)  # doctest: +SKIP

Gather results with the gather method.

This example is valid syntax, but we were not able to check execution
>>> client.gather(c)  # doctest: +SKIP
33

You can also call Client with no arguments in order to create your own local cluster.

This example is valid syntax, but we were not able to check execution
>>> client = Client()  # makes your own local "cluster" # doctest: +SKIP

Extra keywords will be passed directly to LocalCluster

This example is valid syntax, but we were not able to check execution
>>> client = Client(n_workers=2, threads_per_worker=4)  # doctest: +SKIP
See :

Back References

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

distributed.client.Client.scatter distributed.client.Client.write_scheduler_file distributed.variable.Variable distributed.actor.Actor distributed.client.Future distributed.worker.get_client distributed.client.Client distributed.queues.Queue distributed.client.Client.gather distributed.deploy.ssh.SSHCluster distributed.client.Client.get

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/client.py#517
type: <class 'type'>
Commit: