Skip to content
Snippets Groups Projects
Commit ed2110d2 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[helpers] Refactor loop handling in configuration conversion

parent 46f33517
No related branches found
No related tags found
2 merge requests!281.6.x,!27Soft loop
......@@ -56,6 +56,30 @@ logger = logging.getLogger(__name__)
# ----------------------------------------------------------
def convert_loop_to_container(config):
data = {
'algorithm': config['algorithm'],
'parameters': config['parameters'],
'channel': config['channel'],
'uid': os.getuid()
}
if 'inputs' in config:
data['inputs'] = \
dict([(k, { 'channel': v['channel'],
'path': v['path'],
'database': 'database' in v })
for k,v in config['inputs'].items()])
for item in ['request', 'answer']:
data[item] = {
'path': config[item]['path'],
'channel': config[item]['channel']
}
return data
def convert_experiment_configuration_to_container(config):
data = {
......@@ -78,8 +102,7 @@ def convert_experiment_configuration_to_container(config):
data['result'] = { 'channel': config['channel'], 'path': config['result']['path'] }
if 'loop' in config:
data['loop'] = \
dict([(k, { 'channel': v['channel'], 'path': v['path'] }) for k,v in config['loop'].items()])
data['loop'] = convert_loop_to_container(config['loop'])
return data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment