Skip to content

Commit 9eb0c0d

Browse files
authored
Merge pull request #149 from sunya-ch/v0.6
move API to gh-page and replace with deployment and test
2 parents e04e863 + f8566dd commit 9eb0c0d

File tree

2 files changed

+33
-71
lines changed

2 files changed

+33
-71
lines changed

README.md

Lines changed: 32 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -4,92 +4,53 @@
44
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.
55
![](./fig/model-server-components-simplified.png)
66

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
208

21-
### Getting Power Models from Model Server
22-
**module:** server (src/server/model_server.py)
9+
Deploy with estimator sidecar
2310
```
24-
:8100/model
25-
POST
11+
OPTS="ESTIMATOR" make deploy
2612
```
2713

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
4015
```
41-
/metrics
42-
GET
16+
OPTS="ESTIMATOR SERVER" make deploy
4317
```
4418

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+
```
5125
52-
### Profiler [WIP]
53-
**module:** profiler (src/profile/profiler.py)
26+
2. Run the test
5427
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|
5534
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/).
6936
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
7739
40+
```bash
41+
pip install -r ../dockerfiles/requirements.txt
42+
```
7843
79-
## Test
80-
Build image for testing, run
81-
```
82-
make build-test
83-
```
44+
2. Run the test
8445
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|
9152
92-
For more test information, check [here](./tests/).
53+
For more test information, check [here](./tests/).
9354
9455
### Contributing
9556
Please check the roadmap and guidelines to join us [here](./contributing.md).

tests/e2e_test.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ get_server_log() {
4545

4646
wait_for_kepler() {
4747
kubectl rollout status ds kepler-exporter -n kepler --timeout 5m
48+
kubectl describe ds -n kepler kepler-exporter
4849
kubectl get po -n kepler
4950
}
5051

0 commit comments

Comments
 (0)