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

Function create_comparer_page

benchmarks/src/postprocessing/overview.py:331–366  ·  view source on GitHub ↗
(database: Database, directory: Path, addr: str)

Source from the content-addressed store, hash-verified

329
330
331def create_comparer_page(database: Database, directory: Path, addr: str):
332 def create_href(addr, location, name):
333 return Div(text=f"""<a href='{addr}/{str(location)}'>{str(name)}</a>""")
334
335 entry_map = pregenerate_entries(database, directory)
336 df = create_database_df(database)
337 ensure_directory(directory.joinpath("comparisons"))
338
339 comparisons = {}
340 for comparison in glob(str(directory.joinpath("comparisons/*"))):
341 name = os.path.basename(comparison)
342 comparisons[name] = create_href(addr, Path("comparisons").joinpath(name), os.path.splitext(name)[0])
343
344 comparisons_col = column(list(comparisons.values()))
345
346 def callback():
347 name = "_".join(bench_choice.value) + ".html"
348 if comparisons.get(name) is None:
349 entries = []
350 for bench in bench_choice.value:
351 if entry_map.get(bench) is not None:
352 entries.append(entry_map[bench])
353
354 page = render_hq_comparison(entries)
355 location = Path("comparisons").joinpath(name)
356 save(page, directory.joinpath(location), CDN, "Comparison")
357
358 comparisons[name] = create_href(addr, location, name)
359 comparisons_col.update(children=list(comparisons.values()))
360
361 bench_opts = df["key"].to_list()
362 bench_choice = MultiChoice(options=bench_opts)
363
364 btn = Button(label="Compare", button_type="success")
365 btn.on_click(callback)
366 return column(row(bench_choice, btn), comparisons_col)

Callers 1

comparerFunction · 0.85

Calls 5

pregenerate_entriesFunction · 0.85
create_database_dfFunction · 0.85
ensure_directoryFunction · 0.85
create_hrefFunction · 0.85
valuesMethod · 0.80

Tested by

no test coverage detected