Browse Source

Fixed PM execution

Yentl Van Tendeloo 8 years ago
parent
commit
00f598ee6c
3 changed files with 9 additions and 24 deletions
  1. 0 8
      bootstrap/core_algorithm.alc
  2. 5 0
      integration/test_powerwindow.py
  3. 4 16
      wrappers/modelverse.py

+ 0 - 8
bootstrap/core_algorithm.alc

@@ -528,7 +528,6 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
 
 	while (bool_not(pm_finished(worklist, pm))):
 		// Pop a random element from the list and execute it
-		log("POP WL")
 		tuple = set_pop(worklist)
 		element = tuple[0]
 		result = tuple[1]
@@ -576,12 +575,10 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
 			// in this context, that means that if it is false, we should add it manually to the list, and then continue the simulation loop
 			if (bool_not(result)):
 				// Apparently it is False, so map this to the "Else" branch
-				log("POP ELSE")
 				set_add_node(worklist, create_tuple(set_pop(allAssociationDestinations(pm, element, "Else")), True))
 				continue!
 			else:
 				// Apparently it is True, so map this to the "Then" branch
-				log("POP THEN")
 				set_add_node(worklist, create_tuple(set_pop(allAssociationDestinations(pm, element, "Then")), True))
 				continue!
 
@@ -590,7 +587,6 @@ Void function enact_PM(pm : Element, prefix : String, user_id : String):
 		all_next = allAssociationDestinations(pm, element, "Next")
 		String next
 		while (set_len(all_next) > 0):
-			log("POP1")
 			next = set_pop(all_next)
 			set_add_node(worklist, create_tuple(next, result))
 
@@ -775,13 +771,10 @@ String function cmd_model_render(user_id : String, model_name : String, mapper_n
 					result = execute_operation(mapper_ID, inputs, tracability_model)
 
 					// Overwrite the previous rendered model
-					log("Rendered model: " + cast_v2s(get_model_id(output_map["rendered"])))
 					model_overwrite(result["rendered"], get_model_id(rendered_name), get_model_id(output_map["rendered"]))
-					log("Abstract model: " + cast_v2s(get_model_id(output_map["abstract"])))
 					model_overwrite(result["abstract"], get_model_id(model_name), get_model_id(output_map["abstract"]))
 
 					// Tracability updated in-place
-					log("Tracability model: " + cast_v2s(get_model_id("Tracability")))
 					model_overwrite(tracability_model, get_model_id(tracability_name), get_model_id("Tracability"))
 					tracability_model = get_full_model(get_model_id(tracability_name), get_model_id("Tracability"))
 
@@ -880,7 +873,6 @@ String function cmd_transformation_execute(user_id : String, transformation_name
 				else:
 					output("Success: ready for MT execution")
 
-				log("Start execution: " + cast_e2s(transformation_id))
 				result = execute_operation(transformation_id, inputs, read_root())
 
 				// Now write out the models again

+ 5 - 0
integration/test_powerwindow.py

@@ -88,6 +88,7 @@ class TestPowerWindow(unittest.TestCase):
 
         def get_function(filename):
             def func():
+                print("Uploading " + filename)
                 global called
                 if called > len(callbacks):
                     raise Exception("Seemingly called some operation twice!")
@@ -118,6 +119,10 @@ class TestPowerWindow(unittest.TestCase):
             import traceback
             print(traceback.format_exc())
 
+        if called != 6:
+            print(called)
+            raise Exception("Not executed sufficiently:" + str(called))
+
     @slow
     def test_process_powerwindow_debug(self):
         model_add("ReachabilityGraph", "SimpleClassDiagrams", open("models/reachability_graph.mvc", "r").read())

+ 4 - 16
wrappers/modelverse.py

@@ -386,8 +386,7 @@ def verify(model_name, metamodel_name=None):
 def model_overwrite(model_name, new_model=None, metamodel_name=None):
     """Upload a new model and overwrite an existing model."""
     global registered_metamodels
-    if mode not in [MODE_MODELLING, MODE_MODIFY, MODE_MANUAL]:
-        raise InvalidMode()
+    _goto_mode(MODE_MODIFY, model_name)
 
     if new_model is not None:
         try:
@@ -397,24 +396,13 @@ def model_overwrite(model_name, new_model=None, metamodel_name=None):
     else:
         compiled = ["exit"]
 
-    if mode == MODE_MODIFY:
-        _goto_mode(MODE_MODELLING)
-
-    if metamodel_name is None:
-        metamodel_name = registered_metamodels[model_name]
-
-    if mode == MODE_MODELLING:
-        _input(["model_overwrite", model_name, metamodel_name])
-    elif mode == MODE_MANUAL:
-        _input("upload")
-    else:
-        raise InvalidMode()
-
+    _input("upload")
     _handle_output("Waiting for model constructors...")
     _input(compiled)
     _output("Success")
 
-    registered_metamodels[model_name] = metamodel_name
+    if metamodel_name is not None:
+        registered_metamodels[model_name] = metamodel_name
 
 def user_logout():
     """Log out the current user and break the connection."""