Skip to content

Commit 1853fc0

Browse files
committed
add expected results and plotting
1 parent a512f76 commit 1853fc0

25 files changed

+92498
-91
lines changed

experiments/README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
### Generate Run Scripts
44

55
```bash
6-
cd kubernetes-scheduler-simulator/experiments
6+
# pwd: kubernetes-scheduler-simulator/experiments
77
python run_scripts/generate_run_scripts.py > run_scripts/run_scripts_0511.sh
88
```
99

@@ -33,15 +33,21 @@ cat experiments/run_scripts/run_scripts_0511.sh | while read i; do printf "%q\n"
3333
```bash
3434
# pwd: kubernetes-scheduler-simulator/experiments
3535
ln -s 2023_0511 data # softlink it to data
36+
# pwd: kubernetes-scheduler-simulator/experiments/analysis
3637
cd analysis
37-
bash merge_bash.sh
38+
bash bash_merge.sh
39+
# The output was generated under "analysis_results"
40+
# The results of our large-scale experiments are cached in "expected_results" for comparison
3841
```
3942

4043
### Plot
4144

4245
```bash
46+
# pwd: kubernetes-scheduler-simulator/experiments/analysis
47+
cd ..
4348
# pwd: kubernetes-scheduler-simulator/experiments
44-
ln -s analysis/analysis_results/* plot/ # softlink all csv under analysis_results/ to plot/
49+
cp analysis/analysis_results/* plot/ # copy all csv under analysis_results/ to plot/ for analysis
50+
# cp analysis/expected_results/* plot/ # if skipping the experiments and directly reuse our expected results for plotting
4551
cd plot
4652
python plot_paib_alloc.py # Fig. 9(a)
4753
python plot_paib_frag_amount.py # Fig. 7(a)
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#!/bin/bash
2-
DATE="2023_0511"
3-
TRACE="openb_pod_list_default"
4-
ln -s "../${DATE}/${TRACE}" ../data/
5-
62
python3 merge_alloc_discrete_0920.py &
73
python3 merge_frag_discrete_0928.py &
84
python3 merge_frag_ratio_discrete_0928.py &
9-
python3 merge_fail_pods_1010.py &
5+
python3 merge_fail_pods_1010.py &

experiments/analysis/expected_results/analysis_allo_discrete.csv

Lines changed: 1021 additions & 0 deletions
Large diffs are not rendered by default.

experiments/analysis/expected_results/analysis_fail.csv

Lines changed: 89297 additions & 0 deletions
Large diffs are not rendered by default.

experiments/analysis/expected_results/analysis_frag_discrete.csv

Lines changed: 1021 additions & 0 deletions
Large diffs are not rendered by default.

experiments/analysis/expected_results/analysis_frag_ratio_discrete.csv

Lines changed: 1021 additions & 0 deletions
Large diffs are not rendered by default.

experiments/analysis/merge_alloc_discrete_0920.py

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
import os
12
import pandas as pd
23
from pathlib import Path
3-
from utils import move_tag_to_new_column
4+
5+
RESULTDIR="analysis_results"
6+
DATADIR="data"
47
RESULTDIR="analysis_results"
58
DATADIR="data"
6-
root = Path(__file__).parents[1] # 0524
9+
filepath = os.path.abspath(__file__)
10+
root = Path(filepath).parents[1] # 0524
711
data = root / DATADIR
8-
analysis = Path(__file__).parent # 0830
12+
analysis = Path(filepath).parent # 0830
913
resultDir = analysis / RESULTDIR
1014
# .
1115
# ├── README.md
@@ -23,6 +27,47 @@
2327
# │ │ │ │ ├── [d] 42
2428
# ......
2529

30+
TAG_SNAKE_LIST = ['init_schedule', 'post_eviction', 'post_deschedule', 'schedule_inflation', 'deschedule_inflation']
31+
def move_tag_to_new_column(df, tag_list=TAG_SNAKE_LIST):
32+
meta_col = []
33+
data_col = []
34+
for col in df.columns:
35+
is_data_col = False
36+
for tag in tag_list:
37+
if col.endswith("_" + tag):
38+
data_col.append(col)
39+
is_data_col = True
40+
break
41+
if is_data_col == False:
42+
meta_col.append(col)
43+
44+
out_row_list = []
45+
for _, row in df.iterrows():
46+
orig_dict = dict(row)
47+
meta_dict = {}
48+
for col in meta_col:
49+
# for col in NONTAG_COL:
50+
if col in orig_dict:
51+
meta_dict[col] = orig_dict[col]
52+
# print("meta_dict:", meta_dict)
53+
54+
for tag in tag_list:
55+
data_dict = {}
56+
data_dict.update(meta_dict)
57+
data_dict['tag'] = tag
58+
found = 0
59+
for col in data_col:
60+
if col.endswith("_" + tag):
61+
key = col[:-(len(tag)+1)]
62+
# print(tag, '+', key,'=',col)
63+
data_dict[key] = orig_dict.get(col)
64+
found = 1
65+
if found == 1:
66+
# print("data_dict:", data_dict)
67+
data_row = pd.DataFrame().from_dict(data_dict, orient='index').T
68+
out_row_list.append(data_row)
69+
return pd.concat(out_row_list)
70+
2671
def exit_and_save_to_csv(dflist):
2772
dfo = pd.concat(dflist)
2873
resultDir.mkdir(exist_ok=True)

experiments/analysis/merge_fail_pods_1010.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
import os
12
import pandas as pd
23
from pathlib import Path
3-
from utils import get_total_num_gpu
44

55
DATADIR="data"
66
IN_FILE="analysis_fail.out"
77
RESULTDIR="analysis_results"
88
OUT_CSV="analysis_fail.csv"
9-
root = Path(__file__).parents[1] # 0524
9+
filepath = os.path.abspath(__file__)
10+
root = Path(filepath).parents[1] # 0524
1011
data = root / DATADIR
11-
analysis = Path(__file__).parent # 0830
12+
analysis = Path(filepath).parent # 0830
1213
resultDir = analysis / RESULTDIR
1314
# .
1415
# ├── README.md
@@ -25,6 +26,8 @@
2526
# │ │ │ ├── [d] 0.6
2627
# │ │ │ │ ├── [d] 42
2728
# ......
29+
def get_total_num_gpu(workload):
30+
return 6212
2831

2932
def parse_fail_out_file_to_df(ifile):
3033
with open(ifile, 'r') as f:

experiments/analysis/merge_frag_discrete_0928.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
import os
12
import pandas as pd
23
from pathlib import Path
3-
from utils import get_total_num_gpu
44

55
RESULTDIR="analysis_results"
66
DATADIR="data"
7-
root = Path(__file__).parents[1] # 0524
7+
8+
filepath = os.path.abspath(__file__)
9+
root = Path(filepath).parents[1] # 0524
810
data = root / DATADIR
9-
analysis = Path(__file__).parent # 0830
11+
analysis = Path(filepath).parent # 0830
1012
resultDir = analysis / RESULTDIR
1113
# .
1214
# ├── README.md
@@ -23,6 +25,8 @@
2325
# │ │ │ ├── [d] 0.6
2426
# │ │ │ │ ├── [d] 42
2527
# ......
28+
def get_total_num_gpu(workload):
29+
return 6212
2630

2731
def exit_and_save_to_csv(dflist):
2832
dfo = pd.concat(dflist)

experiments/analysis/merge_frag_ratio_discrete_0928.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
import os
12
import pandas as pd
23
from pathlib import Path
3-
from utils import get_total_num_gpu
44

55
RESULTDIR="analysis_results"
66
DATADIR="data"
7-
root = Path(__file__).parents[1] # 0524
7+
filepath = os.path.abspath(__file__)
8+
root = Path(filepath).parents[1] # 0524
89
data = root / DATADIR
9-
analysis = Path(__file__).parent # 0830
10+
analysis = Path(filepath).parent # 0830
1011
resultDir = analysis / RESULTDIR
1112
# .
1213
# ├── README.md
@@ -24,6 +25,9 @@
2425
# │ │ │ │ ├── [d] 42
2526
# ......
2627

28+
def get_total_num_gpu(workload):
29+
return 6212
30+
2731
def exit_and_save_to_csv(dflist):
2832
dfo = pd.concat(dflist)
2933
resultDir.mkdir(exist_ok=True)

0 commit comments

Comments
 (0)