Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Peng Lian
param_runner
Commits
5dd9d13e
Commit
5dd9d13e
authored
May 08, 2017
by
David Trudgian
Browse files
Add module list and loading
parent
418cca5d
Changes
4
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
5dd9d13e
...
...
@@ -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
modules
:
-
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:
...
...
param_runner/param.py
View file @
5dd9d13e
import
logging
import
os
import
subprocess
import
re
from
collections
import
OrderedDict
from
copy
import
deepcopy
...
...
@@ -88,7 +89,31 @@ class ParamFile(object):
logging
.
info
(
"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
:
logging
.
info
(
'Module %s will be loaded.'
%
mod_name
)
return
modules_ok
def
lint
(
self
):
"""Lint our parameter file with yamllint
...
...
param_runner/schema/param_runner.jsonschema.yml
View file @
5dd9d13e
...
...
@@ -66,6 +66,18 @@
]
}
},
"
modules"
:{
"
type"
:
"
array"
,
"
minItems"
:
0
,
"
uniqueItems"
:
true
,
"
additionalItems"
:
true
,
"
title"
:
"
Software
Modules"
,
"
description"
:
"
A
list
of
environment
module
names
that
should
be
loaded
to
run
this
job."
,
"
name"
:
"
modules"
,
"
items"
:{
"
type"
:
"
string"
}
},
"
parameters"
:{
"
type"
:
"
array"
,
"
minItems"
:
1
,
...
...
test/test_data/test_params.yaml
View file @
5dd9d13e
...
...
@@ -30,6 +30,10 @@ cpus_per_task: 4
# Time limit
time_limit
:
3-00:00:00
# Environment Module to Load
modules
:
-
matlab/2013a
-
python/2.7.x-anaconda
# The list of parameters to explore
#
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment