Skip to content

Commit cdfe56f

Browse files
committed
Merge branch 'geo-bridge' of github.com:HGWright/iris into geo-bridge
* 'geo-bridge' of github.com:HGWright/iris: (41 commits) Updated lock files. [pre-commit.ci] auto fixes from pre-commit.com hooks Advertise structured_um_loading performance regression. [pre-commit.ci] pre-commit autoupdate Updated environment lockfiles [pre-commit.ci] auto fixes from pre-commit.com hooks [pre-commit.ci] pre-commit autoupdate Make the bugfix panel OPEN. What's New patch. What's New patch. Bump scitools/workflows from 2024.03.1 to 2024.03.3 Bump scitools/workflows from 2024.03.0 to 2024.03.1 Bump scitools/workflows from 2024.02.2 to 2024.03.0 Fix usage of map_blocks in AreaWeighted and elsewhere (SciTools#5767) Lazy rolling_window (SciTools#5775) whatsnew update for 3.8.0 (SciTools#5793) Bump scitools/workflows from 2024.02.1 to 2024.02.2 (SciTools#5792) DOCS: Add whatsnew for recent PRs (SciTools#5789) ASV custom build command and file-based benchmark triggers (SciTools#5776) DOCS: Enable numpydoc validation pre-commit hook (SciTools#5762) ...
2 parents eed0380 + 36c55f4 commit cdfe56f

File tree

204 files changed

+4012
-2620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+4012
-2620
lines changed

.github/labeler.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# benchmark_this automatically triggers the benchmark workflow when added by
2+
# a user. No triggering happens when GitHub Actions adds the label (this
3+
# avoids security vulnerabilities), so alternative triggers for the below
4+
# files are therefore included in workflows/benchmarks_run.yml. Automatic
5+
# labelling is still included here to make it easier to search pull requests,
6+
# and to reinforce the culture of using this label.
7+
benchmark_this:
8+
- changed-files:
9+
- any-glob-to-any-file: ['requirements/locks/*.lock', "setup.py"]

.github/pull_request_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,8 @@
77

88
---
99
[Consult Iris pull request check list]( https://scitools-iris.readthedocs.io/en/latest/developers_guide/contributing_pull_request_checklist.html)
10+
11+
---
12+
Add any of the below labels to trigger actions on this PR:
13+
14+
- https://github.com/SciTools/iris/labels/benchmark_this

.github/workflows/benchmarks_run.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,46 @@ on:
1616
required: false
1717
type: string
1818
pull_request:
19-
types: [labeled]
19+
# Add the `labeled` type to the default list.
20+
types: [labeled, opened, synchronize, reopened]
2021

2122
jobs:
23+
pre-checks:
24+
runs-on: ubuntu-latest
25+
if: github.repository == 'SciTools/iris'
26+
outputs:
27+
overnight: ${{ steps.overnight.outputs.check }}
28+
branch: ${{ steps.branch.outputs.check }}
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 2
33+
- id: files-changed
34+
uses: marceloprado/has-changed-path@df1b7a3161b8fb9fd8c90403c66a9e66dfde50cb
35+
with:
36+
# SEE ALSO .github/labeler.yml .
37+
paths: requirements/locks/*.lock setup.py
38+
- id: overnight
39+
if: github.event_name != 'pull_request'
40+
run: echo "check=true" >> "$GITHUB_OUTPUT"
41+
- id: branch
42+
if: >
43+
github.event_name == 'pull_request'
44+
&&
45+
(
46+
steps.files-changed.outputs.changed == 'true'
47+
||
48+
github.event.label.name == 'benchmark_this'
49+
)
50+
run: echo "check=true" >> "$GITHUB_OUTPUT"
51+
52+
2253
benchmark:
23-
if: >
24-
github.repository == 'SciTools/iris' &&
25-
(github.event_name != 'pull_request' ||
26-
github.event.label.name == 'benchmark_this')
2754
runs-on: ubuntu-latest
55+
needs: pre-checks
56+
if: >
57+
needs.pre-checks.outputs.overnight == 'true' ||
58+
needs.pre-checks.outputs.branch == 'true'
2859
2960
env:
3061
IRIS_TEST_DATA_LOC_PATH: benchmarks
@@ -76,7 +107,7 @@ jobs:
76107
echo "OVERRIDE_TEST_DATA_REPOSITORY=${GITHUB_WORKSPACE}/${IRIS_TEST_DATA_PATH}/test_data" >> $GITHUB_ENV
77108
78109
- name: Benchmark this pull request
79-
if: ${{ github.event.label.name == 'benchmark_this' }}
110+
if: needs.pre-checks.outputs.branch == 'true'
80111
env:
81112
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82113
PR_NUMBER: ${{ github.event.number }}
@@ -85,7 +116,7 @@ jobs:
85116
86117
- name: Run overnight benchmarks
87118
id: overnight
88-
if: ${{ github.event_name != 'pull_request' }}
119+
if: needs.pre-checks.outputs.overnight == 'true'
89120
env:
90121
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91122
run: |

.github/workflows/ci-manifest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ concurrency:
2323
jobs:
2424
manifest:
2525
name: "check-manifest"
26-
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.02.0
26+
uses: scitools/workflows/.github/workflows/ci-manifest.yml@2024.03.3

.github/workflows/labeler.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Reference
2+
# - https://github.com/actions/labeler
3+
4+
name: "Pull Request Labeler"
5+
on:
6+
- pull_request_target
7+
8+
jobs:
9+
labeler:
10+
permissions:
11+
contents: read
12+
pull-requests: write
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/labeler@v5

.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@2024.02.0
17+
uses: scitools/workflows/.github/workflows/refresh-lockfiles.yml@2024.03.3
1818
secrets: inherit

.pre-commit-config.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ repos:
2929
- id: no-commit-to-branch
3030

3131
- repo: https://github.com/astral-sh/ruff-pre-commit
32-
rev: "v0.2.1"
32+
rev: "v0.3.4"
3333
hooks:
3434
- id: ruff
3535
types: [file, python]
@@ -61,3 +61,10 @@ repos:
6161
hooks:
6262
- id: sort-all
6363
types: [file, python]
64+
65+
- repo: https://github.com/numpy/numpydoc
66+
rev: v1.7.0rc0
67+
hooks:
68+
- id: numpydoc-validation
69+
exclude: "^lib/iris/tests/|docs/gallery_code/"
70+
types: [file, python]

benchmarks/asv.conf.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"environment_type": "conda-delegated",
77
"show_commit_url": "https://github.com/scitools/iris/commit/",
88
"branches": ["upstream/main"],
9+
"build_command": [
10+
"python setup.py build",
11+
"python -mpip wheel --no-deps -w {build_cache_dir} {build_dir}"
12+
],
913

1014
"benchmark_dir": "./benchmarks",
1115
"env_dir": ".asv/env",

benchmarks/asv_delegated_conda.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,17 +47,15 @@ def __init__(
4747
4848
Parameters
4949
----------
50-
conf : Config instance
51-
50+
conf : Config
51+
Config instance.
5252
python : str
5353
Version of Python. Must be of the form "MAJOR.MINOR".
54-
5554
requirements : dict
5655
Dictionary mapping a PyPI package name to a version
5756
identifier string.
58-
5957
tagged_env_vars : dict
60-
Environment variables, tagged for build vs. non-build
58+
Environment variables, tagged for build vs. non-build.
6159
6260
"""
6361
ignored = ["`python`"]

benchmarks/benchmarks/__init__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,20 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Common code for benchmarks."""
6+
67
from os import environ
78
import resource
89

910
ARTIFICIAL_DIM_SIZE = int(10e3) # For all artificial cubes, coords etc.
1011

1112

1213
def disable_repeat_between_setup(benchmark_object):
13-
"""Benchmarks where object persistence would be inappropriate (decorator).
14+
"""Benchmark where object persistence would be inappropriate (decorator).
1415
1516
E.g:
16-
* Benchmarking data realisation
17-
* Benchmarking Cube coord addition
17+
18+
* Benchmarking data realisation
19+
* Benchmarking Cube coord addition
1820
1921
Can be applied to benchmark classes/methods/functions.
2022
@@ -107,14 +109,15 @@ def _wrapper(*args, **kwargs):
107109

108110

109111
def on_demand_benchmark(benchmark_object):
110-
"""Disables these benchmark(s) unless ON_DEMAND_BENCHARKS env var is set.
112+
"""Disable these benchmark(s) unless ON_DEMAND_BENCHARKS env var is set.
111113
112114
This is a decorator.
113115
114116
For benchmarks that, for whatever reason, should not be run by default.
115117
E.g:
116-
* Require a local file
117-
* Used for scalability analysis instead of commit monitoring.
118+
119+
* Require a local file
120+
* Used for scalability analysis instead of commit monitoring.
118121
119122
Can be applied to benchmark classes/methods/functions.
120123

benchmarks/benchmarks/cperf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Files available from the UK Met Office:
1010
moo ls moose:/adhoc/projects/avd/asv/data_for_nightly_tests/
1111
"""
12+
1213
import numpy as np
1314

1415
from iris import load_cube

benchmarks/benchmarks/cperf/equality.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Equality benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
from .. import on_demand_benchmark
78
from . import SingleDiagnosticMixin
89

benchmarks/benchmarks/cperf/load.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""File loading benchmarks for the CPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
from .. import on_demand_benchmark
78
from . import SingleDiagnosticMixin
89

benchmarks/benchmarks/experimental/ugrid/regions_combine.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
run-time that scale with data size.
1717
1818
"""
19+
1920
import os
2021

2122
import dask.array as da
@@ -92,7 +93,7 @@ def setup_cache(self):
9293
)
9394

9495
def setup(self, n_cubesphere, imaginary_data=True, create_result_cube=True):
95-
"""Combine-tests "standard" setup operation.
96+
"""Combine tests "standard" setup operation.
9697
9798
Load the source cubes (full-mesh + region) from disk.
9899
These are specific to the cubesize parameter.

benchmarks/benchmarks/generate_data/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
benchmark sequence runs over two different Python versions.
1515
1616
"""
17+
1718
from contextlib import contextmanager
1819
from inspect import getsource
1920
from os import environ

benchmarks/benchmarks/generate_data/ugrid.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Scripts for generating supporting data for UGRID-related benchmarking."""
6+
67
from iris import load_cube as iris_loadcube
78
from iris.experimental.ugrid import PARSE_UGRID_ON_LOAD
89

benchmarks/benchmarks/import_iris.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55

6-
"""import iris benchmarking."""
6+
"""Import iris benchmarking."""
77

88
from importlib import import_module, reload
99

benchmarks/benchmarks/iterate.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Iterate benchmark tests."""
6+
67
import numpy as np
78

89
from iris import coords, cube, iterate

benchmarks/benchmarks/load/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class ManyVars:
112112

113113
@staticmethod
114114
def _create_file(save_path: str) -> None:
115-
"""Is run externally - everything must be self-contained."""
115+
"""Run externally - everything must be self-contained."""
116116
import numpy as np
117117

118118
from iris import save

benchmarks/benchmarks/metadata_manager_factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
5-
"""metadata_manager_factory benchmark tests."""
5+
"""Metadata manager factory benchmark tests."""
66

77
from iris.common import (
88
AncillaryVariableMetadata,

benchmarks/benchmarks/plot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Plot benchmark tests."""
6+
67
import matplotlib as mpl
78
import numpy as np
89

benchmarks/benchmarks/save.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
run-time that scale with data size.
1212
1313
"""
14+
1415
from iris import save
1516
from iris.experimental.ugrid import save_mesh
1617

benchmarks/benchmarks/sperf/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
SPerf = assessing performance against a series of increasingly large LFRic
88
datasets.
99
"""
10+
1011
from iris import load_cube
1112

1213
# TODO: remove uses of PARSE_UGRID_ON_LOAD once UGRID parsing is core behaviour.

benchmarks/benchmarks/sperf/combine_regions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Region combine benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
import os.path
78

89
from dask import array as da
@@ -83,7 +84,7 @@ def setup_cache(self):
8384
)
8485

8586
def setup(self, n_cubesphere, imaginary_data=True, create_result_cube=True):
86-
"""Combine-tests "standard" setup operation.
87+
"""Combine tests "standard" setup operation.
8788
8889
Load the source cubes (full-mesh + region) from disk.
8990
These are specific to the cubesize parameter.

benchmarks/benchmarks/sperf/equality.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""Equality benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
from .. import on_demand_benchmark
78
from . import FileMixin
89

benchmarks/benchmarks/sperf/load.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""File loading benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
from .. import on_demand_benchmark
78
from . import FileMixin
89

benchmarks/benchmarks/sperf/save.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# This file is part of Iris and is released under the BSD license.
44
# See LICENSE in the root of the repository for full licensing details.
55
"""File saving benchmarks for the SPerf scheme of the UK Met Office's NG-VAT project."""
6+
67
import os.path
78

89
from iris import save

benchmarks/bm_runner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def _check_requirements(package: str) -> None:
6666

6767

6868
def _prep_data_gen_env() -> None:
69-
"""Create/access a separate, unchanging environment for generating test data."""
69+
"""Create or access a separate, unchanging environment for generating test data."""
7070
python_version = "3.11"
7171
data_gen_var = "DATA_GEN_PYTHON"
7272
if data_gen_var in environ:
@@ -171,7 +171,7 @@ def _gh_create_reports(commit_sha: str, results_full: str, results_shifts: str)
171171
performance_report = dedent(
172172
(
173173
"""
174-
### Performance Benchmark Report: {commit_sha}
174+
# :stopwatch: Performance Benchmark Report: {commit_sha}
175175
176176
<details>
177177
<summary>Performance shifts</summary>

0 commit comments

Comments
 (0)