Skip to content
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

[develop] Transition the var_defns bash file to YAML. #1098

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from

Conversation

christinaholtNOAA
Copy link
Collaborator

@christinaholtNOAA christinaholtNOAA commented Jun 18, 2024

DESCRIPTION OF CHANGES:

Use YAML for the configuration language at run time.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

I could use some help on updating documentation. Just pointers to the most important pieces. Let's also talk about whether that could be separated into a follow-on PR.

TESTS CONDUCTED:

  • hera.intel
  • orion.intel
  • hercules.intel
  • cheyenne.intel
  • cheyenne.gnu
  • derecho.intel
  • gaea.intel
  • gaeac5.intel
  • jet.intel
  • wcoss2.intel
  • NOAA Cloud (indicate which platform)
  • Jenkins
  • fundamental test suite
  • comprehensive tests -- all of them, but only on Hera

DEPENDENCIES:

n/a

DOCUMENTATION:

ISSUE:

CHECKLIST

  • My code follows the style guidelines in the Contributor's Guide
  • I have performed a self-review of my own code using the Code Reviewer's Guide
  • I have commented my code, particularly in hard-to-understand areas
  • My changes need updates to the documentation. I have made corresponding changes to the documentation
  • My changes do not require updates to the documentation (explain).
  • My changes generate no new warnings
  • New and existing tests pass with my changes
  • Any dependent changes have been merged and published

# USHdir
#
# workflow:
# EXPTDIR
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a pattern that shows up regularly. I did my best to add a doc block to the top of each j-job and ex-script to list the variables that are used in the script and the sections they come from.

The run-time variables may be from Rocoto jobs or from the NCO preamble.

source_config_for_task "" ${GLOBAL_VAR_DEFNS_FP}
for sect in user nco workflow ; do
source_yaml ${GLOBAL_VAR_DEFNS_FP} ${sect}
done
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the pattern I've added to explicitly state which sections of the var_defns file should be "sourced". The bash util helps us run a UW tool that translates YAML to bash and then exports it line-by-line.

This sort of thing will go away with a full integration of uwtools drivers (planned work in upcoming EPIC PI 13).

@@ -16,7 +31,9 @@
#-----------------------------------------------------------------------
#
. $USHdir/source_util_funcs.sh
source_config_for_task "" ${GLOBAL_VAR_DEFNS_FP}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This command sources everything in the bash file that does not start with "task_", so the environment is now narrowed to the specific script with the new implementation.

@@ -3,97 +3,25 @@
#
#-----------------------------------------------------------------------
#
# This script generates grid and orography files in NetCDF format that
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This text block was not consistent with what this script actually does, nor what its corresponding ex-script does.

set +u
conda activate ${SRW_GRAPHICS_ENV}
set -u
fi
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This task uses a different environment to run graphics, so loads it here instead of in the load_modules_run_task.sh file.

line=$(echo "$line" | sed -E "s/='\[(.*)\]'/=(\1)/")
line=${line//,/}
line=${line//\"/}
line=${line/None/}
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

These lines handle the transition from YAML lists to bash lists, and "None" values being empty variables in bash.

@@ -468,7 +468,7 @@ workflow:
#
#-----------------------------------------------------------------------
#
WORKFLOW_ID: !nowtimestamp ''
WORKFLOW_ID: ""
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This thing isn't supported in uwtools, and isn't actually needed for SRW.

@@ -639,7 +639,7 @@ def generate_FV3LAM_wflow(
input_format="nml",
output_file=FV3_NML_STOCH_FP,
output_format="nml",
supplemental_configs=[settings],
update_config=get_nml_config(settings),
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is a change to the API in the new uwtools version.

@@ -1,5 +1,7 @@
#!/bin/bash

set +u
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Some how this script wasn't subjected to this requirement.

else
exec "${jjob_fp}"
fi
source "${jjob_fp}"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Running the script in the same shell provides access to modify the conda env.

@MichaelLueken MichaelLueken changed the title Transition the var_defns bash file to YAML. [develop] Transition the var_defns bash file to YAML. Jun 20, 2024
@christinaholtNOAA christinaholtNOAA marked this pull request as ready for review June 20, 2024 14:43
@christinaholtNOAA
Copy link
Collaborator Author

I ran the fundamental tests on Hera one more time after my last push and it's still passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant