Commit 8ead0326 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution] Implement loop reading logic

parent 3e2c4106
......@@ -238,6 +238,10 @@ class AlgorithmExecutor(object):
main_group.next()
main_group.restricted_access = True
if self.loop_socket:
self.loop_socket.send_string("rdi")
self.loop_socket.recv()
if self.algorithm.type == Algorithm.LEGACY:
if self.analysis:
result = self.runner.process(
......
......@@ -266,6 +266,15 @@ class LoopExecutor(object):
logger.debug("User loop wrote output: {}".format(retval))
return retval
def read(self):
"""Move input to next element and make it read"""
main_group = self.input_list.main_group
main_group.restricted_access = False
main_group.next()
main_group.restricted_access = True
return self.runner.read(self.input_list)
@property
def address(self):
""" Address of the message handler"""
......
......@@ -353,6 +353,8 @@ class LoopMessageHandler(MessageHandler):
self.callbacks.update({"val": self.validate})
self.callbacks.update({"wrt": self.write})
self.callbacks.update({"rdi": self.read})
self.executor = None
def setup(self, algorithm, prefix):
......@@ -420,3 +422,13 @@ class LoopMessageHandler(MessageHandler):
raise
finally:
self.socket.send_string("ack")
def read(self):
"""Read next data"""
try:
self.executor.read()
except Exception:
raise
finally:
self.socket.send_string("ack")
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