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

[algorithm] Add write method to runner

This method will be called on the loop when
an output is written by the loop user algorithm.
parent 40dfccfd
......@@ -325,6 +325,24 @@ class Runner(object):
return answer
def write(self, outputs):
"""Write to the outputs"""
exc = self.exc or RuntimeError
if self.algorithm.type != Algorithm.LOOP:
raise exc("Wrong algorithm type: %s" % self.algorithm.type)
# setup() must have run
if not self.ready:
raise exc("Algorithm '%s' is not yet setup" % self.name)
# prepare() must have run
if not self.prepared:
raise exc("Algorithm '%s' is not yet prepared" % self.name)
return loader.run(self.obj, "write", self.exc, outputs)
def __getattr__(self, key):
"""Returns an attribute of the algorithm - only called at last resort
"""
......
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