Skip to content

Commit 1a73e84

Browse files
authored
Replace DelegatedConda with Delegated (#5963)
* Replace DelegatedConda with Delegated. * Final tweaks. * Module docstring. * Rename. * Disable build_command. * What's New entry. * Corrected comment. * Clearer JSON config comment. * MyPy compliance. * Better what's new entry. * Safe type hinting.
1 parent 7d6a3f6 commit 1a73e84

File tree

6 files changed

+424
-228
lines changed

6 files changed

+424
-228
lines changed

benchmarks/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ your
3434
[Conda package cache](https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#specify-pkg-directories),
3535
if it is not already. You can achieve this by either:
3636

37-
- Temporarily reconfiguring `delegated_env_commands` and `delegated_env_parent`
37+
- Temporarily reconfiguring `ENV_PARENT` in `delegated_env_commands`
3838
in [asv.conf.json](asv.conf.json) to reference a location on the same file
3939
system as the Conda package cache.
40+
- Using an alternative Conda package cache location during the benchmark run,
41+
e.g. via the `$CONDA_PKGS_DIRS` environment variable.
4042
- Moving your Iris repo to the same file system as the Conda package cache.
4143

4244
### Environment variables
@@ -63,6 +65,15 @@ plan accordingly.
6365
decorated with `@on_demand_benchmark` are included in the ASV run. Usually
6466
coupled with the ASV `--bench` argument to only run the benchmark(s) of
6567
interest. Is set during the benchmark runner `cperf` and `sperf` sub-commands.
68+
* `ASV_COMMIT_ENVS` - optional - instruct the
69+
[delegated environment management](#benchmark-environments) to create a
70+
dedicated environment for each commit being benchmarked when set (to any
71+
value). This means that benchmarking commits with different environment
72+
requirements will not be delayed by repeated environment setup - especially
73+
relevant given the [benchmark runner](bm_runner.py)'s use of
74+
[--interleave-rounds](https://asv.readthedocs.io/en/stable/commands.html?highlight=interleave-rounds#asv-run),
75+
or any time you know you will repeatedly benchmark the same commit. **NOTE:**
76+
Iris environments are large so this option can consume a lot of disk space.
6677

6778
## Writing benchmarks
6879

benchmarks/asv.conf.json

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,59 @@
33
"project": "scitools-iris",
44
"project_url": "https://github.com/SciTools/iris",
55
"repo": "..",
6-
"environment_type": "conda-delegated",
6+
"environment_type": "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-
],
139

1410
"benchmark_dir": "./benchmarks",
1511
"env_dir": ".asv/env",
1612
"results_dir": ".asv/results",
1713
"html_dir": ".asv/html",
18-
"plugins": [".asv_delegated_conda"],
14+
"plugins": [".asv_delegated"],
15+
16+
"delegated_env_commands_comment": [
17+
"The command(s) that create/update an environment correctly for the",
18+
"checked-out commit. Command(s) format follows `build_command`:",
19+
" https://asv.readthedocs.io/en/stable/asv.conf.json.html#build-command-install-command-uninstall-command",
20+
21+
"The commit key indicates the earliest commit where the command(s)",
22+
"will work.",
23+
24+
"Differences from `build_command`:",
25+
" * See: https://asv.readthedocs.io/en/stable/asv.conf.json.html#build-command-install-command-uninstall-command",
26+
" * Env vars limited to those set outside build time.",
27+
" (e.g. `{conf_dir}` available but `{build_dir}` not)",
28+
" * Run in the same environment as the ASV install itself.",
29+
30+
"Mandatory format for the first 'command' within each commit:",
31+
" * `ENV_PARENT=path/to/parent/directory/of/env-directory`",
32+
" * Can contain env vars (e.g. `{conf_dir}`)",
33+
" * `ENV_PARENT` available as `{env_parent}` in subsequent commands",
34+
" * The environment will be detected as the most recently updated",
35+
" environment in `{env_parent}`."
36+
37+
],
38+
"delegated_env_commands": {
39+
"c8a663a0": [
40+
"ENV_PARENT={conf_dir}/.asv/env/nox312",
41+
"PY_VER=3.12 nox --envdir={env_parent} --session=tests --install-only --no-error-on-external-run --verbose"
42+
],
43+
"d58fca7e": [
44+
"ENV_PARENT={conf_dir}/.asv/env/nox311",
45+
"PY_VER=3.11 nox --envdir={env_parent} --session=tests --install-only --no-error-on-external-run --verbose"
46+
],
47+
"44fae030": [
48+
"ENV_PARENT={conf_dir}/.asv/env/nox310",
49+
"PY_VER=3.10 nox --envdir={env_parent} --session=tests --install-only --no-error-on-external-run --verbose"
50+
]
51+
},
1952

20-
// The command(s) that create/update an environment correctly for the
21-
// checked-out commit.
22-
// Interpreted the same as build_command, with following exceptions:
23-
// * No build-time environment variables.
24-
// * Is run in the same environment as the ASV install itself.
25-
"delegated_env_commands": [
26-
"PY_VER=3.12 nox --envdir={conf_dir}/.asv/env/nox01 --session=tests --install-only --no-error-on-external-run --verbose"
53+
"command_comment": [
54+
"We know that the Nox command takes care of installation in each",
55+
"environment, and in the case of Iris no specialised uninstall or",
56+
"build commands are needed to get it working."
2757
],
28-
// The parent directory of the above environment.
29-
// The most recently modified environment in the directory will be used.
30-
"delegated_env_parent": "{conf_dir}/.asv/env/nox01"
58+
"install_command": [],
59+
"uninstall_command": [],
60+
"build_command": []
3161
}

0 commit comments

Comments
 (0)