From 46a94e42553b7d2f299a76f315dca82cf23b9ae4 Mon Sep 17 00:00:00 2001
From: Samuel Gaist <samuel.gaist@idiap.ch>
Date: Wed, 7 Nov 2018 09:46:55 +0100
Subject: [PATCH] [algorithm][loop] The validate method now returns a tuple

The tuple should contain a:
- boolean for success or failure
- dictionary with the data to return to the algorithm
---
 beat/backend/python/algorithm.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/beat/backend/python/algorithm.py b/beat/backend/python/algorithm.py
index fa63584..a322853 100644
--- a/beat/backend/python/algorithm.py
+++ b/beat/backend/python/algorithm.py
@@ -287,7 +287,13 @@ class Runner(object):
         if not self.prepared:
             raise exc("Algorithm '%s' is not yet prepared" % self.name)
 
-        return loader.run(self.obj, 'validate', self.exc, result)
+
+        answer = loader.run(self.obj, 'validate', self.exc, result)
+
+        if not isinstance(answer, tuple):
+            raise exc("Improper implementation: validate must return a tuple")
+
+        return answer
 
 
     def __getattr__(self, key):
-- 
GitLab