Commit 3ab9fb3a authored by David Trudgian's avatar David Trudgian
Browse files

CLI check ok, drop position property for implicit position

parent 426c5f8d
......@@ -6,8 +6,12 @@ param_runner - Run an application multiple times on the BioHPC cluster,
exploring a parameter space and summarizing results.
Usage:
param_runner <paramfile> [--verbose] [--dry-run]
param_runner -h | --help | --version
param_runner check <paramfile> [--verbose]
param_runner submit <paramfile> [--verbose]
param_runner srun <paramfile> [--verbose]
param_runner run <paramfile> [--verbose]
param_runner -h | --help | --version
Options:
--verbose Show debug messages
......@@ -20,6 +24,8 @@ import logging
import colorlog
from runner import __version__
from runner import param
def main():
......@@ -50,8 +56,8 @@ def main():
try:
pfile = param.ParamFile(arguments['<paramfile>'])
pfile.load()
except Exception as e:
logger.error("[%s] %s" % ( e.__class__.__name__, e ))
......@@ -59,4 +65,4 @@ def main():
if __name__ == '__main__':
main()
\ No newline at end of file
main()
......@@ -32,11 +32,13 @@ class ParamFile(object):
param_file (str): path to the input parameter yaml file
vals (dict): Dictionary of configuration data extracted
combination_count (int): Number of parameter combinations
"""
param_file = ''
vals = {}
combination_count = None
mypath = os.path.dirname(os.path.abspath(__file__))
......@@ -109,6 +111,7 @@ class ParamFile(object):
def load(self):
"""Read in metadata from the astrocyte_pkg.yml to populate vals dict"""
self.validate()
metadata = anyconfig.load(self.param_file)
self.vals = metadata
self.__compute_param_ranges()
......@@ -116,6 +119,10 @@ class ParamFile(object):
def __compute_param_ranges(self):
"""Compute the parameter ranges as lists, from their definitions"""
logger.info("Computing Parameter Ranges...")
self.combination_count = 1
for param in self.vals['parameters']:
if param['type'] == 'int_range':
......@@ -130,9 +137,12 @@ class ParamFile(object):
cr = ChoiceRange(param)
param['range'] = cr.to_list()
logger.info("Parameter %s will explore values: %s " %
self.combination_count *= len(param['range'])
logger.info(" - Parameter '%s' will explore values: %s " %
(param['id'], param['range']))
logger.info(" - Total combinations to explore: %d" % self.combination_count)
class IntRange(object):
......
......@@ -108,9 +108,6 @@
"flag":{
"type":"string"
},
"position":{
"type":"integer"
},
"optional":{
"type":"boolean"
},
......@@ -153,9 +150,6 @@
"flag":{
"type":"string"
},
"position":{
"type":"integer"
},
"optional":{
"type":"boolean"
},
......@@ -198,9 +192,6 @@
"flag":{
"type":"string"
},
"position":{
"type":"integer"
},
"optional":{
"type":"boolean"
},
......@@ -241,4 +232,4 @@
}
}
}
\ No newline at end of file
}
......@@ -48,7 +48,6 @@ time_limit: 3d:00:00:00
# The following properties are optional:
#
# flag: '--example' A flag which should proceed the value of the paremeter
# position: 1 The position of the parameter in the command line
# optional: true If true, we consider combinations excluding the parameter
#
# int_range and real_range types take paremeters:
......@@ -73,7 +72,6 @@ parameters:
- id: 'hidden'
type: "int_range"
flag: '--hidden'
position: 1
min: 0
max: 32
step: 2
......@@ -82,7 +80,6 @@ parameters:
- id: 'beta'
type: real_range
flag: '-b'
position: 2
optional: true
min: 0.1
max: 100
......
......@@ -71,7 +71,7 @@ class TestParams:
def test_compute_ranges(self):
md = ParamFile(os.path.dirname(os.path.abspath(__file__)) + '/test_data/test_params.yaml')
md.load()
md.compute_param_ranges()
# IMPLICIT md.compute_param_ranges()
# min: 0
# max: 32
# step: 2
......
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