MCPcopy Create free account
hub / github.com/It4innovations/hyperqueue / get

Method get

benchmarks/src/postprocessing/serve.py:69–102  ·  view source on GitHub ↗
(self, key: str)

Source from the content-addressed store, hash-verified

67
68 class CompareOverview(web.RequestHandler):
69 def get(self, key: str):
70 df = create_database_df(database)
71 key = key.split("(")[1].split(")")[0]
72 df = df[df["workload-params"] == key]
73 max_index = df["index"].max()
74 samples = [df[df["index"] == i] for i in range(max_index + 1)]
75 tables = [i["duration"].describe().to_frame() for i in samples]
76 compare1 = tables[0] > tables[1]
77 compare0 = tables[1] > tables[0]
78
79 def color_0(x):
80 return ["background-color:red" if i[1][0] else "" for i in compare0.iterrows()]
81
82 def color_1(x):
83 return ["background-color:red" if i[1][0] else "" for i in compare1.iterrows()]
84
85 # tables[1].style.apply_index(color_b)
86 output = ""
87 tables[0].style.set_uuid("table0")
88 tables[1].style.set_uuid("table1")
89 output += tables[0].style.apply(color_0).set_uuid("table0").to_html()
90 output += tables[1].style.apply(color_1).set_uuid("table1").to_html()
91
92 plt.scatter(df["index"], df["duration"], s=10)
93 plt.xticks(list(range(max_index + 1)))
94 plt.ylabel("Duration [ms]")
95
96 plt.savefig(img, format="png")
97 plt.clf()
98
99 with open(os.path.join(os.path.dirname(__file__), "templates/compare_table.html")) as fp:
100 file = fp.read()
101
102 self.write(render(file, tables=output))
103
104 class ImgHandler(web.RequestHandler):
105 def get(self):

Callers

nothing calls this directly

Calls 3

create_database_dfFunction · 0.85
renderFunction · 0.70
splitMethod · 0.45

Tested by

no test coverage detected