Skip to content

Commit d1b03f2

Browse files
committed
Rename groups to tags, and change 'force' to false by default as suggested
by Mike.
1 parent cf147dd commit d1b03f2

File tree

5 files changed

+30
-32
lines changed

5 files changed

+30
-32
lines changed

CHANGELOG.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,37 +100,35 @@ See `README.md` for more information.
100100
python -m pytest -m "not long_running"
101101
```
102102

103-
### Configurable groups
103+
### Configurable tags
104104

105-
Runners can configure which groups they belong to, and benchmark runs can be
106-
started on whole groups. Unlike when using 'all' or individual runners, runs
107-
for which the result already exists are skipped. For example, a
108-
configuration like:
105+
Runners can have tags attached, and benchmark runs can be started on
106+
everything with a specific tag. For example, a configuration like:
109107

110108
```toml
111109
[runners.linux_clang]
112110
os = "linux"
113111
arch = "x86_64"
114112
hostname = "pyperf1"
115113
env.CC = "clang"
116-
groups = ["linux", "pyperf1", "clang"]
114+
tags = ["linux", "pyperf1", "clang"]
117115

118116
[runners.linux_gcc]
119117
os = "linux"
120118
arch = "x86_64"
121119
hostname = "pyperf1"
122-
groups = ["linux", "pyperf1", "gcc"]
120+
tags = ["linux", "pyperf1", "gcc"]
123121

124122
[runners.linux2_gcc]
125123
os = "linux"
126124
arch = "x86_64"
127125
hostname = "pyperf2"
128-
groups = ["linux", "pyperf2", "gcc"]
126+
tags = ["linux", "pyperf2", "gcc"]
129127
```
130128

131-
... will add `group linux`, `group pyperf1`, `group pyperf2`, `group gcc`
132-
and `group clang` to the list of possible machines for benchmark runs.
133-
Selecting `group linux` will queue a run for all three runners, and `group
129+
... will add `tag linux`, `tag pyperf1`, `tag pyperf2`, `tag gcc`
130+
and `tag clang` to the list of possible machines for benchmark runs.
131+
Selecting `tag linux` will queue a run for all three runners, and `tag
134132
pyperf1` only for the first two.
135133

136134
## v1.8.0

bench_runner/runners.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(
3535
github_runner_name: str | None,
3636
include_in_all: bool = True,
3737
plot: dict[str, str] | None = None,
38-
groups: list[str] | None = None,
38+
tags: list[str] | None = None,
3939
):
4040
self.nickname = nickname
4141
self.os = os
@@ -50,7 +50,7 @@ def __init__(
5050
if plot is None:
5151
plot = {"name": nickname}
5252
self.plot = PlotConfig(**plot)
53-
self.groups = groups
53+
self.tags = tags
5454

5555
@property
5656
def name(self) -> str:
@@ -80,7 +80,7 @@ def get_runners(cfgpath: PathLike | None = None) -> list[Runner]:
8080
section.get("github_runner_name"),
8181
section.get("include_in_all", True),
8282
section.get("plot", None),
83-
section.get("groups"),
83+
section.get("tags"),
8484
)
8585
)
8686

@@ -123,10 +123,10 @@ def get_runner_for_hostname(
123123
return get_runners_by_hostname(cfgpath).get(hostname, unknown_runner)
124124

125125

126-
def get_groups(cfgpath: PathLike | None = None) -> dict[str, list[Runner]]:
126+
def get_tags(cfgpath: PathLike | None = None) -> dict[str, list[Runner]]:
127127
d = collections.defaultdict(list)
128128
for runner in get_runners(cfgpath):
129-
if runner.groups:
130-
for group in runner.groups:
131-
d[group].append(runner)
129+
if runner.tags:
130+
for tag in runner.tags:
131+
d[tag].append(runner)
132132
return dict(d)

bench_runner/scripts/get_merge_base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ def _main(
5252
if machine in ("__really_all", "all"):
5353
need_to_run = True
5454
else:
55-
if machine.startswith("group "):
56-
group = machine.removeprefix("group ")
57-
groups = mrunners.get_groups()
58-
machines = [r.nickname for r in groups[group]]
55+
if machine.startswith("tag "):
56+
tag = machine.removeprefix("tag ")
57+
tags = mrunners.get_tags()
58+
machines = [r.nickname for r in tags[tag]]
5959
else:
6060
machines = [machine]
6161
for m in machines:

bench_runner/scripts/install.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,11 +184,11 @@ def generate__benchmark(src: Any) -> Any:
184184
]
185185
if runner.include_in_all:
186186
machine_clauses.append("inputs.machine == 'all'")
187-
if runner.groups:
188-
for group in runner.groups:
189-
if "'" in group:
190-
raise ValueError(f"group cannot contain `'` (runner {runner.name})")
191-
machine_clauses.append(f"inputs.machine == 'group {group}'")
187+
if runner.tags:
188+
for tag in runner.tags:
189+
if "'" in tag:
190+
raise ValueError(f"tag cannot contain `'` (runner {runner.name})")
191+
machine_clauses.append(f"inputs.machine == 'tag {tag}'")
192192
runner_template["if"] = f"${{{{ ({' || '.join(machine_clauses)}) }}}}"
193193

194194
dst["jobs"][f"benchmark-{runner.name}"] = runner_template
@@ -211,15 +211,15 @@ def generate_benchmark(dst: Any) -> Any:
211211
"""
212212
Generates benchmark.yml from benchmark.src.yml.
213213
214-
Inserts the list of groups and available machines to the drop-down
214+
Inserts the list of tags and available machines to the drop-down
215215
presented to the user.
216216
"""
217217
available_runners = [r for r in runners.get_runners() if r.available]
218-
groups = sorted(
219-
set(f"group {g}" for r in available_runners if r.groups for g in r.groups)
218+
tags = sorted(
219+
set(f"tag {g}" for r in available_runners if r.tags for g in r.tags)
220220
)
221221
runner_choices = [
222-
*groups,
222+
*tags,
223223
*[x.name for x in available_runners],
224224
"all",
225225
"__really_all",

bench_runner/templates/benchmark.src.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
benchmarks: ${{ inputs.benchmarks }}
8181
pgo: true
8282
perf: false
83-
force: ${{ ! startsWith(inputs.machine, 'group ') }}
83+
force: false
8484
secrets: inherit
8585

8686
base:

0 commit comments

Comments
 (0)