-
Notifications
You must be signed in to change notification settings - Fork 110
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
base: develop
Are you sure you want to change the base?
[develop] Transition the var_defns bash file to YAML. #1098
Conversation
# USHdir | ||
# | ||
# workflow: | ||
# EXPTDIR |
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.
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 |
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.
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} |
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.
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 |
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.
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 |
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.
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/} |
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.
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: "" |
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.
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), |
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.
This is a change to the API in the new uwtools version.
@@ -1,5 +1,7 @@ | |||
#!/bin/bash | |||
|
|||
set +u |
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.
Some how this script wasn't subjected to this requirement.
else | ||
exec "${jjob_fp}" | ||
fi | ||
source "${jjob_fp}" |
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.
Running the script in the same shell provides access to modify the conda env.
I ran the fundamental tests on Hera one more time after my last push and it's still passing. |
DESCRIPTION OF CHANGES:
Use YAML for the configuration language at run time.
Type of change
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:
DEPENDENCIES:
n/a
DOCUMENTATION:
ISSUE:
CHECKLIST