analyzer.postprocessing.running¶
Attributes¶
Classes¶
Interface to extend the Worker |
Functions¶
|
|
|
|
|
|
|
|
|
|
|
Module Contents¶
- class analyzer.postprocessing.running.PostprocessorConfig[source]¶
-
- default_style_set: analyzer.postprocessing.style.StyleSet[source]¶
- default_plot_config: analyzer.postprocessing.plots.common.PlotConfiguration[source]¶
- drop_sample_pattern: analyzer.utils.querying.BasePattern | None = None[source]¶
- class analyzer.postprocessing.running.LoadStyles[source]¶
Bases:
distributed.WorkerPluginInterface to extend the Worker
A worker plugin enables custom code to run at different stages of the Workers’ lifecycle.
A plugin enables custom code to run at each of step of a Workers’s life. Whenever such an event happens, the corresponding method on this class will be called. Note that the user code always runs within the Worker’s main thread.
To implement a plugin:
inherit from this class
override some of its methods
register the plugin using
Client.register_plugin.
The
idempotentattribute is used to control whether or not the plugin should be ignored upon registration if a worker plugin with the same name already exists. IfTrue, the plugin is ignored, otherwise the existing plugin is replaced. Defaults toFalse.Examples¶
>>> class ErrorLogger(WorkerPlugin): ... def __init__(self, logger): ... self.logger = logger ... ... def setup(self, worker): ... self.worker = worker ... ... def transition(self, key, start, finish, *args, **kwargs): ... if finish == 'error': ... ts = self.worker.tasks[key] ... exc_info = (type(ts.exception), ts.exception, ts.traceback) ... self.logger.error( ... "Error during computation of '%s'.", key, ... exc_info=exc_info ... )
>>> import logging >>> plugin = ErrorLogger(logging) >>> client.register_plugin(plugin)
- analyzer.postprocessing.running.determineFileGroups(postprocessors, results) set[frozenset][source]¶
- analyzer.postprocessing.running.makeApproxEqualSubgroups(groups, target_num_groups, size_func=lambda x: ...)[source]¶