Skip to content

Commit c0fc7b9

Browse files
Benedikt Volkelsawenzel
authored andcommitted
Fixes
* Don't divide by number of CPUs twoice * add protection against limits of CPU and mem given as str
1 parent 68834b6 commit c0fc7b9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

MC/utils/o2dpg_sim_metrics.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,10 @@ def make_cat_map(pipeline_path):
105105
elif "meta" not in current_pipeline and "mem_limit" in d:
106106
current_pipeline["meta"] = d
107107

108+
# protect against potential str values there
109+
current_pipeline["meta"]["cpu_limit"] = float(current_pipeline["meta"]["cpu_limit"])
110+
current_pipeline["meta"]["mem_limit"] = float(current_pipeline["meta"]["mem_limit"])
111+
108112
cpu_limit = current_pipeline["meta"]["cpu_limit"]
109113
# scale by constraint number of CPUs
110114
current_pipeline["cpu_efficiencies"] = [e / cpu_limit for e in extract_cpu_usage(current_pipeline_metrics)]
@@ -472,8 +476,6 @@ def run(args):
472476
effs = save_map["cpu_efficiencies"]
473477
if effs:
474478
pipeline_name = basename(full_path)
475-
cpu_limit = save_map["meta"]["cpu_limit"]
476-
effs = [e / cpu_limit for e in effs]
477479
figure, ax = make_plot(range(len(effs)), effs, "sampling iteration", "CPU efficiency [%]", title=pipeline_name)
478480
global_eff = sum(effs) / len(effs)
479481
ax.axhline(global_eff, color="black")

0 commit comments

Comments
 (0)