Workers and Results¶
Operations on the data (represented by a Data object) are
performed by worker classes, which are a subclass of the
DataWorker class.
Usually the workflow looks as follows:
- Initialize the worker class
w = Worker() - Configure the worker class by applying a set of methods:
w.set_metric(...),w.configure_fom(...)`etc. - Run the worker class on a
Dataobject:r = w.run(d). This returns a result objectr.
Running a worker class returns a result class, which is formally a subclass of the
AbstractResult` class.
Most prominently, it has a write method, that allows to writes the relevant
part of the results back to the Data object. Thus the
workflow continues as
- Write back to data object:
r.write().
Worker¶
- class
clusterking.worker.AbstractWorker[source]¶Bases:
abc.ABCThe AbstractWorker class represents an abstract operation on some data.
It provides a number of methods to allow for configuration.
After configuration,
run()can be called.The underlying design patterns of this class are therefore the template method pattern and the command pattern.
- class
clusterking.worker.DataWorker[source]¶Bases:
clusterking.worker.AbstractWorkerThe worker class represents an operation on some data.
It provides a number of methods to allow for configuration.
After configuration,
run()can be called.The underlying design patterns of this class are therefore the template method pattern and the command pattern.
Result¶
- class
clusterking.result.DataResult(data: clusterking.data.data.Data)[source]¶Bases:
clusterking.result.AbstractResultThe result object represents the result of the execution of a
Workerobject on theDataobject.