From cb8a4593b7cdc5e0cd6084d01c6bca95f39d671b Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Wed, 7 Nov 2018 09:41:47 +0100 Subject: [PATCH] [algorithm] Add loop information parsing The format is: "loop": { "input": { "type": "data_format_name" }, "output": { "type": "data_format_name" } } --- beat/backend/python/algorithm.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/beat/backend/python/algorithm.py b/beat/backend/python/algorithm.py index 0d24bdf..fa63584 100644 --- a/beat/backend/python/algorithm.py +++ b/beat/backend/python/algorithm.py @@ -419,6 +419,8 @@ class Algorithm(object): for k,v in g['inputs'].items()]) self.output_map = dict([(k,v['type']) for g in self.groups \ for k,v in g.get('outputs', {}).items()]) + self.loop_map = dict([(k,v['type']) for g in self.groups \ + for k,v in g.get('loop', {}).items()]) self._load_dataformats(dataformat_cache) self._convert_parameter_types() @@ -457,6 +459,23 @@ class Algorithm(object): self.dataformats[output['type']] = thisformat + if 'loop' not in group: + continue + + for name, entry in group['loop'].items(): + entry_format = entry['type'] + if entry_format in self.dataformats: + continue + + if dataformat_cache and entry_format in dataformat_cache: + thisformat = dataformat_cache[entry_format] + else: + thisformat = dataformat.DataFormat(self.prefix, entry_format) + if dataformat_cache is not None: + dataformat_cache[entry_format] = thisformat + + self.dataformats[entry_format] = thisformat + if self.results: -- GitLab