distributed 2021.10.0

BackRef

The scheduler operates by triggering and responding to events like task_finished , update_graph , task_erred , etc..

A plugin enables custom code to run at each of those same events. The scheduler will run the analogous methods on this class when each event is triggered. This runs user code within the scheduler thread that can perform arbitrary operations in synchrony with the scheduler itself.

Plugins are often used for diagnostics and measurement, but have full access to the scheduler and could in principle affect core scheduling.

To implement a plugin implement some of the methods of this class and add the plugin to the scheduler with Scheduler.add_plugin(myplugin) .

Interface to extend the Scheduler

Examples

This example is valid syntax, but we were not able to check execution
>>> class Counter(SchedulerPlugin):
...  def __init__(self):
...  self.counter = 0 ... ... def transition(self, key, start, finish, *args, **kwargs): ... if start == 'processing' and finish == 'memory': ... self.counter += 1 ... ... def restart(self, scheduler): ... self.counter = 0
This example is valid syntax, but we were not able to check execution
>>> plugin = Counter()
... scheduler.add_plugin(plugin) # doctest: +SKIP
See :

Back References

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

distributed.diagnostics.plugin.SchedulerPlugin distributed.diagnostics.plugin.NannyPlugin

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/diagnostics/plugin.py#14
type: <class 'type'>
Commit: