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.
This can be the address of a Scheduler
server like a string '127.0.0.1:8786'
or a cluster object like LocalCluster()
Timeout duration for initial connection to the scheduler
Use this Client as the global dask scheduler
Path to a file with scheduler information if available
Optional security information. If creating a local cluster can also pass in True
, in which case temporary self-signed credentials will be created automatically.
Set to True if using this client within async/await functions or within Tornado gen.coroutines. Otherwise this should remain False for normal use.
Gives the client a name that will be included in logs generated on the scheduler for matters relating to this client
Whether or not to connect directly to the workers, or to ask the scheduler to serve as intermediary.
Time in milliseconds between heartbeats to scheduler
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
distributed.scheduler.Scheduler
Internal scheduler
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
>>> 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.
>>> 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: +SKIPSee :
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
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