diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json index 65181c1c98d42e73399ed1f793bf21d210ee38eb..f407f19b5ae4af3108acd9facc5330b62ce806ec 100644 --- a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json +++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.json @@ -11,8 +11,11 @@ "type": "user/single_integer/1" } }, - "outputs": { - "out": { + "loop": { + "input": { + "type": "user/single_integer/1" + }, + "output": { "type": "user/single_integer/1" } } diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py index 4406e7ecd9c7fed72286b72b59c1fcea520b726b..5c290d4db483dec9d85d4e787ebcc96ff81eae55 100644 --- a/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py +++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop/1.py @@ -28,6 +28,6 @@ class Algorithm: def validate(self, result): - value = int(result) + value = result.value - return value < 6 + return value < 6, {'value': 0} diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json index 43f7a57b22cfc5b4b94df6cbf93f27d1f37202e1..044a00c58749c9584a57f332a79e20de70cfdf96 100644 --- a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json +++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.json @@ -15,6 +15,14 @@ "out": { "type": "user/single_integer/1" } + }, + "loop": { + "input": { + "type": "user/single_integer/1" + }, + "output": { + "type": "user/single_integer/1" + } } } ] diff --git a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py index 56f50e13ebac3c706e934dbab14537759b4ec5e3..7aef7f6b0184c243a479758b1f97034c35f6b420 100644 --- a/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py +++ b/beat/backend/python/test/prefix/algorithms/autonomous/loop_user/1.py @@ -24,12 +24,13 @@ # with the BEAT platform. If not, see http://www.gnu.org/licenses/. # # # ############################################################################### +import numpy as np class Algorithm: def process(self, data_loaders, outputs, loop_channel): - cnt = 100 - while not loop_channel.is_result_valid(cnt): + cnt = np.uint8(100) + while not loop_channel.is_result_valid({'value': cnt}): cnt = cnt - 1 data_loader = data_loaders.loaderOf('in') diff --git a/beat/backend/python/test/test_loop_executor.py b/beat/backend/python/test/test_loop_executor.py index 0dce92ba6a0c0e275ee462759f1cfc105062d286..1878e4285d845d1ae6bc3e106941503929e6ec6b 100644 --- a/beat/backend/python/test/test_loop_executor.py +++ b/beat/backend/python/test/test_loop_executor.py @@ -78,6 +78,16 @@ CONFIGURATION = { 'channel': 'main' } }, + 'loop': { + 'input': { + 'path': 'LOOP', + 'channel': 'main' + }, + 'output': { + 'path': 'LOOP', + 'channel': 'main' + } + } }