Skip to content

Commit ac01de9

Browse files
authored
Merge pull request #367 from faster-cpython/reduce-all
Don't include all machines in "all"
2 parents 97dfb70 + f02a5f9 commit ac01de9

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

Diff for: README.md

+9-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ git push origin main
4444

4545
The `bench_runner.toml` file created at the root of your repository contains configuration specific to your instance.
4646
More details about this configuration are below.
47-
Every time you make a change to the `bench_runner.toml` file, you will need to rerun `python -m bench_runer install` to have the changes reflected.
47+
Every time you make a change to the `bench_runner.toml` file, you will need to rerun `python -m bench_runner install` to have the changes reflected.
4848

4949
### Add some self-hosted runners
5050

@@ -87,6 +87,12 @@ hostname = "cpython-benchmarking-azure"
8787
available = false
8888
```
8989

90+
If you don't want a machine to be included when the user selects "machine == 'all'", add:
91+
92+
```
93+
include_in_all = false
94+
```
95+
9096
### Try a benchmarking run
9197

9298
There are instructions for running a benchmarking action already in the `README.md` of your repo. Look there and give it a try!
@@ -144,7 +150,7 @@ python -m bench_runner purge
144150

145151
To see more options that control what is deleted, run `python -m bench_runner purge --help`.
146152

147-
After purging the results, you will usually want to squash the git history down to a single commit to save space in your repository. **NOTE THAT THIS IS A DESTRUCTIVE OPERATION THAT WILL DELETE OLD DATA.**
153+
After purging the results, you will usually want to squash the git history down to a single commit to save space in your repository. **NOTE THAT THIS IS A DESTRUCTIVE OPERATION THAT WILL DELETE OLD DATA.**
148154

149155
```
150156
git checkout --orphan new-main main
@@ -155,7 +161,7 @@ git branch -M new-main main
155161
git push -f origin main
156162
```
157163

158-
### Running
164+
### Running
159165

160166
## Developer
161167

Diff for: bench_runner/runners.py

+3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def __init__(
2020
# Override the Github self-hosted runner name if different from
2121
# os-arch-nickname
2222
github_runner_name: str | None,
23+
include_in_all: bool = True,
2324
):
2425
self.nickname = nickname
2526
self.os = os
@@ -30,6 +31,7 @@ def __init__(
3031
if github_runner_name is None:
3132
github_runner_name = self.name
3233
self.github_runner_name = github_runner_name
34+
self.include_in_all = include_in_all
3335

3436
@property
3537
def name(self) -> str:
@@ -54,6 +56,7 @@ def get_runners() -> list[Runner]:
5456
section.get("available", True),
5557
section.get("env", {}),
5658
section.get("github_runner_name"),
59+
section.get("include_in_all", True),
5760
)
5861
)
5962

Diff for: bench_runner/scripts/install.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,15 @@ def generate__benchmark(src: Any) -> Any:
147147
runner_template["steps"].insert(0, setup_environment)
148148

149149
runner_template["runs-on"].append(runner.github_runner_name)
150-
runner_template["if"] = (
151-
f"${{{{ (inputs.machine == '{runner.name}' || inputs.machine == 'all') }}}}"
152-
)
150+
151+
machine_clauses = [
152+
f"inputs.machine == '{runner.name}'",
153+
"inputs.machine == '__really_all'",
154+
]
155+
if runner.include_in_all:
156+
machine_clauses.append("inputs.machine == 'all'")
157+
runner_template["if"] = f"${{{{ ({' || '.join(machine_clauses)}) }}}}"
158+
153159
dst["jobs"][f"benchmark-{runner.name}"] = runner_template
154160

155161
add_flag_env(dst["jobs"])
@@ -174,7 +180,7 @@ def generate_benchmark(dst: Any) -> Any:
174180
user.
175181
"""
176182
available_runners = [r for r in runners.get_runners() if r.available]
177-
runner_choices = [*[x.name for x in available_runners], "all"]
183+
runner_choices = [*[x.name for x in available_runners], "all", "__really_all"]
178184

179185
dst["on"]["workflow_dispatch"]["inputs"]["machine"]["options"] = runner_choices
180186

Diff for: bench_runner/templates/_weekly.src.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
with:
3535
fork: python
3636
ref: ${{ needs.determine_head.outputs.commit }}
37-
machine: all
37+
machine: __really_all
3838
benchmarks: all_and_excluded
3939
pgo: true
4040
tier2: false
@@ -46,7 +46,7 @@ jobs:
4646
with:
4747
fork: python
4848
ref: ${{ needs.determine_head.outputs.commit }}
49-
machine: all
49+
machine: __really_all
5050
benchmarks: all_and_excluded
5151
pgo: true
5252
tier2: false
@@ -59,7 +59,7 @@ jobs:
5959
with:
6060
fork: python
6161
ref: ${{ needs.determine_head.outputs.commit }}
62-
machine: all
62+
machine: __really_all
6363
benchmarks: all_and_excluded
6464
pgo: true
6565
tier2: false
@@ -73,7 +73,7 @@ jobs:
7373
with:
7474
fork: python
7575
ref: ${{ needs.determine_head.outputs.commit }}
76-
machine: all
76+
machine: __really_all
7777
benchmarks: all_and_excluded
7878
pgo: true
7979
tier2: false

0 commit comments

Comments
 (0)