Skip to content

Commit

Permalink
Merge branch 'NOAA-EMC:develop' into feature/gmi_on
Browse files Browse the repository at this point in the history
  • Loading branch information
KateFriedman-NOAA authored Oct 28, 2024
2 parents 94e1b59 + b56f633 commit 7aa8a23
Show file tree
Hide file tree
Showing 14 changed files with 104 additions and 36 deletions.
42 changes: 23 additions & 19 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def cases = ''
def GH = 'none'
// Location of the custom workspaces for each machine in the CI system. They are persitent for each iteration of the PR.
def NodeName = [hera: 'Hera-EMC', orion: 'Orion-EMC', hercules: 'Hercules-EMC', gaea: 'Gaea']
def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/stmp/CI/HERCULES', gaea: '/gpfs/f5/epic/proj-shared/global/CI']
def custom_workspace = [hera: '/scratch1/NCEPDEV/global/CI', orion: '/work2/noaa/stmp/CI/ORION', hercules: '/work2/noaa/global/CI/HERCULES', gaea: '/gpfs/f5/epic/proj-shared/global/CI']
def repo_url = '[email protected]:NOAA-EMC/global-workflow.git'
def STATUS = 'Passed'

Expand Down Expand Up @@ -101,9 +101,10 @@ pipeline {
stages {
stage('Building') {
steps {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
script {
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to build the system on per system basis under the custome workspace for each buile system
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
sh(script: "mkdir -p ${HOMEgfs}")
ws(HOMEgfs) {
if (fileExists("${HOMEgfs}/sorc/BUILT_semaphor")) { // if the system is already built, skip the build in the case of re-runs
Expand Down Expand Up @@ -172,9 +173,10 @@ pipeline {
}
if (system == 'gfs') {
cases = sh(script: "${HOMEgfs}/ci/scripts/utils/get_host_case_list.py ${machine}", returnStdout: true).trim().split()
echo "Cases to run: ${cases}"
}
}
}
}
}
}
}
Expand All @@ -192,32 +194,34 @@ pipeline {
def parallelStages = cases.collectEntries { caseName ->
["${caseName}": {
stage("Create ${caseName}") {
catchError(buildResult: 'UNSTABLE', stageResult: 'FAILURE') {
script {
sh(script: "sed -n '/{.*}/!p' ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml > ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp")
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
system = yaml_case.experiment.system
def HOMEgfs = "${CUSTOM_WORKSPACE}/${system}" // local HOMEgfs is used to populate the XML on per system basis
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
try {
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml", returnStdout: true).trim()
} catch (Exception error_create) {
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experment on ${Machine} in BUILD# ${env.BUILD_NUMBER}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
error("Case ${caseName} failed to create experment directory")
}
script {
sh(script: "sed -n '/{.*}/!p' ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml > ${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp")
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
def build_system = yaml_case.experiment.system
def HOMEgfs = "${CUSTOM_WORKSPACE}/${build_system}" // local HOMEgfs is used to populate the XML on per system basis
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
env.RUNTESTS = "${CUSTOM_WORKSPACE}/RUNTESTS"
try {
error_output = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh create_experiment ${HOMEgfs}/ci/cases/pr/${caseName}.yaml", returnStdout: true).trim()
} catch (Exception error_create) {
sh(script: """${GH} pr comment ${env.CHANGE_ID} --repo ${repo_url} --body "${Case} **FAILED** to create experment on ${Machine} in BUILD# ${env.BUILD_NUMBER}\n with the error:\n\\`\\`\\`\n${error_output}\\`\\`\\`" """)
error("Case ${caseName} failed to create experment directory")
}
}
}
}

stage("Running ${caseName}") {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
script {
HOMEgfs = "${CUSTOM_WORKSPACE}/gfs" // common HOMEgfs is used to launch the scripts that run the experiments
env.HOME_GFS = HOMEgfs // setting path in HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
def pslot = sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh get_pslot ${CUSTOM_WORKSPACE}/RUNTESTS ${caseName}", returnStdout: true).trim()
def error_file = "${CUSTOM_WORKSPACE}/RUNTESTS/${pslot}_error.logs"
sh(script: " rm -f ${error_file}")
def yaml_case = readYaml file: "${CUSTOM_WORKSPACE}/gfs/ci/cases/pr/${caseName}.yaml.tmp"
def build_system = yaml_case.experiment.system
try {
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${system}")
sh(script: "${HOMEgfs}/ci/scripts/run-check_ci.sh ${CUSTOM_WORKSPACE} ${pslot} ${build_system}")
} catch (Exception error_experment) {
sh(script: "${HOMEgfs}/ci/scripts/utils/ci_utils_wrapper.sh cancel_batch_jobs ${pslot}")
ws(CUSTOM_WORKSPACE) {
Expand Down Expand Up @@ -268,11 +272,11 @@ pipeline {
}
}


stage( '5. FINALIZE' ) {
agent { label NodeName[machine].toLowerCase() }
steps {
script {
env.HOME_GFS = "${CUSTOM_WORKSPACE}/gfs" // setting path to HOMEgfs as an environment variable HOME_GFS for some systems that using the path in its .bashrc
sh(script: """
labels=\$(${GH} pr view ${env.CHANGE_ID} --repo ${repo_url} --json labels --jq '.labels[].name')
for label in \$labels; do
Expand Down
1 change: 1 addition & 0 deletions ci/cases/pr/C96C48_hybatmaerosnowDA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ arguments:
yaml: {{ HOMEgfs }}/ci/cases/yamls/atmaerosnowDA_defaults_ci.yaml

skip_ci_on_hosts:
- wcoss2
- orion
- gaea
- hercules
2 changes: 1 addition & 1 deletion ci/scripts/utils/launch_java_agent.sh
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export GH="${HOME}/bin/gh"
[[ -f "${GH}" ]] || echo "gh is not installed in ${HOME}/bin"
${GH} --version

check_mark=$(gh auth status -t 2>&1 | grep "Token:" | awk '{print $1}') || true
check_mark=$("${GH}" auth status -t 2>&1 | grep "Token:" | awk '{print $1}') || true
if [[ "${check_mark}" != "" ]]; then
echo "gh not authenticating with emcbot token"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion docs/source/clone.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Quick Instructions
Quick clone/build/link instructions (more detailed instructions below).

.. note::
Here we are making the assumption that you are using the workflow to run an experiment and so are working from the authoritative repository. If you are using a development branch then follow the instructions in :doc:`development.rst`. Once you do that you can follow the instructions here with the only difference being the repository/fork you are cloning from.
Here we are making the assumption that you are using the workflow to run an experiment and so are working from the authoritative repository. If you are using a development branch then follow the instructions in :doc:`development`. Once you do that you can follow the instructions here with the only difference being the repository/fork you are cloning from.

Clone the `global-workflow` and `cd` into the `sorc` directory:

Expand Down
25 changes: 24 additions & 1 deletion docs/source/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Code managers

* Kate Friedman - @KateFriedman-NOAA / [email protected]
* Walter Kolczynski - @WalterKolczynski-NOAA / [email protected]
* David Huber - @DavidHuber-NOAA / [email protected]

.. _development:

Expand Down Expand Up @@ -70,7 +71,29 @@ The following steps should be followed in order to make changes to the develop b
Development Tools
=================

See the ``/test`` folder in global-workflow for available development and testing tools.
Two sets of testing are available for use by developers. The first is the capability to run continuous integration tests locally and the second are a set of comparison tools.

---------------------------
Continuous Integration (CI)
---------------------------

The global workflow comes fitted with a suite of system tests that run various types of workflow. These tests are commonly run for pull requests before they may be merged into the develop branch. At a minimum, developers are expected to run the CI test(s) that will be impacted by their changes on at least one platform.

The commonly run tests are written in YAML format and can be found in the ``ci/cases/pr`` directory. The ``workflow/generate_workflows.sh`` tool is available to aid running these cases. See the help documentation by running ``./generate_workflows.sh -h``. The script has the capability to prepare the EXPDIR and COMROOT directories for a specified or implied suite of CI tests (see :doc:`setup` for details on these directories). The script also has options to automatically build and run all tests for a given system (i.e. GFS or GEFS and a placeholder for SFS). For instance, to build the workflow and run all of the GFS tests, one would execute

::

cd workflow
./generate_workflows.sh -A "your_hpc_account" -b -G -c /path/to/root/directory

where:

* ``-A`` is used to specify the HPC (slurm or PBS) account to use
* ``-b`` indicates that the workflow should be built fresh
* ``-G`` specifies that all of the GFS cases should be run (this also influences the build flags to use)
* ``-c`` tells the tool to append the rocotorun commands for each experiment to your crontab

More details on how to use the tool are provided by running ``generate_workflows.sh -h``.

----------------
Comparison Tools
Expand Down
4 changes: 2 additions & 2 deletions docs/source/hpc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ Optimizing the global workflow on S4

The S4 cluster is relatively small and so optimizations are recommended to improve cycled runtimes. Please contact Innocent Souopgui ([email protected]) if you are planning on running a cycled experiment on this system to obtain optimized configuration files.

========================================
==================================================
Stacksize on R&Ds (Hera, Orion, Hercules, Jet, S4)
========================================
==================================================

Some GFS components, like the UPP, need an unlimited stacksize. Add the following setting into your appropriate .*rc file to support these components:

Expand Down
2 changes: 1 addition & 1 deletion docs/source/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ Operations/production output location on HPSS: /NCEPPROD/hpssprod/runhistory/rh
| | | | |
| | gfs.t. ``hh`` z.sfcanl.nc | | |
+----------------+---------------------------------+-----------------------------------------------------------------------------+--------------------------------+
| v16.2[3]+ ops | gfs.t. ``hh`` z.atmanl.nc | com_gfs_ ``gfs_ver`` _gfs. ``yyyymmdd`` _ ``hh`` .gfs_nca.tar | gfs. ``yyyymmdd`` /``hh``/atmos|
| v16.2[3]+ ops | gfs.t. ``hh`` z.atmanl.nc | com_gfs\_ ``gfs_ver`` _gfs. ``yyyymmdd`` _ ``hh`` .gfs_nca.tar | gfs. ``yyyymmdd`` /``hh``/atmos|
| | | | |
| | gfs.t. ``hh`` z.sfcanl.nc | | |
+----------------+---------------------------------+-----------------------------------------------------------------------------+--------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs/source/setup.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _experiment-setup:

================
Experiment Setup
================
Expand Down Expand Up @@ -179,8 +181,6 @@ where:
* ``$EXPDIR`` is the path to your experiment directory where your configs will be placed and where you will find your workflow monitoring files (i.e. rocoto database and xml file). DO NOT include PSLOT folder at end of path, it will be built for you. [default: $HOME]
* ``$ICSDIR`` is the path to the ICs for your run if generated separately. [default: None]

.. [#] More Coupled configurations in cycled mode are currently under development and not yet available
Example:

::
Expand Down
6 changes: 3 additions & 3 deletions docs/source/wave.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,16 @@ While the creation of these files are generally considered out of scope of this
* Instructions for creating mesh.${WAVEGRID}.nc can be found at https://ufs-weather-model.readthedocs.io/en/latest/InputsOutputs.html#ww3
* The ww3_gint.WHTGRIDINT.bin.${WAVEGRID} can be created by running the ww3_gint routine as desired and then saved.

Once the new fix files have been created, :ref:`open an issue to have the master fix file directory updated<https://github.com/NOAA-EMC/global-workflow/issues/new?assignees=KateFriedman-NOAA%2CWalterKolczynski-NOAA&labels=Fix+Files&projects=&template=fix_file.md>`. This is a separate step than the process to update the workflow below.
Once the new fix files have been created, `open an issue to have the master fix file directory updated <https://github.com/NOAA-EMC/global-workflow/issues/new?assignees=KateFriedman-NOAA%2CWalterKolczynski-NOAA&labels=Fix+Files&projects=&template=fix_file.md>`. This is a separate step than the process to update the workflow below.

********************************
Updating Config and Script Files
********************************

You will need to update the following files:

* parm/config/*/config.ufs
* parm/config/*/config.wave
* parm/config/\*/config.ufs
* parm/config/\*/config.wave
* scripts/exgfs_wave_post_gridded_sbs.sh

You will need to add the following files:
Expand Down
2 changes: 1 addition & 1 deletion sorc/gdas.cd
Submodule gdas.cd updated 107 files
1 change: 1 addition & 0 deletions ush/python/pygfs/task/marine_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ def _prep_variational_yaml(self: Task) -> None:
envconfig_jcb['cyc'] = os.getenv('cyc')
envconfig_jcb['SOCA_NINNER'] = self.task_config.SOCA_NINNER
envconfig_jcb['obs_list'] = ['adt_rads_all']
envconfig_jcb['MOM6_LEVS'] = mdau.get_mom6_levels(str(self.task_config.OCNRES))

# Write obs_list_short
save_as_yaml(parse_obs_list_file(self.task_config.MARINE_OBS_LIST_YAML), 'obs_list_short.yaml')
Expand Down
33 changes: 33 additions & 0 deletions ush/python/pygfs/utils/marine_da_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,3 +166,36 @@ def clean_empty_obsspaces(config, target, app='var'):

# save cleaned yaml
save_as_yaml(config, target)


@logit(logger)
def get_mom6_levels(ocnres: str) -> int:
"""
Temporary function that returns the number of vertical levels in MOM6 given the horizontal resolution.
This is requiered by the diffusion saber block that now makes use of oops::util::FieldSetHelpers::writeFieldSet
and requires the number of levels in the configuration. I have been told this will be changed in the future.
Parameters
-----------
ocnres: str
Input resolution for ocean in str format. e.g. '500', '100', '050', '025'
Returns
-------
nlev: int
number of levels in the ocean model given an input resolution
"""

# Currently implemented resolutions
ocnres_to_nlev = {
'500': 25,
'100': 75,
'050': 75,
'025': 75
}
try:
nlev = ocnres_to_nlev.get(ocnres)
except KeyError:
raise KeyError("FATAL ERROR: Invalid ocnres value. Aborting.")

return nlev
2 changes: 1 addition & 1 deletion versions/fix.ver
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export cice_ver=20240416
export cpl_ver=20230526
export datm_ver=20220805
export gdas_crtm_ver=20220805
export gdas_fv3jedi_ver=20220805
export gdas_fv3jedi_ver=20241022
export gdas_soca_ver=20240802
export gdas_gsibec_ver=20240416
export gdas_obs_ver=20240213
Expand Down
Loading

0 comments on commit 7aa8a23

Please sign in to comment.