C-Star is a python package for setting up and running ocean model simulations, with a particular focus on marine carbon dioxide removal (mCDR) applications.
This PR fixes several issues uncovered while running on NERSC's Perlmutter system (particularly in the context of using C-Star in a jupyterlab job)
use importlib to import the Linux Environment Modules python module for environment management
capture output when using lmod and only print if fail or error found in stderr (several system messages are otherwise printed when import cstar is run)
Define a _CSTAR_ENVIRONMENT_VARIABLES global to track environment variables set by C-Star. This is used to reconstruct the C-Star specific environment inside a slurm job with --export=NONE
Create text files in additional_files specifying the modules to be loaded on different machines. These files are parsed by C-Star and used to call module , rather than hardcoding the environment into the C-Star python code.
rename set_local_config to get_user_environment and do not update environment variables within the function anymore (just append to _CSTAR_ENVIRONMENT_VARIABLES
add a queue option to Case.run and Component.run
Remove SLURM_ prefixed environment variables from subprocess environment when submitting to the queue (even with --export=NONE these were slipping through, causing conflicts if a job was started from within another job)
This PR fixes several issues uncovered while running on NERSC's Perlmutter system (particularly in the context of using C-Star in a jupyterlab job)
importlib
to import the Linux Environment Modules python module for environment managementfail
orerror
found in stderr (several system messages are otherwise printed whenimport cstar
is run)_CSTAR_ENVIRONMENT_VARIABLES
global to track environment variables set by C-Star. This is used to reconstruct the C-Star specific environment inside a slurm job with--export=NONE
additional_files
specifying the modules to be loaded on different machines. These files are parsed by C-Star and used to callmodule
, rather than hardcoding the environment into the C-Star python code.set_local_config
toget_user_environment
and do not update environment variables within the function anymore (just append to_CSTAR_ENVIRONMENT_VARIABLES
queue
option toCase.run
andComponent.run
SLURM_
prefixed environment variables from subprocess environment when submitting to the queue (even with--export=NONE
these were slipping through, causing conflicts if a job was started from within another job)post_run