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

[loop_executor][LoopMessageHandler] Implement support for DataFormat

parent e62e7610
No related branches found
No related tags found
2 merge requests!281.6.x,!27Soft loop
......@@ -105,6 +105,13 @@ class LoopMessageHandler(MessageHandler):
self.callbacks.update({'val': self.validate })
self.executor = None
def setup(self, configuration, algorithm, prefix):
input_format_name = algorithm.loop_map['input']
self.input_data_format = DataFormat(prefix, input_format_name)
ouput_format_name = algorithm.loop_map['output']
self.output_data_format = DataFormat(prefix, ouput_format_name)
def set_executor(self, executor):
self.executor = executor
......@@ -113,11 +120,18 @@ class LoopMessageHandler(MessageHandler):
def validate(self, result):
"""Syntax: val"""
result = result.encode('utf-8')
logger.debug('recv: val %s', result)
retval = self.executor.validate(result)
data = self.input_data_format.type()
data.unpack(result)
is_valid, retval = self.executor.validate(data)
self.socket.send_string("True" if retval else "False")
data = make_data_format(retval, self.output_data_format)
self.socket.send_string("True" if is_valid else "False", zmq.SNDMORE)
self.socket.send(data.pack())
class Executor(object):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment