Skip to content

Commit

Permalink
Update syntax for latest version of lmod. (#542)
Browse files Browse the repository at this point in the history
 ## DESCRIPTION OF CHANGES:
This PR addresses an error that occurs at run time ```ModuleNotFoundError: No module named 'f90nml'```.
A similar error may appear in any of the tasks that use a conda environment, and could potentially list
`jinja2` instead.

The version of lmod on Hera was updated. The behavior of the `system` command has changed and now runs
only in a subshell. As an lmod-version-independent fix, the module will no longer activate a conda
environment, but will set the conda environment that should be activated through an environment
variable, then the script will activate any required conda environment.

Note: Users who do not run with Rocoto, but still use these modules, will have an extra step of
activating the conda environment manually.

 ## TESTS CONDUCTED:
Built and ran a single WE2E test (grid_RRFS_CONUS_25km_ics_FV3GFS_lbcs_FV3GFS_suite_GFS_v15p2)
successfully on Hera with these modifications, as well as a WE2E test (DOT_OR_USCORE) on Orion as a
sanity check.
  • Loading branch information
christinaholtNOAA authored and mkavulich committed Jul 15, 2021
1 parent 4d6ff80 commit 9f0d3e1
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 36 deletions.
5 changes: 2 additions & 3 deletions modulefiles/tasks/hera/make_grid.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/hera/make_ics.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/hera/make_lbcs.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/hera/run_fcst.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/jet/make_grid.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/jet/make_ics.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ module load wgrib2/2.0.8

module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/jet/make_lbcs.local
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ module load wgrib2/2.0.8

module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/jet/run_fcst.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /contrib/miniconda3/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/orion/make_grid.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /apps/contrib/miniconda3-noaa-gsl/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/orion/make_ics.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /apps/contrib/miniconda3-noaa-gsl/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/orion/make_lbcs.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /apps/contrib/miniconda3-noaa-gsl/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
5 changes: 2 additions & 3 deletions modulefiles/tasks/orion/run_fcst.local
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#%Module
module use -a /apps/contrib/miniconda3-noaa-gsl/modulefiles
module load miniconda3
if [module-info mode load] {
system "conda activate regional_workflow"
}

setenv SRW_ENV regional_workflow
11 changes: 11 additions & 0 deletions ush/load_modules_run_task.sh
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,17 @@ ules_dir) for the specified task (task_name) failed:
module list

#fi #End if statement for tasks that load no modules

# Modules that use conda and need an environment activated will set the
# SRW_ENV variable to the name of the environment to be activated. That
# must be done within the script, and not inside the module. Do that
# now.

if [ -n "${SRW_ENV:-}" ] ; then
conda activate ${SRW_ENV}
fi


#
#-----------------------------------------------------------------------
#
Expand Down

0 comments on commit 9f0d3e1

Please sign in to comment.