Skip to content

Commit

Permalink
add config.yaml option to add module dirs to MODULEPATH
Browse files Browse the repository at this point in the history
  • Loading branch information
Jo Basevi committed Aug 3, 2023
1 parent c8e7424 commit 8b0c351
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion payu/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ def load_modules(self):
envmod.module('load', mod)

# User-defined modules
user_modules = self.config.get('modules', [])
user_modules = self.config.get('modules', {}).get('load', [])
for mod in user_modules:
envmod.module('load', mod)

Expand Down Expand Up @@ -457,6 +457,10 @@ def run(self, *user_flags):

# XXX: This was previously done in reversion
envmod.setup()

# Add any user-defined module dir(s) to MODULEPATH
for module_dir in self.config.get('modules', {}).get('use', []):
envmod.module('use', module_dir)

self.load_modules()

Expand Down
6 changes: 6 additions & 0 deletions payu/fsops.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ def read_config(config_fname=None):

config['collate'] = collate_config

# Transform legacy modules config options
modules_config = config.pop('modules', {})
if type(modules_config) is list:
modules_config = {'load': modules_config}
config['modules'] = modules_config

# Local "control" path. Must be set here so it can be
# scanned for storage points
config["control_path"] = config.get('control',
Expand Down

0 comments on commit 8b0c351

Please sign in to comment.