Skip to content

Commit c525551

Browse files
committed
polish scripts
1 parent 9102a87 commit c525551

File tree

3 files changed

+17
-28
lines changed

3 files changed

+17
-28
lines changed

scripts/analysis.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,18 @@
44
import pandas as pd
55
from pathlib import Path
66

7-
87
ALLO_KEYS = ['MilliCpu','Memory','Gpu','MilliGpu']
98
QUAD_KEYS = ["q1_lack_both", 'q2_lack_gpu', 'q3_satisfied', 'q4_lack_cpu', 'xl_satisfied', 'xr_lack_cpu', 'no_access', "frag_gpu_milli"]
109

11-
DESCHEDULE_POLICY_LIST = ["cosSim", "fragOnePod", "fragMultiPod"]
12-
DESCHEDULE_POLICY_DICT = {}
13-
for i, v in enumerate(DESCHEDULE_POLICY_LIST):
14-
DESCHEDULE_POLICY_DICT[i+1] = v
15-
DESCHEDULE_POLICY_DICT[str(i+1)] = v
16-
1710
def camel_to_snake(name):
1811
name = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name)
1912
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', name).lower()
2013

21-
2214
TAG_LIST = ["InitSchedule", "PostEviction", "PostDeschedule", "ScheduleInflation", "DescheduleInflation"]
2315
TAG_SNAKE_LIST = [camel_to_snake(x) for x in TAG_LIST]
2416
HASTAG_COL = [camel_to_snake(x) for x in ALLO_KEYS]
2517
HASTAG_COL.extend([camel_to_snake(x) for x in [ y + "Amount" for y in ALLO_KEYS]])
2618
HASTAG_COL.extend(QUAD_KEYS)
27-
NONTAG_COL = ['data_date','inflation','deschedule_ratio','deschedule_policy','snapshot_sc','gpu_pack_score','gpu_frag_score','pack_x_frag','trial','unscheduled','origin_pods']
28-
NONTAG_COL.extend([camel_to_snake(x) for x in [y+"Total" for y in ALLO_KEYS]])
2919

3020
def move_tag_to_new_column(df, tag_list=TAG_SNAKE_LIST):
3121
meta_col = []
@@ -47,7 +37,6 @@ def move_tag_to_new_column(df, tag_list=TAG_SNAKE_LIST):
4737
orig_dict = dict(row)
4838
meta_dict = {}
4939
for col in meta_col:
50-
# for col in NONTAG_COL:
5140
if col in orig_dict:
5241
meta_dict[col] = orig_dict[col]
5342
# print("meta_dict:", meta_dict)
@@ -274,15 +263,15 @@ def log_to_csv(log_path: Path, outfile: Path):
274263
try:
275264
cdol_list_dict['event'][-1] = 'failed'
276265
cdol_list_dict['cum_pod'][-1] -= 1
277-
pod_name = cdol_meat[6][4:-3] # pod(paib-gpu/paib-pod-0008) -> paib-gpu/paib-pod-0008
266+
pod_name = cdol_meat[6][4:-3] # pod(openb-gpu/openb-pod-0008) -> openb-gpu/openb-pod-0008
278267
del cdol_pod_dict[pod_name]
279268
except Exception as e:
280269
print("[ERROR] cdol: probably empty cdol_list_dict(%s) encounters [deletePod], error: %s" % (cdol_list_dict, e))
281270
continue
282271
else:
283272
event_id = int(cdol_meat[0][1:-1]) # [8] -> 8
284273
event = cdol_meat[3] # create/delete
285-
pod_name = cdol_meat[4][4:-3] # pod(paib-gpu/paib-pod-0008) -> paib-gpu/paib-pod-0008
274+
pod_name = cdol_meat[4][4:-3] # pod(openb-gpu/openb-pod-0008) -> openb-gpu/openb-pod-0008
286275
cum_sum = cdol_list_dict['cum_pod'][-1]
287276

288277
if event == 'create':

scripts/generate_config_and_run.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import subprocess
66
from hashlib import md5
77
from pathlib import Path
8-
""" Usage: paib 0 =fragshare_1000=> 2K pods
9-
EXPDIR="experiments/0705/seed233/01-fragshare"
8+
""" Usage: openb 0 =FGD_1000=> 2K pods
9+
EXPDIR="experiments/2023_0511/openb_pod_list_default/06-FGD"
1010
mkdir -p ${EXPDIR} && touch "${EXPDIR}/terminal.out"
11-
python3 scripts/h_generate_config_and_run.py -d "${EXPDIR}" \
11+
python3 scripts/generate_config_and_run.py -d "${EXPDIR}" \
1212
-seed 233 \
1313
-e -b \
14-
-f data/cluster_paib-pod_paib_0318_gpu_3000 \
15-
-fragshare 1000 \
14+
-f data/openb_pod_list_default \
15+
-FGD 1000 \
1616
-y "${EXPDIR}/snapshot/ds01" | tee -a "${EXPDIR}/terminal.out" \
1717
&& \
1818
python3 scripts/analysis.py -f -g ${EXPDIR} | tee -a "${EXPDIR}/terminal.out"
@@ -58,7 +58,7 @@ def get_args():
5858
parser.add_argument('--pod-increase-step', type=int, default=1, help='pod increase step (default: 1)')
5959
parser.add_argument('--gpu-res-weight', type=float, default=0, help='GPU resource weight (default: 0)')
6060

61-
parser.add_argument('--cluster-name', type=str, default='simon-paib-config', help='name of the cluster config')
61+
parser.add_argument('--cluster-name', type=str, default='simon-openb-config', help='name of the cluster config')
6262
parser.add_argument('-a', '--applist-path', type=str, default=None, help='path to the app list')
6363
parser.add_argument('--applist-name', type=str, default=None, help='name of the app list')
6464
parser.add_argument('--new-node', type=str, default="example/newnode/gpushare")
@@ -91,13 +91,13 @@ def get_args():
9191
apiVersion: simon/v1alpha1
9292
kind: Config
9393
metadata:
94-
name: simon-paib-config
94+
name: simon-openb-config
9595
spec:
9696
appList:
9797
# - name: pai_gpu
9898
# path: data/pai_b/application
9999
cluster:
100-
customConfig: "data/cluster_paib-origin_workload"
100+
customConfig: "data/cluster_openb-origin_workload"
101101
newNode: example/newnode/gpushare
102102
customConfig:
103103
shufflePod: false
@@ -115,7 +115,7 @@ def get_args():
115115
# policy: cosSim
116116
# policy: fragOnePod
117117
# policy: fragMultiPod
118-
newWorkloadConfig: # "data/cluster_paib-new_workload"
118+
newWorkloadConfig: # "data/cluster_openb-new_workload"
119119
typicalPodsConfig:
120120
isInvolvedCpuPods: true
121121
podPopularityThreshold: 95

scripts/inject_origin_workload_into_snapshot.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,16 @@ def inject_origin_workload_into_snapshot(origin, snapshot):
6060
{
6161
"annotations":
6262
{
63-
"alibabacloud.com/assume-time": "1652685498360787000",
64-
"alibabacloud.com/creation-time": "2022-03-18T10:50:04+08:00",
63+
"alibabacloud.com/assume-time": "1234567891011121314",
64+
"alibabacloud.com/creation-time": "1970-01-01T10:50:04+08:00",
6565
"alibabacloud.com/gpu-count": "1",
6666
"alibabacloud.com/gpu-index": "1",
6767
"alibabacloud.com/gpu-milli": "1000",
6868
},
6969
"creationTimestamp": None,
70-
"name": "paib-pod-0000",
71-
"namespace": "paib-gpu",
72-
"uid": "10d97990-4a98-4654-9cf0-fd26d9c7ca02",
70+
"name": "openb-pod-0000",
71+
"namespace": "openb-gpu",
72+
"uid": "abcdefgh-ijkl-mnop-qrst-uvwxyz",
7373
},
7474
"spec":
7575
{
@@ -85,7 +85,7 @@ def inject_origin_workload_into_snapshot(origin, snapshot):
8585
},
8686
],
8787
"dnsPolicy": "Default",
88-
"nodeSelector": { "kubernetes.io/hostname": "paib-node-0461" },
88+
"nodeSelector": { "kubernetes.io/hostname": "openb-node-0461" },
8989
"restartPolicy": "OnFailure",
9090
"schedulerName": "simon-scheduler",
9191
},

0 commit comments

Comments
 (0)