distributed 2021.10.0

BackRef
run_on_scheduler(self, function, *args, **kwargs)

This is typically used for live debugging. The function should take a keyword argument dask_scheduler= , which will be given the scheduler object itself.

Run a function on the scheduler process

See Also

Client.run

Run a function on all workers

Client.start_ipython_scheduler

Start an IPython session on scheduler

Examples

This example is valid syntax, but we were not able to check execution
>>> def get_number_of_tasks(dask_scheduler=None):
...  return len(dask_scheduler.tasks)
This example is valid syntax, but we were not able to check execution
>>> client.run_on_scheduler(get_number_of_tasks)  # doctest: +SKIP
100

Run asynchronous functions in the background:

This example is valid syntax, but we were not able to check execution
>>> async def print_state(dask_scheduler):  # doctest: +SKIP
...  while True:
...  print(dask_scheduler.status)
...  await asyncio.sleep(1)
This example is valid syntax, but we were not able to check execution
>>> c.run(print_state, wait=False)  # doctest: +SKIP
See :

Back References

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

distributed.scheduler.Scheduler.run_function

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#2380
type: <class 'function'>
Commit: