From 7a88b0865d80e8005b950b35694b2391f038811c Mon Sep 17 00:00:00 2001
From: James Johnson <jjohnson@enthought.com>
Date: Tue, 26 Jun 2018 10:37:13 +0100
Subject: [PATCH] Kpi check added to verifier

---
 force_bdss/core/verifier.py | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/force_bdss/core/verifier.py b/force_bdss/core/verifier.py
index 3361f35..8d53f50 100644
--- a/force_bdss/core/verifier.py
+++ b/force_bdss/core/verifier.py
@@ -9,6 +9,7 @@ class VerifierError(HasStrictTraits):
     error = Str()
 
 
+
 def verify_workflow(workflow):
     """Verifies if the workflow can be executed, and specifies where the
     error occurs and why.
@@ -45,6 +46,14 @@ def _check_mco(workflow):
         if len(param.type.strip()) == 0:
             errors.append(VerifierError(subject=param,
                                         error="Parameter has empty type"))
+
+    for kpi in mco.kpis:
+        if len(kpi.name.strip()) == 0:
+            errors.append(VerifierError(subject=kpi,
+                                        error="Kpi has empty name"))
+        if len(kpi.objective.strip()) == 0:
+            errors.append(VerifierError(subject=kpi,
+                                        error="Kpi objective is not set"))
     return errors
 
 
@@ -72,7 +81,6 @@ def _check_execution_layers(workflow):
 
     return errors
 
-
 def _check_data_source(data_source_model):
     errors = []
 
-- 
GitLab