The watcher.decision_engine.scoring.dummy_scorer Module

The watcher.decision_engine.scoring.dummy_scorer Module

class watcher.decision_engine.scoring.dummy_scorer.DummyScorer(config)[source]

Bases: watcher.decision_engine.scoring.base.ScoringEngine

Sample Scoring Engine implementing simplified workload classification.

Typically a scoring engine would be implemented using machine learning techniques. For example, for workload classification problem the solution could consist of the following steps:

  1. Define a problem to solve: we want to detect the workload on the machine based on the collected metrics like power consumption, temperature, CPU load, memory usage, disk usage, network usage, etc.
  2. The workloads could be predefined, e.g. IDLE, CPU-INTENSIVE, MEMORY-INTENSIVE, IO-BOUND, … Or we could let the ML algorithm to find the workloads based on the learning data provided. The decision here leads to learning algorithm used (supervised vs. non-supervised learning).
  3. Collect metrics from sample servers (learning data).
  4. Define the analytical model, pick ML framework and algorithm.
  5. Apply learning data to the data model. Once taught, the data model becomes a scoring engine and can start doing predictions or classifications.
  6. Wrap up the scoring engine with the class like this one, so it has a standard interface and can be used inside Watcher.

This class is a greatly very simplified version of the above model. The goal is to provide an example how such class could be implemented and used in Watcher, without adding additional dependencies like machine learning frameworks (which can be quite heavy) or over-complicating it’s internal implementation, which can distract from looking at the overall picture.

That said, this class implements a workload classification “manually” (in plain python code) and is not intended to be used in production.

calculate_score(features)[source]

Arbitrary algorithm calculating the score.

It demonstrates how to parse the input data (features) and serialize the results. It detects the workload type based on the metrics and also returns the probabilities of each workload detection (again, the arbitrary values are returned, just for demonstration how the “real” machine learning algorithm could work. For example, the Gradient Boosting Machine from H2O framework is using exactly the same format: http://www.h2o.ai/verticals/algos/gbm/

get_description()[source]

Returns the description of the Scoring Engine.

The description might contain any human readable information, which might be useful for Strategy developers planning to use this Scoring Engine. It will be also visible in the Watcher API and CLI.

Returns:A Scoring Engine description
Return type:str
get_metainfo()[source]

Metadata about input/output format of this scoring engine.

This information is used in strategy using this scoring engine to prepare the input information and to understand the results.

get_name()[source]

Returns the name of the Scoring Engine.

The name should be unique across all Scoring Engines.

Returns:A Scoring Engine name
Return type:str
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.