-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscaletest.py
executable file
·57 lines (47 loc) · 1.73 KB
/
scaletest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
import os
import logging
import random
import subprocess
if __name__ == "__main__":
logging.basicConfig(
level=logging.INFO, format="%(asctime)s:%(levelname)s:%(filename)s: %(message)s"
)
STAGES = list(range(0, 1000, 100)) + [1_000]
REPEATS = 3
experiments = [
{
"stage": stage,
"repeat": i + 1,
}
for stage in STAGES
for i in range(REPEATS)
]
# randomize
random.shuffle(experiments)
for i in range(10):
# just repeat this a bunch of times to make sure all experiments have run
for experiment in experiments:
output_file = f"./simple_scale/output/{experiment['stage']}_{experiment['repeat']}.out"
# if there is already an output file, skip
if os.path.exists(output_file):
logging.info(f"Skipping experiment {experiment}")
continue
logging.info(f"Running experiment {experiment}")
with open("./simple_scale/cfg.txt", "w") as f:
f.write(f"{experiment['stage']}\n")
# ./experiment.sh 10.35.6.3 containers
p = subprocess.run(
["./experiment.sh", "10.35.6.4", "simple_scale"],
)
if p.returncode != 0:
logging.error(f"Experiment {experiment} failed")
continue
# output goes into the containers/out directory
os.makedirs("./simple_scale/output", exist_ok=True)
# take the ./containers/gst-HKPU.out file and move it
os.rename(
"./simple_scale/out/gst-orchestrator.out",
output_file,
)
logging.info("All experiments completed")