|
4 | 4 | This repository contains source code related to Kepler power model. The modules in this reposioty connects to [core Kepler project](https://github.com/sustainable-computing-io/kepler) and [kepler-model-db](https://github.com/sustainable-computing-io/kepler-model-db) as below. |
5 | 5 |  |
6 | 6 |
|
7 | | -## Usage |
8 | | -### Getting Powers from Estimator |
9 | | -**module:** estimator (src/estimate/estimator.py) |
10 | | -``` |
11 | | -/tmp/estimator.socket |
12 | | -``` |
13 | | -Parameters of [PowerRequest](./src/estimate/estimator.py) |
14 | | -|key|value|description |
15 | | -|---|---|---| |
16 | | -|metrics|list of string|list of available input features (measured metrics) |
17 | | -|output_type|either of the following values: *AbsPower* (for node-level power model), *DynPower* (for container-level power model)|the requested model type |
18 | | -|trainer_name (optional)|string|filter model with trainer name. |
19 | | -|filter (optional)|string|expression in the form *attribute1*:*threshold1*; *attribute2*:*threshold2*. |
| 7 | +## Deployment |
20 | 8 |
|
21 | | -### Getting Power Models from Model Server |
22 | | -**module:** server (src/server/model_server.py) |
| 9 | +Deploy with estimator sidecar |
23 | 10 | ``` |
24 | | -:8100/model |
25 | | -POST |
| 11 | +OPTS="ESTIMATOR" make deploy |
26 | 12 | ``` |
27 | 13 |
|
28 | | -Parameters of [ModelRequest](./src/server/model_server.py) |
29 | | -|key|value|description |
30 | | -|---|---|---| |
31 | | -|metrics|list of string|list of available input features (measured metrics) |
32 | | -|output_type|either of the following values: *AbsPower* (for node-level power model), *DynPower* (for container-level power model)|the requested model type |
33 | | -|weight|boolean|return model weights in json format if true. Otherwise, return model in zip file format. |
34 | | -|trainer_name (optional)|string|filter model with trainer name. |
35 | | -|node_type (optional)|string|filter model with node type. |
36 | | -|filter (optional)|string|expression in the form *attribute1*:*threshold1*; *attribute2*:*threshold2*. |
37 | | - |
38 | | -### Posting Model Weights [WIP] |
39 | | -**module:** server (src/server/model_server.py) |
| 14 | +Deploy with estimator sidecar and model server |
40 | 15 | ``` |
41 | | -/metrics |
42 | | -GET |
| 16 | +OPTS="ESTIMATOR SERVER" make deploy |
43 | 17 | ``` |
44 | 18 |
|
45 | | -### Online Trainer [WIP] |
46 | | -**module:** online trainer (src/train/online_trainer.py) |
47 | | -running as a sidecar to server |
48 | | -``` |
49 | | -periodically query prometheus metric server on SAMPLING INTERVAL |
50 | | -``` |
| 19 | +## Local test |
| 20 | +### via docker |
| 21 | +1. Build image for testing, run |
| 22 | + ``` |
| 23 | + make build-test |
| 24 | + ``` |
51 | 25 |
|
52 | | -### Profiler [WIP] |
53 | | -**module:** profiler (src/profile/profiler.py) |
| 26 | +2. Run the test |
54 | 27 |
|
| 28 | + |Test case|Command| |
| 29 | + |---|---| |
| 30 | + |[Training pipeline](./tests/README.md#pipeline)|make test-pipeline| |
| 31 | + |[Model server](./tests/README.md#estimator-model-request-to-model-server)|make test-model-server| |
| 32 | + |[Estimator](./tests/README.md#estimator-power-request-from-collector)|make test-estimator| |
| 33 | + |[Offline Trainer](./tests/README.md#offline-trainer)|make test-offline-trainer| |
55 | 34 |
|
56 | | -### Offline Trainer |
57 | | -**module:** offline trainer (src/train/offline_trainer.py) |
58 | | -``` |
59 | | -:8102/train |
60 | | -POST |
61 | | -``` |
62 | | -Parameters of [TrainRequest](./src/train/offline_trainer.py) |
63 | | -|key|value|description |
64 | | -|---|---|---| |
65 | | -|name|string|pipeline/model name |
66 | | -|energy_source|valid key in [PowerSourceMap](./src/util/train_types.py)|target enery source to train for |
67 | | -|trainer|TrainAttribute|attributes for training |
68 | | -|prome_response|json|prom response with workload for power model training |
| 35 | + For more test information, check [here](./tests/). |
69 | 36 |
|
70 | | -- TrainAttribute |
71 | | - |key|value|description |
72 | | - |---|---|---| |
73 | | - |abs_trainers|list of [available trainer class names](./src/train/trainer)|trainer classes in the pipeline to train for absolute power |
74 | | - |dyn_trainers|list of [available trainer class names](./src/train/trainer)|trainer classes in the pipeline to train for dynamic power |
75 | | - |isolator|[valid isolator class name](./src/train/isolator/)|isolator class of the pipeline to isolate the target data to train for dynamic power |
76 | | - |isolator_args|dict|mapping between isolator-specific argument name and value |
| 37 | +### with native python environment |
| 38 | +1. Prepare environment |
77 | 39 |
|
| 40 | + ```bash |
| 41 | + pip install -r ../dockerfiles/requirements.txt |
| 42 | + ``` |
78 | 43 |
|
79 | | -## Test |
80 | | -Build image for testing, run |
81 | | -``` |
82 | | -make build-test |
83 | | -``` |
| 44 | +2. Run the test |
84 | 45 |
|
85 | | -|Test case|Command| |
86 | | -|---|---| |
87 | | -|[Training pipeline](./tests/README.md#pipeline)|make test-pipeline| |
88 | | -|[Model server](./tests/README.md#estimator-model-request-to-model-server)|make test-model-server| |
89 | | -|[Estimator](./tests/README.md#estimator-power-request-from-collector)|make test-estimator| |
90 | | -|[Offline Trainer](./tests/README.md#offline-trainer)|make test-offline-trainer| |
| 46 | + |Test case|Command| |
| 47 | + |---|---| |
| 48 | + |[Training pipeline](./tests/README.md#pipeline)|python -u ./tests/pipeline_test.py| |
| 49 | + |[Model server](./tests/README.md#estimator-model-request-to-model-server)|Terminal 1: python src/server/model_server.py <br>Terminal 2: python -u tests/estimator_model_request_test.py| |
| 50 | + |[Estimator](./tests/README.md#estimator-power-request-from-collector)|Terminal 1: python src/estimate/estimator.py<br>Terminal 2: python -u tests/estimator_power_request_test.py| |
| 51 | + |[Offline Trainer](./tests/README.md#offline-trainer)|Terminal 1: python src/train/offline_trainer.py<br>Terminal 2: python -u tests/offline_trainer_test.py| |
91 | 52 |
|
92 | | -For more test information, check [here](./tests/). |
| 53 | + For more test information, check [here](./tests/). |
93 | 54 |
|
94 | 55 | ### Contributing |
95 | 56 | Please check the roadmap and guidelines to join us [here](./contributing.md). |
0 commit comments