浏览代码

Remove lots of logs

Yentl Van Tendeloo 8 年之前
父节点
当前提交
5ba3036883

+ 0 - 3
bootstrap/core_algorithm.alc

@@ -1394,7 +1394,6 @@ String function cmd_model_list(location : String):
 
 String function cmd_model_list_full(location : String):
 	// List all models with full info
-	log("Start up model_full_list with location: " + cast_v2s(location))
 	if (get_entry_id(location) != ""):
 		if (allow_read(current_user_id, get_entry_id(location))):
 			Element models
@@ -2073,7 +2072,6 @@ Void function user_function_skip_init(user_id : String):
 
 	while (True):
 		cmd = input()
-		log("Got command: " + cast_v2s(cmd))
 		if (cmd == "help"):
 			output(cmd_help())
 		elif (cmd == "model_add"):
@@ -2099,7 +2097,6 @@ Void function user_function_skip_init(user_id : String):
 		elif (cmd == "model_list"):
 			output(cmd_model_list(single_input("Location?")))
 		elif (cmd == "model_list_full"):
-			log("Start model_list_full")
 			output(cmd_model_list_full(single_input("Location?")))
 		elif (cmd == "transformation_add_MANUAL"):
 			output(cmd_transformation_add_MANUAL(dict_input("Source model names?"), dict_input("Target model names?"), single_input("Operation name?")))

+ 0 - 1
bootstrap/mini_modify.alc

@@ -391,7 +391,6 @@ Element function modify(model : Element, write : Boolean):
 
 	while (True):
 		cmd = input()
-		log("Got modelling command: " + cmd)
 		if (cmd == "help"):
 			output(cmd_help_m(write))
 		elif (cmd == "exit"):

+ 2 - 2
bootstrap/transform.alc

@@ -544,7 +544,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	Element mapping
 	Boolean result
 
-	log("Executing rule: " + current)
+	//log("Executing rule: " + current)
 
 	mappings = full_match(host_model, schedule_model, current, False)
 
@@ -553,7 +553,7 @@ Boolean function transform_forall(host_model : Element, schedule_model : Element
 	else:
 		result = False
 
-	log("Matches in forall: " + cast_v2s(set_len(mappings)))
+	//log("Matches in forall: " + cast_v2s(set_len(mappings)))
 	while (set_len(mappings) > 0):
 		mapping = set_pop(mappings)
 		RHS = set_pop(allAssociationDestinations(schedule_model, current, "RHSLink"))

+ 2 - 29
wrappers/classes/modelverse.xml

@@ -39,8 +39,6 @@
         <parameter name="expected"/>
         <parameter name="pop" default="True"/>
         <body>
-            #print("Expect response " + str(expected))
-            #print("Got responses: " + str(self.responses))
             if self.responses and self.responses[0] == expected:
                 if pop:
                     del self.responses[0]
@@ -54,8 +52,6 @@
         <parameter name="expected"/>
         <parameter name="pop" default="False"/>
         <body>
-            #print("Expect partial response " + str(expected))
-            #print("Got responses: " + str(self.responses))
             if self.responses and self.responses[0].startswith(expected):
                 if pop:
                     del self.responses[0]
@@ -69,9 +65,6 @@
         <parameter name="context"/>
         <parameter name="expected"/>
         <body>
-            #print("Expected action: " + str(expected))
-            #print("Context: " + str(context))
-            #print("Actions: " + str(self.actions[context]))
             if isinstance(expected, list):
                 return self.actions[context] and self.actions[context][0]["name"] in expected
             else:
@@ -83,9 +76,6 @@
         <parameter name="context"/>
         <parameter name="expected"/>
         <body>
-            #print("Expected action: " + str(expected))
-            #print("Context: " + str(context))
-            #print("Actions: " + str(self.actions[context]))
             if isinstance(expected, list):
                 return self.inputs[context] and self.inputs[context][0]["name"] in expected
             else:
@@ -175,7 +165,6 @@
                             <parameter expr='"parent"'/>
                         </raise>
                         <script>
-                            print("Got input from HTTP: " + str(data))
                             self.responses.append(json.loads(data))
                         </script>
                     </transition>
@@ -1074,9 +1063,6 @@
                         </onentry>
 
                         <transition cond="self.expect_response_partial('Success: ', pop=False)" target="../../wait_for_action/history">
-                            <script>
-                                print("ELN returns: " + str(json.loads(self.split_response(self.responses[0])[0])))
-                            </script>
                             <raise event="result">
                                 <parameter expr="json.loads(self.split_response(self.responses.pop(0))[0])"/>
                             </raise>
@@ -1591,12 +1577,7 @@
                             <state id="manual">
                                 <transition cond="self.expect_action(self.context, 'exit')" target="../../../../leaving_manual"/>
 
-                                <transition cond="self.actions[self.context] and self.actions[self.context][0]['parameters'][0] != self.current_model" target="../../../../leaving_manual">
-                                    <script>
-                                        print("Sudden switch between two models: perform context switch!")
-                                        print("Requested operation for " + str(self.actions[self.context][0]['parameters'][0]))
-                                    </script>
-                                </transition>
+                                <transition cond="self.actions[self.context] and self.actions[self.context][0]['parameters'][0] != self.current_model" target="../../../../leaving_manual"/>
                             </state>
 
                             <state id="scripted">
@@ -1604,9 +1585,6 @@
                                     <raise event="request">
                                         <parameter expr="'exit'"/>
                                     </raise>
-                                    <script>
-                                        print("Returning to history of operations!")
-                                    </script>
                                 </transition>
                             </state>
 
@@ -1736,11 +1714,7 @@
                             </raise>
                         </transition>
 
-                        <transition cond="self.context is None and self.actions[None]" target="../../leaving_manual">
-                            <script>
-                                print("Got megamodelling operation in model (%s) : transferring" % self.actions[None][0])
-                            </script>
-                        </transition>
+                        <transition cond="self.context is None and self.actions[None]" target="../../leaving_manual"/>
                     </state>
 
                     <state id="finished"/>
@@ -1790,7 +1764,6 @@
                     <onentry>
                         <script>
                             self.current_model = None
-                            print("GOING SCRIPTED")
                         </script>
                     </onentry>
 

+ 0 - 19
wrappers/modelverse.py

@@ -53,20 +53,14 @@ def _next_ID():
     return ID
 
 def INPUT(action, context, parameters):
-    print("Executing " + str(action))
-    print("Parameters: " + str(parameters))
-    print("In context: " + str(context))
     controller.addInput(Event("action", "action_in", [action, _next_ID(), context, parameters]))
 
 def OUTPUT():
     while 1:
         response = responses.fetch(-1)
-        print("Got response with name: " + str(response.name))
         if response.name == "result":
-            print("Value: " + str(response.parameters[1]))
             return response.parameters[1]
         elif response.name == "exception":
-            print("Exception: " + str(response.parameters))
             if response.parameters[1] == "UnknownIdentifier":
                 raise UnknownIdentifier()
             elif response.parameters[1] == "UnknownMetamodellingHierarchy":
@@ -145,7 +139,6 @@ def transformation_add_MT(source_metamodels, target_metamodels, operation_name,
     context = OUTPUT()
     if callback is not None:
         callback(context)
-    print("Callback finished; sending exit")
     INPUT("exit", context, [])
     return OUTPUT()
 
@@ -161,9 +154,7 @@ def transformation_add_MANUAL(source_metamodels, target_metamodels, operation_na
     INPUT("transformation_add_MANUAL", None, [source_metamodels, target_metamodels, operation_name])
     context = OUTPUT()
     if callback is not None:
-        print("DOING CALLBACK FOR MANUAL")
         callback(context)
-        print("CALLBACK FINISHED")
     INPUT("exit", context, [])
     return OUTPUT()
 
@@ -180,7 +171,6 @@ def transformation_execute_MT(operation_name, input_models_dict, output_models_d
             # Fetch output from the MV
             response = responses.fetch(0)
             if response is not None:
-                print("Got response from MV: " + str(response))
                 if response.name == "data_output":
                     # Got output of MV, so forward to SCCD
                     statechart[0].addInput(Event("input", statechart[1], response.parameters))
@@ -193,7 +183,6 @@ def transformation_execute_MT(operation_name, input_models_dict, output_models_d
             # Fetch output from the SC
             response = port_sc.fetch(0)
             if response is not None:
-                print("Got response from SC: " + str(response))
                 if response.name == "output":
                     controller.addInput(Event("data_input", "action_in", [response.parameters, context]))
                 empty = False
@@ -217,7 +206,6 @@ def transformation_execute_AL(operation_name, input_models_dict, output_models_d
             # Fetch output from the MV
             response = responses.fetch(0)
             if response is not None:
-                print("Got response from MV: " + str(response))
                 if response.name == "data_output":
                     # Got output of MV, so forward to SCCD
                     statechart[0].addInput(Event("input", statechart[1], response.parameters))
@@ -230,7 +218,6 @@ def transformation_execute_AL(operation_name, input_models_dict, output_models_d
             # Fetch output from the SC
             response = port_sc.fetch(0)
             if response is not None:
-                print("Got response from SC: " + str(response))
                 if response.name == "output":
                     controller.addInput(Event("data_input", "action_in", [response.parameters, context]))
                 empty = False
@@ -401,10 +388,8 @@ def process_execute(process_name, prefix, callbacks=None):
 
     operation = OUTPUT()
     while 1:
-        print("Operation: " + str(operation))
         if isinstance(operation, (list, tuple)):
             t, name, context = operation
-            print("Executing operation of type %s with name %s in context %s" % (t, name, context))
             if t == "OP":
                 if name in callbacks:
                     callbacks[name](context)
@@ -422,7 +407,6 @@ def process_execute(process_name, prefix, callbacks=None):
                     # Fetch output from the MV
                     response = responses.fetch(0)
                     if response is not None:
-                        print("Got response from MV: " + str(response))
                         if response.name == "data_output":
                             # Got output of MV, so forward to SCCD
                             if statechart:
@@ -440,7 +424,6 @@ def process_execute(process_name, prefix, callbacks=None):
                     if statechart:
                         response = sc_ports[name].fetch(0)
                         if response is not None:
-                            print("Got response from SC: " + str(response))
                             if response.name == "output":
                                 controller.addInput(Event("data_input", "action_in", [response.parameters, context]))
                             empty = False
@@ -451,5 +434,3 @@ def process_execute(process_name, prefix, callbacks=None):
             if operation == "Finished":
                 # Finished execution of the process, so exit
                 return None
-        
-        # TODO monitor the new function and execute the correct callback

+ 1 - 24
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Wed Sep  6 13:13:16 2017
+Date:   Wed Sep  6 15:29:44 2017
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server
@@ -78,8 +78,6 @@ class Modelverse(RuntimeClassBase):
     # user defined method
     def expect_response(self, expected, pop = None):
         if pop == None: pop = True
-        #print("Expect response " + str(expected))
-        #print("Got responses: " + str(self.responses))
         if self.responses and self.responses[0] == expected:
             if pop:
                 del self.responses[0]
@@ -91,8 +89,6 @@ class Modelverse(RuntimeClassBase):
     # user defined method
     def expect_response_partial(self, expected, pop = None):
         if pop == None: pop = False
-        #print("Expect partial response " + str(expected))
-        #print("Got responses: " + str(self.responses))
         if self.responses and self.responses[0].startswith(expected):
             if pop:
                 del self.responses[0]
@@ -103,9 +99,6 @@ class Modelverse(RuntimeClassBase):
     
     # user defined method
     def expect_action(self, context, expected):
-        #print("Expected action: " + str(expected))
-        #print("Context: " + str(context))
-        #print("Actions: " + str(self.actions[context]))
         if isinstance(expected, list):
             return self.actions[context] and self.actions[context][0]["name"] in expected
         else:
@@ -114,9 +107,6 @@ class Modelverse(RuntimeClassBase):
     
     # user defined method
     def expect_input(self, context, expected):
-        #print("Expected action: " + str(expected))
-        #print("Context: " + str(context))
-        #print("Actions: " + str(self.actions[context]))
         if isinstance(expected, list):
             return self.inputs[context] and self.inputs[context][0]["name"] in expected
         else:
@@ -1532,7 +1522,6 @@ class Modelverse(RuntimeClassBase):
         _initialized_behaviour_wait_for_action_modelling_recognized_manual_0.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_0_guard)
         self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_manual_0)
         _initialized_behaviour_wait_for_action_modelling_recognized_manual_1 = Transition(self, self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"], [self.states["/initialized/behaviour/leaving_manual"]])
-        _initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setAction(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_1_exec)
         _initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setTrigger(None)
         _initialized_behaviour_wait_for_action_modelling_recognized_manual_1.setGuard(self._initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard)
         self.states["/initialized/behaviour/wait_for_action/modelling/recognized/manual"].addTransition(_initialized_behaviour_wait_for_action_modelling_recognized_manual_1)
@@ -1631,7 +1620,6 @@ class Modelverse(RuntimeClassBase):
         _initialized_behaviour_wait_for_action_modelling_0.setGuard(self._initialized_behaviour_wait_for_action_modelling_0_guard)
         self.states["/initialized/behaviour/wait_for_action/modelling"].addTransition(_initialized_behaviour_wait_for_action_modelling_0)
         _initialized_behaviour_wait_for_action_modelling_1 = Transition(self, self.states["/initialized/behaviour/wait_for_action/modelling"], [self.states["/initialized/behaviour/leaving_manual"]])
-        _initialized_behaviour_wait_for_action_modelling_1.setAction(self._initialized_behaviour_wait_for_action_modelling_1_exec)
         _initialized_behaviour_wait_for_action_modelling_1.setTrigger(None)
         _initialized_behaviour_wait_for_action_modelling_1.setGuard(self._initialized_behaviour_wait_for_action_modelling_1_guard)
         self.states["/initialized/behaviour/wait_for_action/modelling"].addTransition(_initialized_behaviour_wait_for_action_modelling_1)
@@ -1937,7 +1925,6 @@ class Modelverse(RuntimeClassBase):
     
     def _initialized_behaviour_going_scripted_enter(self):
         self.current_model = None
-        print("GOING SCRIPTED")
     
     def _initialized_behaviour_leaving_manual_enter(self):
         self.raiseInternalEvent(Event("request", None, ['exit']))
@@ -1982,9 +1969,6 @@ class Modelverse(RuntimeClassBase):
     def _initialized_behaviour_wait_for_action_modelling_0_guard(self, parameters):
         return self.context is not None and self.actions[self.context]
     
-    def _initialized_behaviour_wait_for_action_modelling_1_exec(self, parameters):
-        print("Got megamodelling operation in model (%s) : transferring" % self.actions[None][0])
-    
     def _initialized_behaviour_wait_for_action_modelling_1_guard(self, parameters):
         return self.context is None and self.actions[None]
     
@@ -2135,7 +2119,6 @@ class Modelverse(RuntimeClassBase):
     def _initialized_http_mapper_init_3_exec(self, parameters):
         data = parameters[0]
         self.big_step.outputEventOM(Event("narrow_cast", None, [self, self.http_clients[1], Event("HTTP_input", None, [urllib.urlencode({"op": "get_output", "taskname": self.taskname}), "parent"])]))
-        print("Got input from HTTP: " + str(data))
         self.responses.append(json.loads(data))
     
     def _initialized_behaviour_init_connect_http_client_0_exec(self, parameters):
@@ -2534,7 +2517,6 @@ class Modelverse(RuntimeClassBase):
         return self.expect_response_partial('Success: ', pop=False)
     
     def _initialized_behaviour_operations_element_list_nice_0_exec(self, parameters):
-        print("ELN returns: " + str(json.loads(self.split_response(self.responses[0])[0])))
         self.raiseInternalEvent(Event("result", None, [json.loads(self.split_response(self.responses.pop(0))[0])]))
     
     def _initialized_behaviour_operations_element_list_nice_0_guard(self, parameters):
@@ -2887,16 +2869,11 @@ class Modelverse(RuntimeClassBase):
     def _initialized_behaviour_wait_for_action_modelling_recognized_manual_0_guard(self, parameters):
         return self.expect_action(self.context, 'exit')
     
-    def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_exec(self, parameters):
-        print("Sudden switch between two models: perform context switch!")
-        print("Requested operation for " + str(self.actions[self.context][0]['parameters'][0]))
-    
     def _initialized_behaviour_wait_for_action_modelling_recognized_manual_1_guard(self, parameters):
         return self.actions[self.context] and self.actions[self.context][0]['parameters'][0] != self.current_model
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_exec(self, parameters):
         self.raiseInternalEvent(Event("request", None, ['exit']))
-        print("Returning to history of operations!")
     
     def _initialized_behaviour_wait_for_action_modelling_recognized_scripted_0_guard(self, parameters):
         return self.expect_action(self.context, 'exit')