Commit 3e2c4106 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[algorithm] Implement read method for loop

This method will trigger the reading of the input
by the loop algorithm.
parent c6270754
......@@ -340,8 +340,31 @@ class Runner(object):
# 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, end_data_index)
def read(self, inputs):
"""Triggers a read of the inputs
This is used by the loop when used in conjunction with a sequential
loop user.
"""
exc = self.exc or RuntimeError
if not self.algorithm.is_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, "read", self.exc, inputs)
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