|
|
@@ -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: Tue Oct 31 14:39:52 2017
|
|
|
+Date: Mon Nov 6 09:05:16 2017
|
|
|
|
|
|
Model author: Yentl Van Tendeloo
|
|
|
Model name: MvK Server
|
|
|
@@ -108,11 +108,9 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
|
|
|
# user defined method
|
|
|
- def expect_input(self, context, expected):
|
|
|
- if isinstance(expected, list):
|
|
|
- return self.inputs[context] and self.inputs[context][0]["name"] in expected
|
|
|
- else:
|
|
|
- return self.inputs[context] and self.inputs[context][0]["name"] == expected
|
|
|
+ def expect_input(self, context):
|
|
|
+ print("Expect_input for %s" % self.inputs[context])
|
|
|
+ return len(self.inputs[context]) > 0
|
|
|
|
|
|
|
|
|
# builds Statechart structure
|
|
|
@@ -140,6 +138,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
|
|
|
# state /initialized/http_mapper/finished
|
|
|
self.states["/initialized/http_mapper/finished"] = State(6, "/initialized/http_mapper/finished", self)
|
|
|
+ self.states["/initialized/http_mapper/finished"].setEnter(self._initialized_http_mapper_finished_enter)
|
|
|
|
|
|
# state /initialized/behaviour
|
|
|
self.states["/initialized/behaviour"] = State(7, "/initialized/behaviour", self)
|
|
|
@@ -1962,6 +1961,9 @@ class Modelverse(RuntimeClassBase):
|
|
|
self.big_step.outputEventOM(Event("create_instance", None, [self, 'http_client', 'HTTPClient']))
|
|
|
self.big_step.outputEventOM(Event("create_instance", None, [self, 'http_client', 'HTTPClient']))
|
|
|
|
|
|
+ def _initialized_http_mapper_finished_enter(self):
|
|
|
+ print("Finished output thread")
|
|
|
+
|
|
|
def _initialized_behaviour_operations_model_list_enter(self):
|
|
|
self.raiseInternalEvent(Event("request", None, [['model_list', self.parameters[0]]]))
|
|
|
|
|
|
@@ -2033,6 +2035,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
def _initialized_behaviour_operations_store_on_scripted_transformation_execute_send_operation_enter(self):
|
|
|
self.raiseInternalEvent(Event("request", None, [['transformation_execute', self.parameters[0]] + self.dict_to_list(self.parameters[1]) + self.dict_to_list(self.parameters[2]) + [self.parameters[3]]]))
|
|
|
if self.parameters[4] == False:
|
|
|
+ print("Finish output thread")
|
|
|
self.finish_output_thread = True
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_transformation_execute_MANUAL_send_metadata_enter(self):
|
|
|
@@ -2421,7 +2424,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
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"])]))
|
|
|
self.responses.append(json.loads(data))
|
|
|
- #print("Got data: " + str(json.loads(data)))
|
|
|
+ print("Got data %s for %s." % (json.loads(data), self.taskname))
|
|
|
|
|
|
def _initialized_http_mapper_init_3_guard(self, parameters):
|
|
|
data = parameters[0]
|
|
|
@@ -2431,6 +2434,7 @@ class Modelverse(RuntimeClassBase):
|
|
|
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"])]))
|
|
|
self.responses.append(json.loads(data))
|
|
|
+ print("Got final data %s for %s." % (json.loads(data), self.taskname))
|
|
|
|
|
|
def _initialized_http_mapper_init_4_guard(self, parameters):
|
|
|
data = parameters[0]
|
|
|
@@ -2674,10 +2678,10 @@ class Modelverse(RuntimeClassBase):
|
|
|
return not (self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)) and self.expect_response_partial('', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_transformation_execute_dialog_2_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("request", None, [self.inputs[self.input_context].pop(0)['parameters']]))
|
|
|
+ self.raiseInternalEvent(Event("request", None, [self.inputs[self.input_context].pop(0)]))
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_transformation_execute_dialog_2_guard(self, parameters):
|
|
|
- return self.expect_input(self.input_context, 'data_input')
|
|
|
+ return self.expect_input(self.input_context)
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_transformation_execute_MANUAL_send_metadata_0_guard(self, parameters):
|
|
|
return self.expect_response('Success: ready for MANUAL execution')
|
|
|
@@ -2733,10 +2737,10 @@ class Modelverse(RuntimeClassBase):
|
|
|
return not (self.expect_response('Success', pop=False) or self.expect_response('Failure', pop=False)) and self.expect_response_partial('', pop=False)
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_process_execute_enacting_sc_processing_1_exec(self, parameters):
|
|
|
- self.raiseInternalEvent(Event("request", None, [self.inputs[self.input_context].pop(0)['parameters']]))
|
|
|
+ self.raiseInternalEvent(Event("request", None, [self.inputs[self.input_context].pop(0)]))
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_process_execute_enacting_sc_processing_1_guard(self, parameters):
|
|
|
- return self.expect_input(self.input_context, 'data_input')
|
|
|
+ return self.expect_input(self.input_context)
|
|
|
|
|
|
def _initialized_behaviour_operations_store_on_scripted_process_execute_enacting_op_init_0_exec(self, parameters):
|
|
|
self.context = str(uuid.uuid4())
|