Skip to content

Commit

Permalink
Merge branch 'main' of github.com:SciTools/iris into cf_cell_method
Browse files Browse the repository at this point in the history
* '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)
  • Loading branch information
HGWright committed Mar 31, 2023
2 parents 595bda3 + b8f5eea commit 8e47e93
Show file tree
Hide file tree
Showing 13 changed files with 500 additions and 260 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ jobs:
# Lets us manually bump the cache to rebuild
ENV_CACHE_BUILD: "0"
TEST_DATA_CACHE_BUILD: "2"
PY_VER: 3.8

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

- name: Install Nox
- name: Install ASV & Nox
run: |
pip install nox
pip install asv nox
- name: Cache environment directories
id: cache-env-dir
Expand Down Expand Up @@ -78,7 +77,7 @@ jobs:
if [ "$first_commit" != "" ]
then
nox --session="benchmarks(overnight)" -- $first_commit
python benchmarks/bm_runner.py overnight $first_commit
fi
- name: Create issues for performance shifts
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ jobs:
- name: "nox cache"
uses: ./.github/workflows/composite/nox-cache
with:
cache_build: 0
cache_build: 1
env_name: ${{ env.ENV_NAME }}
lock_file: ${{ env.LOCK_FILE }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci-wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ jobs:
name: "publish to test.pypi"
runs-on: ubuntu-latest
# upload to Test PyPI for every commit on main branch
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main'
# and check for the SciTools repo
if: github.event_name == 'push' && github.event.ref == 'refs/heads/main' && github.repository-owner == 'SciTools'
steps:
- uses: actions/download-artifact@v3
with:
Expand All @@ -152,7 +153,7 @@ jobs:
name: "publish to pypi"
runs-on: ubuntu-latest
# upload to PyPI for every tag starting with 'v'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') && github.repository-owner == 'SciTools'
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/refresh-lockfiles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ on:

jobs:
refresh_lockfiles:
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@main
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2023.03.2
secrets: inherit
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
lockfiles:
python tools/update_lockfiles.py -o requirements/ci/nox.lock requirements/ci/py*.yml
python tools/update_lockfiles.py -o requirements/locks requirements/py*.yml
23 changes: 17 additions & 6 deletions benchmarks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,20 @@ shifts in performance being flagged in a new GitHub issue.
installed, as well as Nox (see
[Benchmark environments](#benchmark-environments)).

[Iris' noxfile](../noxfile.py) includes a `benchmarks` session that provides
conveniences for setting up before benchmarking, and can also replicate the
automated overnight run locally. See the session docstring for detail.
The benchmark runner ([bm_runner.py](./bm_runner.py)) provides conveniences for
common benchmark setup and run tasks, including replicating the automated
overnight run locally. See `python bm_runner.py --help` for detail.

A significant portion of benchmark run time is environment management. Run-time
can be reduced by placing the benchmark environment on the same file system as
your
[Conda package cache](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-pkg-directories),
if it is not already. You can achieve this by either:

- Temporarily reconfiguring `delegated_env_commands` and `delegated_env_parent`
in [asv.conf.json](asv.conf.json) to reference a location on the same file
system as the Conda package cache.
- Moving your Iris repo to the same file system as the Conda package cache.

### Environment variables

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

## Writing benchmarks

Expand Down
3 changes: 1 addition & 2 deletions benchmarks/asv.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
// * No build-time environment variables.
// * Is run in the same environment as the ASV install itself.
"delegated_env_commands": [
"sed -i 's/_PY_VERSIONS_ALL/_PY_VERSION_LATEST/g' noxfile.py",
"nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
"PY_VER=3.10 nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
],
// The parent directory of the above environment.
// The most recently modified environment in the directory will be used.
Expand Down

0 comments on commit 8e47e93

Please sign in to comment.