Skip to content

Commit 8e47e93

Browse files
committed
Merge branch 'main' of github.com:SciTools/iris into cf_cell_method
* 'main' of github.com:SciTools/iris: Benchmark runner script (SciTools#5215) add locks readme (SciTools#5222) use explicit version for ci refresh-lockfiles gha (SciTools#5221) SciTools#5180 do not run publish-to-test-pypi on forks (SciTools#5220) Fix Makefile for consequences of SciTools#5204. (SciTools#5217)
2 parents 595bda3 + b8f5eea commit 8e47e93

File tree

13 files changed

+500
-260
lines changed

13 files changed

+500
-260
lines changed

.github/workflows/benchmark.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,16 @@ jobs:
2525
# Lets us manually bump the cache to rebuild
2626
ENV_CACHE_BUILD: "0"
2727
TEST_DATA_CACHE_BUILD: "2"
28-
PY_VER: 3.8
2928

3029
steps:
3130
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
3231
- uses: actions/checkout@v3
3332
with:
3433
fetch-depth: 0
3534

36-
- name: Install Nox
35+
- name: Install ASV & Nox
3736
run: |
38-
pip install nox
37+
pip install asv nox
3938
4039
- name: Cache environment directories
4140
id: cache-env-dir
@@ -78,7 +77,7 @@ jobs:
7877
7978
if [ "$first_commit" != "" ]
8079
then
81-
nox --session="benchmarks(overnight)" -- $first_commit
80+
python benchmarks/bm_runner.py overnight $first_commit
8281
fi
8382
8483
- name: Create issues for performance shifts

.github/workflows/ci-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ jobs:
111111
- name: "nox cache"
112112
uses: ./.github/workflows/composite/nox-cache
113113
with:
114-
cache_build: 0
114+
cache_build: 1
115115
env_name: ${{ env.ENV_NAME }}
116116
lock_file: ${{ env.LOCK_FILE }}
117117

.github/workflows/ci-wheels.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ jobs:
132132
name: "publish to test.pypi"
133133
runs-on: ubuntu-latest
134134
# upload to Test PyPI for every commit on main branch
135-
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
135+
# and check for the SciTools repo
136+
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository-owner == 'SciTools'
136137
steps:
137138
- uses: actions/download-artifact@v3
138139
with:
@@ -152,7 +153,7 @@ jobs:
152153
name: "publish to pypi"
153154
runs-on: ubuntu-latest
154155
# upload to PyPI for every tag starting with 'v'
155-
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
156+
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && github.repository-owner == 'SciTools'
156157
steps:
157158
- uses: actions/download-artifact@v3
158159
with:

.github/workflows/refresh-lockfiles.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ on:
1414

1515
jobs:
1616
refresh_lockfiles:
17-
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@main
17+
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.03.2
1818
secrets: inherit

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
lockfiles:
2-
python tools/update_lockfiles.py -o requirements/ci/nox.lock requirements/ci/py*.yml
2+
python tools/update_lockfiles.py -o requirements/locks requirements/py*.yml

benchmarks/README.md

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ shifts in performance being flagged in a new GitHub issue.
1515
installed, as well as Nox (see
1616
[Benchmark environments](#benchmark-environments)).
1717

18-
[Iris' noxfile](../noxfile.py) includes a `benchmarks` session that provides
19-
conveniences for setting up before benchmarking, and can also replicate the
20-
automated overnight run locally. See the session docstring for detail.
18+
The benchmark runner ([bm_runner.py](./bm_runner.py)) provides conveniences for
19+
common benchmark setup and run tasks, including replicating the automated
20+
overnight run locally. See `python bm_runner.py --help` for detail.
21+
22+
A significant portion of benchmark run time is environment management. Run-time
23+
can be reduced by placing the benchmark environment on the same file system as
24+
your
25+
[Conda package cache](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-pkg-directories),
26+
if it is not already. You can achieve this by either:
27+
28+
- Temporarily reconfiguring `delegated_env_commands` and `delegated_env_parent`
29+
in [asv.conf.json](asv.conf.json) to reference a location on the same file
30+
system as the Conda package cache.
31+
- Moving your Iris repo to the same file system as the Conda package cache.
2132

2233
### Environment variables
2334

@@ -26,8 +37,8 @@ automated overnight run locally. See the session docstring for detail.
2637
benchmark scripts.
2738
* `DATA_GEN_PYTHON` - required - path to a Python executable that can be
2839
used to generate benchmark test objects/files; see
29-
[Data generation](#data-generation). The Nox session sets this automatically,
30-
but will defer to any value already set in the shell.
40+
[Data generation](#data-generation). The benchmark runner sets this
41+
automatically, but will defer to any value already set in the shell.
3142
* `BENCHMARK_DATA` - optional - path to a directory for benchmark synthetic
3243
test data, which the benchmark scripts will create if it doesn't already
3344
exist. Defaults to `<root>/benchmarks/.data/` if not set. Note that some of
@@ -36,7 +47,7 @@ plan accordingly.
3647
* `ON_DEMAND_BENCHMARKS` - optional - when set (to any value): benchmarks
3748
decorated with `@on_demand_benchmark` are included in the ASV run. Usually
3849
coupled with the ASV `--bench` argument to only run the benchmark(s) of
39-
interest. Is set during the Nox `cperf` and `sperf` sessions.
50+
interest. Is set during the benchmark runner `cperf` and `sperf` sub-commands.
4051

4152
## Writing benchmarks
4253

benchmarks/asv.conf.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
// * No build-time environment variables.
2020
// * Is run in the same environment as the ASV install itself.
2121
"delegated_env_commands": [
22-
"sed -i 's/_PY_VERSIONS_ALL/_PY_VERSION_LATEST/g' noxfile.py",
23-
"nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
22+
"PY_VER=3.10 nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
2423
],
2524
// The parent directory of the above environment.
2625
// The most recently modified environment in the directory will be used.

0 commit comments

Comments
 (0)