Skip to content

Commit e2e0fc8

Browse files
committed
Make weekly runs configurable
1 parent 8c8ff2d commit e2e0fc8

File tree

4 files changed

+72
-59
lines changed

4 files changed

+72
-59
lines changed

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,26 @@ PYTHON_CONFIGURE_FLAGS = '`"/p:PlatformToolset=clangcl`" `"/p:LLVMInstallDir=C:\
6363
Runners have a new configuration `use_cores` to control the number of CPU cores
6464
used to build CPython. By default, this will use all available cores, but some
6565
Cloud VMs require using fewer.
66+
67+
### Configurable weekly runs
68+
69+
The set of weekly runs are now configured from the `bench_runner.toml`.
70+
If you don't add any configuration, the only weekly runs performed will be default builds on every runner.
71+
72+
The `weekly` section in the configuration is made up of sections, each of which
73+
has a `flags` parameter specifying the flags to use and a `runner` parameter
74+
specifying the runners to run on.
75+
76+
For example:
77+
78+
```toml
79+
[[weekly]]
80+
81+
[weekly.default]
82+
flags = []
83+
runners = ["linux", "darwin", "windows"]
84+
85+
[weekly.tailcall]
86+
flags = ["TAILCALL"]
87+
runners = ["linux_clang", "darwin", "windows_clang"]
88+
```

bench_runner/flags.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,16 @@ def parse_flags(flag_str: str | None) -> list[str]:
3737

3838

3939
def flags_to_gha_variables(flags: list[str]) -> dict[str, str]:
40+
return {
41+
k: "true" if v else "false"
42+
for k, v in flags_to_gha_variables_yml(flags).items()
43+
}
44+
45+
46+
def flags_to_gha_variables_yml(flags: list[str]) -> dict[str, bool]:
4047
output = {}
4148
for flag_descr in FLAGS:
42-
if flag_descr.name in flags:
43-
output[flag_descr.gha_variable] = "true"
44-
else:
45-
output[flag_descr.gha_variable] = "false"
49+
output[flag_descr.gha_variable] = flag_descr.name in flags
4650
return output
4751

4852

bench_runner/scripts/install.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,45 @@ def generate__notify(dst: Any) -> Any:
226226
return dst
227227

228228

229+
def generate__weekly(dst: Any) -> Any:
230+
cfg = config.get_bench_runner_config()
231+
232+
weekly = cfg.get("weekly", {})
233+
if not weekly:
234+
weekly = [{"default": {"flags": [], "runners": cfg.get("runners", {}).keys()}}]
235+
weekly = weekly[0]
236+
237+
all_jobs = []
238+
239+
for name, weekly_cfg in weekly.items():
240+
for runner_nickname in weekly_cfg.get("runners", []):
241+
runner = runners.get_runner_by_nickname(runner_nickname)
242+
if runner.nickname == "unknown":
243+
raise ValueError(
244+
f"Runner {runner_nickname} not found in bench_runner.toml"
245+
)
246+
weekly_flags = weekly_cfg.get("flags", [])
247+
job = {
248+
"uses": "./.github/workflows/_benchmark.yml",
249+
"needs": "determine_head",
250+
"with": {
251+
"fork": "python",
252+
"ref": "${{ needs.determine_head.outputs.commit }}",
253+
"machine": runner.name,
254+
"benchmarks": "all_and_excluded",
255+
**flags.flags_to_gha_variables_yml(weekly_flags),
256+
},
257+
"secrets": "inherit",
258+
}
259+
job_name = f"weekly-{name}-{runner.nickname}"
260+
dst["jobs"][job_name] = job
261+
all_jobs.append(job_name)
262+
263+
dst["jobs"]["generate"]["needs"].extend(all_jobs)
264+
265+
return dst
266+
267+
229268
def generate_generic(dst: Any) -> Any:
230269
return dst
231270

@@ -235,6 +274,7 @@ def generate_generic(dst: Any) -> Any:
235274
"_benchmark.src.yml": generate__benchmark,
236275
"_pystats.src.yml": generate__pystats,
237276
"_notify.src.yml": generate__notify,
277+
"_weekly.src.yml": generate__weekly,
238278
}
239279

240280

bench_runner/templates/_weekly.src.yml

Lines changed: 1 addition & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -28,60 +28,6 @@ jobs:
2828
cd cpython
2929
git log -n 1 --format="commit=%H" >> $GITHUB_OUTPUT
3030
31-
weekly:
32-
uses: ./.github/workflows/_benchmark.yml
33-
needs: determine_head
34-
with:
35-
fork: python
36-
ref: ${{ needs.determine_head.outputs.commit }}
37-
machine: __really_all
38-
benchmarks: all_and_excluded
39-
pgo: true
40-
tier2: false
41-
secrets: inherit
42-
43-
weekly-jit:
44-
uses: ./.github/workflows/_benchmark.yml
45-
needs: determine_head
46-
with:
47-
fork: python
48-
ref: ${{ needs.determine_head.outputs.commit }}
49-
machine: __really_all
50-
benchmarks: all_and_excluded
51-
pgo: true
52-
tier2: false
53-
jit: true
54-
secrets: inherit
55-
56-
weekly-nogil:
57-
uses: ./.github/workflows/_benchmark.yml
58-
needs: determine_head
59-
with:
60-
fork: python
61-
ref: ${{ needs.determine_head.outputs.commit }}
62-
machine: __really_all
63-
benchmarks: all_and_excluded
64-
pgo: true
65-
tier2: false
66-
jit: false
67-
nogil: true
68-
secrets: inherit
69-
70-
weekly-tailcall:
71-
uses: ./.github/workflows/_benchmark.yml
72-
needs: determine_head
73-
with:
74-
fork: python
75-
ref: ${{ needs.determine_head.outputs.commit }}
76-
machine: __really_all
77-
benchmarks: all_and_excluded
78-
pgo: true
79-
tier2: false
80-
jit: false
81-
nogil: false
82-
tailcall: true
83-
secrets: inherit
84-
8531
pystats:
8632
uses: ./.github/workflows/_pystats.yml
8733
needs: determine_head
@@ -109,7 +55,7 @@ jobs:
10955
if: ${{ always() }}
11056
with:
11157
force: false
112-
needs: [weekly, weekly-jit, weekly-nogil, pystats, pystats-tier2]
58+
needs: [pystats, pystats-tier2]
11359
secrets: inherit
11460

11561
publish:

0 commit comments

Comments
 (0)