Browse Source

Fix (?) for Simon

Yentl Van Tendeloo 9 years ago
parent
commit
f03e210d6d
3 changed files with 26 additions and 2 deletions
  1. 13 0
      interface/PDEVS/modelverse.py
  2. 0 2
      kernel/modelverse_kernel/main.py
  3. 13 0
      wrappers/modelverse.py

+ 13 - 0
interface/PDEVS/modelverse.py

@@ -63,6 +63,7 @@ registered_metamodels = {}
 outputs = {}
 ctrl_input = None
 ctrl_output = None
+finish_output_thread = False
 
 def _output_thread(controller, outp, task):
     req_out = controller.addOutputListener("request_out")
@@ -75,6 +76,8 @@ def _output_thread(controller, outp, task):
 
             if event.parameters[1] == my_id:
                 outp[task].append(json.loads(event.parameters[0]))
+                if finish_output_thread:
+                    break
     except:
         raise
 
@@ -528,6 +531,11 @@ def transformation_execute_AL(operation_name, input_models_dict, output_models_d
     mv_dict_rep = _dict_to_list(input_models_dict) + [""] + _dict_to_list(output_models_dict) + [""]
 
     _input(["transformation_execute", operation_name] + mv_dict_rep + [tracability_model])
+
+    if fetch_output == False:
+        global finish_output_thread
+        finish_output_thread = True
+
     _handle_output("Success: ready for AL execution")
 
     if statechart is not None:
@@ -585,6 +593,11 @@ def transformation_execute_MT(operation_name, input_models_dict, output_models_d
     mv_dict_rep = _dict_to_list(input_models_dict) + [""] + _dict_to_list(output_models_dict) + [""]
 
     _input(["transformation_execute", operation_name] + mv_dict_rep + [tracability_model])
+
+    if fetch_output == False:
+        global finish_output_thread
+        finish_output_thread = True
+
     _handle_output("Success: ready for MT execution")
 
     if statechart is not None:

+ 0 - 2
kernel/modelverse_kernel/main.py

@@ -257,8 +257,6 @@ class ModelverseKernel(object):
                                    ("CD", [task_root, "output", next_output]),
                                    ("DN", [first_output]),
                                   ]
-            print("Someone read output of taskname %s for value %s" % (taskname, rv_value))
-
             self.returnvalue = rv_value
             self.success = True
 

+ 13 - 0
wrappers/modelverse.py

@@ -63,6 +63,7 @@ registered_metamodels = {}
 outputs = {}
 ctrl_input = None
 ctrl_output = None
+finish_output_thread = False
 
 def _output_thread(controller, outp, task):
     req_out = controller.addOutputListener("request_out")
@@ -75,6 +76,8 @@ def _output_thread(controller, outp, task):
 
             if event.parameters[1] == my_id:
                 outp[task].append(json.loads(event.parameters[0]))
+                if finish_output_thread:
+                    break
     except:
         raise
 
@@ -528,6 +531,11 @@ def transformation_execute_AL(operation_name, input_models_dict, output_models_d
     mv_dict_rep = _dict_to_list(input_models_dict) + [""] + _dict_to_list(output_models_dict) + [""]
 
     _input(["transformation_execute", operation_name] + mv_dict_rep + [tracability_model])
+
+    if fetch_output == False:
+        global finish_output_thread
+        finish_output_thread = True
+
     _handle_output("Success: ready for AL execution")
 
     if statechart is not None:
@@ -585,6 +593,11 @@ def transformation_execute_MT(operation_name, input_models_dict, output_models_d
     mv_dict_rep = _dict_to_list(input_models_dict) + [""] + _dict_to_list(output_models_dict) + [""]
 
     _input(["transformation_execute", operation_name] + mv_dict_rep + [tracability_model])
+
+    if fetch_output == False:
+        global finish_output_thread
+        finish_output_thread = True
+
     _handle_output("Success: ready for MT execution")
 
     if statechart is not None: