Skip to content

Commit d20fe01

Browse files
committed
Simplify
1 parent 47e2aa0 commit d20fe01

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

bench_runner/runners.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,6 @@ def get_runners_by_hostname(cfgpath: PathLike | None = None) -> dict[str, Runner
7373
return {x.hostname: x for x in config.get_config(cfgpath).runners.values()}
7474

7575

76-
def get_runners_by_nickname(cfgpath: PathLike | None = None) -> dict[str, Runner]:
77-
from . import config
78-
79-
return config.get_config(cfgpath).runners
80-
81-
8276
def get_nickname_for_hostname(
8377
hostname: str | None = None, cfgpath: PathLike | None = None
8478
) -> str:
@@ -90,7 +84,9 @@ def get_nickname_for_hostname(
9084

9185

9286
def get_runner_by_nickname(nickname: str, cfgpath: PathLike | None = None) -> Runner:
93-
return get_runners_by_nickname(cfgpath).get(nickname, unknown_runner)
87+
from . import config
88+
89+
return config.get_config(cfgpath).runners.get(nickname, unknown_runner)
9490

9591

9692
def get_runner_for_hostname(

bench_runner/scripts/compare.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
import rich_argparse
1717

1818

19+
from bench_runner import config
1920
from bench_runner import flags as mflags
2021
from bench_runner import result as mod_result
21-
from bench_runner import runners as mod_runners
2222
from bench_runner import util
2323
from bench_runner.util import PathLike
2424

@@ -146,6 +146,8 @@ def do_many_to_many(
146146
def _main_with_hashes(
147147
commits: Sequence[str], output_dir: Path, comparison_type: Literal["1:n", "n:n"]
148148
):
149+
cfg = config.get_config()
150+
149151
results = mod_result.load_all_results(
150152
None, Path("results"), sorted=False, match=False
151153
)
@@ -188,12 +190,10 @@ def _main_with_hashes(
188190
case _:
189191
raise ValueError(f"Unknown comparison type {comparison_type}")
190192

191-
runners = mod_runners.get_runners_by_nickname()
192-
193193
counter = [0, total]
194194
with (output_dir / "README.md").open("w", encoding="utf-8") as fd:
195195
for machine in machines:
196-
fd.write(f"# {runners[machine].display_name}\n\n")
196+
fd.write(f"# {cfg.runners[machine].display_name}\n\n")
197197
func(fd, parsed_commits, machine, output_dir, counter)
198198
fd.write("\n")
199199
rich.print()

0 commit comments

Comments
 (0)