Commit f8eabdc4 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][loop] Implement output setup and writing

parent b554ed02
...@@ -48,7 +48,6 @@ import json ...@@ -48,7 +48,6 @@ import json
import zmq import zmq
from ..algorithm import Algorithm from ..algorithm import Algorithm
from ..baseformat import baseformat
from ..dataformat import DataFormat from ..dataformat import DataFormat
from ..helpers import create_inputs_from_configuration from ..helpers import create_inputs_from_configuration
from ..helpers import create_outputs_from_configuration from ..helpers import create_outputs_from_configuration
...@@ -209,6 +208,14 @@ class LoopExecutor(object): ...@@ -209,6 +208,14 @@ class LoopExecutor(object):
databases=databases, databases=databases,
) )
self.output_list, _ = create_outputs_from_configuration(
self.data,
self.algorithm,
self.prefix,
cache_root,
input_list=self.input_list,
)
self.message_handler = message_handler self.message_handler = message_handler
self.message_handler.setup(self.algorithm, self.prefix) self.message_handler.setup(self.algorithm, self.prefix)
self.message_handler.set_executor(self) self.message_handler.set_executor(self)
...@@ -251,6 +258,14 @@ class LoopExecutor(object): ...@@ -251,6 +258,14 @@ class LoopExecutor(object):
logger.debug("User loop has validated: {}\n{}".format(is_valid, answer)) logger.debug("User loop has validated: {}\n{}".format(is_valid, answer))
return is_valid, answer return is_valid, answer
def write(self):
"""Write the loop output"""
retval = self.runner.write(self.output_list)
logger.debug("User loop wrote output: {}".format(retval))
return retval
@property @property
def address(self): def address(self):
""" Address of the message handler""" """ Address of the message handler"""
...@@ -267,3 +282,9 @@ class LoopExecutor(object): ...@@ -267,3 +282,9 @@ class LoopExecutor(object):
self.message_handler.join() self.message_handler.join()
self.message_handler = None self.message_handler = None
def close(self):
"""Close all outputs"""
for output in self.output_list:
output.close()
Supports Markdown
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