distributed 2021.10.0

Superclass for endpoints in a distributed cluster, such as Worker and Scheduler objects.

Handlers

Servers define operations with a handlers dict mapping operation names to functions. The first argument of a handler function will be a Comm for the communication established with the client. Other arguments will receive inputs from the keys of the incoming message which will always be a dictionary.

>>> def pingpong(comm):
...     return b'pong'
>>> def add(comm, x, y):
...     return x + y
>>> handlers = {'ping': pingpong, 'add': add}
>>> server = Server(handlers)  # doctest: +SKIP
>>> server.listen('tcp://0.0.0.0:8000')  # doctest: +SKIP

Message Format

The server expects messages to be dictionaries with a special key, :None:None:`'op'` that corresponds to the name of the operation, and other key-value pairs as required by the function.

So in the example above the following would be good messages.

Dask Distributed Server

Examples

See :

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