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

[algorithm] Implement distinction of sequential and autonomous loop

parent 89f83797
......@@ -307,7 +307,7 @@ class Runner(object):
exc = self.exc or RuntimeError
if self.algorithm.type != Algorithm.LOOP:
if not self.algorithm.is_loop:
raise exc("Wrong algorithm type: %s" % self.algorithm.type)
# setup() must have run
......@@ -327,9 +327,10 @@ class Runner(object):
def write(self, outputs, end_data_index):
"""Write to the outputs"""
exc = self.exc or RuntimeError
if self.algorithm.type != Algorithm.LOOP:
if not self.algorithm.is_loop:
raise exc("Wrong algorithm type: %s" % self.algorithm.type)
# setup() must have run
......@@ -427,7 +428,8 @@ class Algorithm(object):
LEGACY = "legacy"
SEQUENTIAL = "sequential"
AUTONOMOUS = "autonomous"
LOOP = "loop"
SEQUENTIAL_LOOP = "sequential_loop"
AUTONOMOUS_LOOP = "autonomous_loop"
SEQUENTIAL_LOOP_USER = "sequential_loop_user"
AUTONOMOUS_LOOP_USER = "autonomous_loop_user"
......@@ -673,14 +675,22 @@ class Algorithm(object):
""" Returns whether the algorithm is in the autonomous category"""
return self.type in [
Algorithm.AUTONOMOUS,
Algorithm.AUTONOMOUS_LOOP,
Algorithm.AUTONOMOUS_LOOP_USER,
Algorithm.LOOP,
]
@property
def is_sequential(self):
""" Returns whether the algorithm is in the sequential category"""
return self.type in [Algorithm.SEQUENTIAL, Algorithm.SEQUENTIAL_LOOP_USER]
return self.type in [
Algorithm.SEQUENTIAL,
Algorithm.SEQUENTIAL_LOOP,
Algorithm.SEQUENTIAL_LOOP_USER,
]
@property
def is_loop(self):
return self.type in [Algorithm.SEQUENTIAL_LOOP, Algorithm.AUTONOMOUS_LOOP]
@language.setter
def language(self, value):
......
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