Skip to content

Conversation

@zmaalick
Copy link
Collaborator

@zmaalick zmaalick commented Jan 20, 2026

Closes #209 .

PR creation checklist for the developer

  • Has <issue_number> above ☝️ been replaced with the issue number?
  • Has main been selected as the base branch?
  • Does the feature branch name follow the format <issue_number>_<short_description_of_feature>?
  • Does the text of the PR title exactly match with the text (not including the issue number) of the issue title?
  • Have appropriate reviewers been added to the PR (once it is ready for review)?
  • Has the PR been assigned to the developer(s)?
  • Have the same labels as on the issue (except for the good first issue label) been added to the PR?
  • Has the Climate Model Evaluation Workflow (CMEW) project been added to the PR?
  • Has the appropriate milestone been added to the PR?

Definition of Done for the developer

  • Does the change in this PR address the above issue / have all acceptance criteria been met?
  • Does the change in this PR follow the requirements in the wiki: Developer Guide (including copyrights)?
  • Have new tests related to the change been added?
  • Do all the GitHub workflow checks pass?
  • Do all the tests run locally and pass? (Note: the tests are not run by the GitHub workflow, see wiki: Run the tests locally)
  • Has the API documentation (e.g. docstrings in Python modules) related to the change been updated appropriately?
  • Has the user documentation (i.e. everything in the doc directory) related to the change been updated appropriately, including the Quick Start section?
  • Do the HTML pages render correctly? (See wiki: Build the documentation locally)

PR creation checklist for the reviewer

  • Has <issue_number> above ☝️ been replaced with the issue number?
  • Has main been selected as the base branch?
  • Does the feature branch name follow the format <issue_number>_<short_description_of_feature>?
  • Does the text of the PR title exactly match with the text (not including the issue number) of the issue title?
  • Have appropriate reviewers been added to the PR (once it is ready for review)?
  • Has the PR been assigned to the developer(s)?
  • Have the same labels as on the issue (except for the good first issue label) been added to the PR?
  • Has the Climate Model Evaluation Workflow (CMEW) project been added to the PR?
  • Has the appropriate milestone been added to the PR?

Definition of Done for the reviewer

  • Does the change in this PR address the above issue / have all acceptance criteria been met?
  • Does the change in this PR follow the requirements in the wiki: Developer Guide (including copyrights)?
  • Have new tests related to the change been added?
  • Do all the GitHub workflow checks pass?
  • Do all the tests run locally and pass? (Note: the tests are not run by the GitHub workflow, see wiki: Run the tests locally)
  • Has the API documentation (e.g. docstrings in Python modules) related to the change been updated appropriately?
  • Has the user documentation (i.e. everything in the doc directory) related to the change been updated appropriately, including the Quick Start section?
  • Do the HTML pages render correctly? (See wiki: Build the documentation locally)

@zmaalick zmaalick self-assigned this Jan 20, 2026
@zmaalick zmaalick changed the title add a cfg file for default values Minimise duplication of the CDDS default request items Jan 20, 2026
@zmaalick zmaalick added enhancement New feature or request good first issue Good for newcomers technical debt Technical debt in CMEW standardise Anything related to CDDS quality assurance Anything related to Quality Assurance (QA) labels Jan 20, 2026
@zmaalick zmaalick added this to the v0.2.0 (multiple model runs) milestone Jan 20, 2026
@NParsonsMO NParsonsMO self-requested a review January 21, 2026 16:29
Copy link
Collaborator

@NParsonsMO NParsonsMO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The unit test for configure_standardise/bin/test_create_request_file.py::test_create_request fails.

I also think that the defaults file is not supposed to contain user-configurable variables.

mode=mkdir

[file:$CYLC_WORKFLOW_SHARE_DIR/etc/request_defaults.cfg]
source=${CYLC_WORKFLOW_RUN_DIR}/app/configure_standardise/etc/request_defaults.cfg
Copy link
Collaborator

@NParsonsMO NParsonsMO Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hoped on seeing this that it might be a way round the unit test failures that I encountered in PR #324, but unfortunately it isn't, and it has a very similar error itself.
When I run pytest myself, all the tests pass fine. But when I do cylc vip -O metoffice -O unittest, I get a file not found error for the file above, ending as below:

        cfg_path = base_dir / "etc" / "request_defaults.cfg"
        if not cfg_path.exists():
>           raise FileNotFoundError(f"Defaults file not found: {cfg_path}")
E           FileNotFoundError: Defaults file not found: [MY_DIR]/CMEW/run3/share/etc/request_defaults.cfg

configure_standardise/bin/create_request_file.py:25: FileNotFoundError

However here, the unit test also does not pass with the command cylc vip -O metoffice -O test (as opposed to unittest) either.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix the unittests: 7bcab81

# Running inside Cylc
base_dir = Path(os.environ["CYLC_WORKFLOW_SHARE_DIR"])
else:
# Running under pytest / unittest / local execution
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to catch everything, see comment on rose-app.conf

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it: 7bcab81

Copy link
Collaborator

@NParsonsMO NParsonsMO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are merge conflicts that need to be sorted,

image

and I assume that this needs to be pre-review (although I'm not sure it's come up yet)?

I've left two comments open to check those lines on merging with main.

All unit tests now passing in all methods.

One copyright change requested.

@@ -0,0 +1,44 @@
# (C) Crown Copyright 2022-2026, Met Office.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's only 2026, not 2022-2026.
The year of first publication of the specific file:
https://github.com/MetOffice/CMEW/wiki/Detailed-Working-Practices#coding-requirements

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't been addressed

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zmaalick zmaalick requested a review from NParsonsMO January 29, 2026 10:51
Copy link
Collaborator

@NParsonsMO NParsonsMO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One unit test is failing.

Two prior review comments have not been responded to.

@@ -0,0 +1,44 @@
# (C) Crown Copyright 2022-2026, Met Office.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hasn't been addressed

@zmaalick
Copy link
Collaborator Author

One unit test is failing.

Two prior review comments have not been responded to.

Fix the unittest: ca8d9a0

@zmaalick zmaalick requested a review from NParsonsMO January 30, 2026 09:01
@NParsonsMO NParsonsMO removed the good first issue Good for newcomers label Jan 30, 2026
Copy link
Collaborator

@NParsonsMO NParsonsMO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zmaalick!

Copy link
Collaborator

@alistairsellar alistairsellar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zmaalick!

Copy link
Member

@ehogan ehogan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @zmaalick 🥳

Comment on lines +10 to +11
[file:$CYLC_WORKFLOW_SHARE_DIR/etc/request_defaults.cfg]
source=${CYLC_WORKFLOW_RUN_DIR}/app/configure_standardise/etc/request_defaults.cfg
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to explain why making a copy of request_defaults.cfg is needed here? Is it not possible to access the contents directly from the original file? 🤔

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cylc runs workflows from a run directory, not the source tree. Copying request_defaults.cfg into share/etc makes the run self-contained, reproducible, and immune to source changes. Reading the original file directly would break provenance and reproducibility.

def load_expected_cfg() -> dict:
"""Load expected values from default_request.cfg into a dict."""
app_root = Path(__file__).resolve().parents[1]
cfg_path = app_root / "etc" / "request_defaults.cfg"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than hardcode the path to the request_defaults.cfg file here, would it be possible to create a global variable that defines the path, and use that instead, please?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 15 to 17
# 1. Explicit override (tests or power users)
if "REQUEST_DEFAULTS_CFG" in os.environ:
cfg_path = Path(os.environ["REQUEST_DEFAULTS_CFG"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, environment variables would not be used to control CMEW. I acknowledge that Cylc does this, but I find it makes debugging any issues difficult, so would prefer not to introduce more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zmaalick zmaalick requested a review from ehogan February 2, 2026 11:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request quality assurance Anything related to Quality Assurance (QA) standardise Anything related to CDDS technical debt Technical debt in CMEW

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minimise duplication of the CDDS default request items

5 participants