Commit 5dd9d13e authored by David Trudgian's avatar David Trudgian
Browse files

Add module list and loading

parent 418cca5d
......@@ -158,6 +158,13 @@ cpus_per_task: 4
time_limit: 3-00:00
# Modules to load - an optional list of environment modules that the
# command you wish to execute needs to be loaded
- matlab/2013a
- python/2.7.x-anaconda
# Now we configure the list of parameters we want to explore.
# For each parameter the following properties are required:
import logging
import os
import subprocess
import re
from collections import OrderedDict
from copy import deepcopy
......@@ -88,7 +89,31 @@ class ParamFile(object):"Parameter file is valid")
return True
return self.checkModules(params)
def checkModules(self, params):
"""Use the environment modules system modulecmd to check any modules
requested for this run actually exist on the system
modules_ok = True
if 'modules' in params.keys():
for mod_name in params['modules']:
cmd = ['modulecmd', 'sh', 'show', mod_name]
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
if "Unable to locate" in output:
logging.error('Module %s was not found.' % mod_name)
module_ok = False
else:'Module %s will be loaded.' % mod_name)
return modules_ok
def lint(self):
"""Lint our parameter file with yamllint
......@@ -66,6 +66,18 @@
"title":"Software Modules",
"description":"A list of environment module names that should be loaded to run this job.",
......@@ -30,6 +30,10 @@ cpus_per_task: 4
# Time limit
time_limit: 3-00:00:00
# Environment Module to Load
- matlab/2013a
- python/2.7.x-anaconda
# The list of parameters to explore
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment