distributed 2021.10.0

ParametersBackRef

This creates a "cluster" of a scheduler and workers running on the local machine.

Parameters

n_workers: int :

Number of workers to start

processes: bool :

Whether to use processes (True) or threads (False). Defaults to True, unless worker_class=Worker, in which case it defaults to False.

threads_per_worker: int :

Number of threads per each worker

scheduler_port: int :

Port of the scheduler. 8786 by default, use 0 to choose a random port

silence_logs: logging level :

Level of logs to print out to stdout. logging.WARN by default. Use a falsey value like False or None for no change.

host: string :

Host address on which the scheduler will listen, defaults to only localhost

ip: string :

Deprecated. See host above.

dashboard_address: str :

Address on which to listen for the Bokeh diagnostics server like 'localhost:8787' or '0.0.0.0:8787'. Defaults to ':8787'. Set to None to disable the dashboard. Use ':0' for a random port.

worker_dashboard_address: str :

Address on which to listen for the Bokeh worker diagnostics server like 'localhost:8787' or '0.0.0.0:8787'. Defaults to None which disables the dashboard. Use ':0' for a random port.

diagnostics_port: int :

Deprecated. See dashboard_address.

asynchronous: bool (False by default) :

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

blocked_handlers: List[str] :

A list of strings specifying a blacklist of handlers to disallow on the Scheduler, like ['feed', 'run_function']

service_kwargs: Dict[str, Dict] :

Extra keywords to hand to the running services

security : Security or bool, optional

Configures communication security in this cluster. Can be a security object, or True. If True, temporary self-signed credentials will be created automatically.

protocol: str (optional) :

Protocol to use like tcp:// , tls:// , inproc:// This defaults to sensible choice given other keyword arguments like processes and security

interface: str (optional) :

Network interface to use. Defaults to lo/localhost

worker_class: Worker :

Worker class used to instantiate workers from. Defaults to Worker if processes=False and Nanny if processes=True or omitted.

**worker_kwargs: :

Extra worker arguments. Any additional keyword arguments will be passed to the Worker class constructor.

Create local Scheduler and Workers

Examples

This example is valid syntax, but we were not able to check execution
>>> cluster = LocalCluster()  # Create a local cluster  # doctest: +SKIP
... cluster # doctest: +SKIP LocalCluster("127.0.0.1:8786", workers=8, threads=8)
This example is valid syntax, but we were not able to check execution
>>> c = Client(cluster)  # connect to local cluster  # doctest: +SKIP

Scale the cluster to three workers

This example is valid syntax, but we were not able to check execution
>>> cluster.scale(3)  # doctest: +SKIP

Pass extra keyword arguments to Bokeh

This example is valid syntax, but we were not able to check execution
>>> LocalCluster(service_kwargs={'dashboard': {'prefix': '/foo'}})  # doctest: +SKIP
See :

Back References

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

distributed.client.Client distributed.deploy.local.LocalCluster

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/deploy/local.py#20
type: <class 'type'>
Commit: