-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Apps macro wps #261
Apps macro wps #261
Changes from 10 commits
8af8b00
74e564d
23d1df8
2d841c1
7adf006
c176dbd
a67415b
8ab494b
6ffa5a3
d9f54c8
42bf87b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,6 +166,16 @@ then you will need to upgrade the test-suite. | |
where `vnX.Y_tZZZZ` is the `AFTER_TAG` of the latest upgrade macro. | ||
The upgrade is expected to fail for the `fab_jules`, `metadata_checker` and `umdp3_checker` apps. | ||
|
||
.. tab-item:: LFRic Apps + Core | ||
|
||
.. code-block:: RST | ||
|
||
apply_macros.py vnX.Y_tZZZZ [--apps=/path/to/apps] [--core=/path/to/core] [--jules=/path/to/jules] | ||
|
||
where `vnX.Y_tZZZZ` is the `AFTER_TAG` of the latest upgrade macro and the others are paths to the relevant sources. Apps defaults to the current location. Core and Jules default to reading the `dependencies.sh` file in the Apps source. A copy of `apply_macros.py` is available at `$UMDIR/SimSys_Scripts/lfric_macros`. | ||
|
||
All tickets with Core macros are expected to be linked with Apps. Certain tickets with just Core metadata changes may not have required an Apps branch (although an Apps ticket should be provided). This is fine - just checkout the trunk but there is nothing to merge. The apply_macros script will sort the sharing of the upgrade macro added. | ||
|
||
.. dropdown:: New rose-stem app? | ||
|
||
If the ticket introduces a new rose-stem app, but doesn't otherwise have a macro | ||
|
@@ -191,11 +201,12 @@ then you will need to upgrade the test-suite. | |
rose macro --validate -M path/to/working_copy/rose-meta | ||
|
||
.. note:: | ||
For UM tickets, if there are linked `jules-shared | ||
<https://code.metoffice.gov.uk/trac/jules/browser/main/trunk/rose-meta/jules-shared>`_ | ||
metadata changes these will need to be added to the metadata | ||
path. Please see the :ref:`rose config-edit | ||
example<metadata_changes>`. | ||
|
||
LFRic Apps tickets will require an LFRic Core source to use. You can do this by checking out an appropriate working copy, and exporting the environment variable `ROSE_META_PATH=/path/to/core`. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm guessing theres no chance of pointing ROSE_META_PATH at an fcm link? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, don't think so. Fortunately, a new app is probably quite a rare happening. |
||
For UM tickets, if there are linked `jules-shared | ||
<https://code.metoffice.gov.uk/trac/jules/browser/main/trunk/rose-meta/jules-shared>`_ | ||
metadata changes then a suitable Jules source will need to be included in the `ROSE_META_PATH` as described above. | ||
|
||
|
||
.. dropdown:: Temporary Logical? | ||
|
@@ -492,7 +503,6 @@ Supporting data is stored in the filesystems of our machines and changes to use | |
.. note:: | ||
The numbered run directory must be included in the suite name, eg. `name-of-suite/run1`. | ||
|
||
|
||
5. Verify the checksums updated properly by retriggering the failed checksums. First retrigger | ||
``export-source``, and then when complete ``export-source_xc40`` if new checksums are present | ||
there (there is no need to retigger spice). You may need to change the maximum window extent | ||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,10 +3,11 @@ | |||||||||
Upgrade Macros | ||||||||||
============== | ||||||||||
|
||||||||||
To create an upgrade macro, the developer must edit a ``versions.py`` file which is used | ||||||||||
to update the various apps in the rose stem suite to accept the namelist changes. The upgrade | ||||||||||
macros also form the basis of the ``rose app-upgrade`` script applied by a user wishing to | ||||||||||
upgrade from one version of a model to the next. | ||||||||||
.. important:: | ||||||||||
|
||||||||||
When developing Upgrade Macros, they must be tested using a test branch (see :ref:`testing`). | ||||||||||
|
||||||||||
Comment on lines
+6
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition :) |
||||||||||
To create an upgrade macro, the developer must edit a ``versions.py`` file which is used to update the various apps in the rose stem suite to accept the namelist changes. The upgrade macros also form the basis of the ``rose app-upgrade`` script applied by a user wishing to upgrade from one version of a model to the next. | ||||||||||
|
||||||||||
The ``versions.py`` file containing upgrade macros can be found in the following locations: | ||||||||||
|
||||||||||
|
@@ -20,6 +21,11 @@ The ``versions.py`` file containing upgrade macros can be found in the followin | |||||||||
|
||||||||||
``rose-meta/jules-standalone/versions.py`` | ||||||||||
|
||||||||||
.. tab-item:: LFRic Core + Apps | ||||||||||
|
||||||||||
| ``applications/<APPLICATION>/rose-meta/lfric-<APPLICATION>/versions.py`` | ||||||||||
| Variations on this theme occur, eg. LFRic Apps science sections or Components in LFRic Core | ||||||||||
|
||||||||||
|
||||||||||
Within the file a blank upgrade macro will typically look like this: | ||||||||||
|
||||||||||
|
@@ -73,3 +79,49 @@ This command can then be run on a **test** branch (see :ref:`testing`). | |||||||||
namelists and changing the value that a particular variable takes. | ||||||||||
A `tutorial <http://metomi.github.io/rose/doc/html/tutorial/rose/furthertopics/upgrading.html>`_ | ||||||||||
is also available. | ||||||||||
|
||||||||||
|
||||||||||
Upgrade Macros in LFRic | ||||||||||
----------------------- | ||||||||||
|
||||||||||
.. warning:: | ||||||||||
|
||||||||||
Namelist files in application example directories are not currently updated by the Apply Macros script. This feature is intended to be introduced, but for now, developers still need to manually update those files. | ||||||||||
|
||||||||||
The organisation of LFRic metadata is different from other repositories (UM + Jules) as the metadata is stored with the Science or Application section it is associated with and is then imported by other apps that require it. This helps modularise the LFRic code but complicates macro chains as different apps may require different chains depending on the metadata they import. A simple implementation of macros in this case might require duplication of a particular macro if its metadata is imported multiple times. This is unsatisfactory as it makes mistakes more likely and requires more effort. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like explaining the alternative solution adds too much bulk to this section. I suggest stopping at "complicates macro chains." There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure |
||||||||||
|
||||||||||
To solve this, macros in LFRic Apps are applied using a wrapper script which will read the added macros and combine them in versions.py files where the metadata is imported. Therefore when adding macros, the macro should be added in the versions.py file in the same metadata directory as the metadata it is applying. It will then be shared as appropriate by the ``apply_macros.py`` script. For example, if a change to metadata is made in ``science/gungho/rose-meta/lfric-gungho``, the macro should be added to the ``versions.py`` file in that directory. This will then be copied to other ``versions.py`` files that import gungho metadata, eg. lfric_atm, transport etc. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
A couple of suggested tweaks. I also wonder if the "for example" should be a new (indented?) paragraph to lower the size of the block of text. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done both all of those suggestions |
||||||||||
|
||||||||||
It is expected that all metadata changes in LFRic Core will require change to the rose-apps in LFRic Apps, but changes to Apps must not affect Core. Therefore, the apply_macros script requires a working copy of LFRic Apps to work, but will source it's own copy of Core if required. If your only changes are to LFRic Core metadata, then you will require a linked LFRic Apps ticket and test branch, but potentially not a development branch. | ||||||||||
|
||||||||||
.. important:: | ||||||||||
|
||||||||||
Some complex macro commands may be dependent on the order in which they are applied. If macros are copied by the wrapper script, the order they are applied will always be determined by the reverse metadata import order. For example, lfric_atm imports gungho metadata, which itself imports components/driver. If all 3 sections have an associated macro, then the macro commands would be applied in the order: components/driver, gungho, lfric_atm. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
|
||||||||||
.. tip:: | ||||||||||
|
||||||||||
The wrapper script will read the ``dependencies.sh`` file in your LFRic Apps working copy and will checkout a temporary copy of the LFRic Core source if required. Some Core metadata changes will also modify the Core rose apps. In this case make sure to also commit these changes back to the core branch. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "if required" = "if a working copy is not provided"? So affected core apps are modified in the temporary checkout? I guess not since they'd need a core metadata change to go with that so you'll have had a working copy around already. Is it worth modifying the script to print to say which working copies were modified in the process of applying the macro to make it clearer which ones will need committing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah that's right about the temporary copy. |
||||||||||
|
||||||||||
To add upgrade macros to LFRic the following steps can be followed: | ||||||||||
|
||||||||||
|
||||||||||
|
||||||||||
1. Checkout an LFRic Apps working copy and update the core source in ``dependencies.sh`` if required. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "if required" = "if you have LFRic Core changes"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
2. Add your upgrade macros. These **must** be added to the versions.py file associated with the metadata they are changing. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
3. Run the Upgrade Macro script - this **must** be done in a test branch (see :ref:`testing`). This is located in the `SimSys_Scripts github repo <https://github.com/MetOffice/SimSys_Scripts>`_ (at meto an up to date clone is available in $UMDIR/SimSys_Scripts). The syntax for running is: | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Suggested change
shifting the emphasis of the test branch to the important box below to help the flow of this point (I first read it as the test branch is located in the simsys scripts github repo!) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep, reads better, cheers |
||||||||||
|
||||||||||
.. code-block:: | ||||||||||
|
||||||||||
SimSys_Scripts/lfric_macros/apply_macros.py vnXX.Y_tTTTT -a Apps -c Core -j Jules | ||||||||||
|
||||||||||
.. important:: | ||||||||||
|
||||||||||
**Do not commit changes to a Dev Branch having run the apply_macros script** | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||||
|
||||||||||
The Apps, Core and Jules options are paths to sources for each of these. Apps will default to the present location (so it is recommended to launch from an Apps working copy). Core and Jules will default to reading the ``dependencies.sh`` file in the Apps source if not provided. | ||||||||||
|
||||||||||
The ``vnXX.Y_tTTTT`` option must match the After Tag of your upgrade macro. When setting this, the version is the last released version of LFRic Apps. If it's a linked Apps-Core ticket, then set the ticket number as the one where the most metadata changes are being made. | ||||||||||
|
||||||||||
.. tip:: | ||||||||||
|
||||||||||
The apply_macros script requires python >= 3.9. At the Met Office this can be achieved by ``module load scitools``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe make this a "note" box?
Trying to tweak to flow better, but not sure I'm 100% there yet!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I was worried about how a note box would appear in the tab section, within a drop-down menu. But it looks fine. And taken your suggested wording, cheers