Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
param_runner
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
BioHPC
param_runner
Commits
168a98e1
Commit
168a98e1
authored
8 years ago
by
David Trudgian
Browse files
Options
Downloads
Patches
Plain Diff
Support parameter substitutions
parent
1400a1f9
Branches
Branches containing commit
Tags
1.0.0a3
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
README.md
+7
-3
7 additions, 3 deletions
README.md
param_runner/param.py
+14
-4
14 additions, 4 deletions
param_runner/param.py
param_runner/schema/param_runner.jsonschema.yml
+9
-0
9 additions, 0 deletions
param_runner/schema/param_runner.jsonschema.yml
with
30 additions
and
7 deletions
README.md
+
7
−
3
View file @
168a98e1
...
...
@@ -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.
...
...
@@ -162,7 +162,7 @@ time_limit: 3-00:00
#
# For each parameter the following properties are required:
#
# type:
'int_range' A range of integers -or-
# type: 'int_range' A range of integers -or-
# 'real_range' A range of real numbers -or-
# 'choice' A list of string options
#
...
...
@@ -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
...
...
@@ -230,4 +234,4 @@ parameters:
-
sigmoid
description
:
Activation function
```
\ No newline at end of file
```
This diff is collapsed.
Click to expand it.
param_runner/param.py
+
14
−
4
View file @
168a98e1
...
...
@@ -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,11 +266,19 @@ class ParamFile(object):
for
arg
in
arg_combn
.
values
():
if
arg
[
'
flag
'
]
and
arg
[
'
value
'
]
is
not
None
:
cmd_str
+=
arg
[
'
flag
'
]
+
'
'
if
arg
[
'
value
'
]
is
not
None
:
cmd_str
+=
str
(
arg
[
'
value
'
])
+
'
'
# 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
'
]
+
'
'
if
arg
[
'
value
'
]
is
not
None
:
cmd_str
+=
str
(
arg
[
'
value
'
])
+
'
'
return
cmd_str
.
rstrip
(
'
'
)
...
...
This diff is collapsed.
Click to expand it.
param_runner/schema/param_runner.jsonschema.yml
+
9
−
0
View file @
168a98e1
...
...
@@ -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"
:[
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment