Commit 168a98e1 authored by David Trudgian's avatar David Trudgian
Browse files

Support parameter substitutions

parent 1400a1f9
......@@ -101,7 +101,7 @@ parameter file that you should correct before submitting to the cluster.
The example below includes documentation of each parameter, and can be
used as a starting point for your own parameter files
```yaml
``` yaml
# The command to run, including any arguments that always stay the same,
# and will not be explored by the runner.
......@@ -172,6 +172,10 @@ time_limit: 3-00:00
# flag: '--example' A flag which should proceed the value of the paremeter
# optional: true If true, we consider combinations excluding this parameter
#
# substitution: '%1' If substitution is specfied, the parameter value
# optional: true will replace the placeholder supplied in the
# command, instead of being appended to the command
#
# int_range and real_range types take paremeters:
#
# min: 10 Minimum value for the parameter
......
......@@ -236,11 +236,13 @@ class ParamFile(object):
current_param = params[param_idx]
current_id = current_param['id']
current_flag = current_param.get('flag', None)
current_sub = current_param.get('substitution', None)
num_values = len(current_param['range'])
for val_idx in range(num_values):
current_value = current_param['range'][val_idx]
current_combination[current_id] = {'flag': current_flag,
'substitution': current_sub,
'value': current_value}
all_combinations = self.__recurse_arg_combns(param_idx + 1,
deepcopy(
......@@ -264,6 +266,14 @@ class ParamFile(object):
for arg in arg_combn.values():
# In substitution mode we replace a placeholder in the command string
if arg['substitution'] is not None:
cmd_str = cmd_str.replace(arg['substitution'], arg['value'])
# Otherwise we append args, possibly prefixed with specified flags
else:
if arg['flag'] and arg['value'] is not None:
cmd_str += arg['flag'] + ' '
......
......@@ -132,6 +132,9 @@
},
"description":{
"type":"string"
},
"substitution":{
"type":"string"
}
},
"required":[
......@@ -174,6 +177,9 @@
},
"description":{
"type":"string"
},
"substitution":{
"type":"string"
}
},
"required":[
......@@ -211,6 +217,9 @@
},
"description":{
"type":"string"
},
"substitution":{
"type":"string"
}
},
"required":[
......
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