runOneScenario method introduced to default Execution plugin. run method...

runOneScenario method introduced to default Execution plugin. run method invoke this one and populates a result_list of the all-in-one-file
parent e10bf153
...@@ -27,6 +27,11 @@ class Plugin(object): ...@@ -27,6 +27,11 @@ class Plugin(object):
class ExecutionPlugin(Plugin): class ExecutionPlugin(Plugin):
"""Plugin to handle the execution of multiple simulation runs. """Plugin to handle the execution of multiple simulation runs.
""" """
def runOneScenario(self, data):
"""default method for running one scenario
"""
return json.loads(simulate_line_json(input_data=json.dumps(data)))
def run(self, data): def run(self, data):
"""General execution plugin. """General execution plugin.
""" """
...@@ -48,7 +53,13 @@ class DefaultExecutionPlugin(ExecutionPlugin): ...@@ -48,7 +53,13 @@ class DefaultExecutionPlugin(ExecutionPlugin):
"""Default Execution Plugin just executes one scenario. """Default Execution Plugin just executes one scenario.
""" """
def run(self, data): def run(self, data):
return json.loads(simulate_line_json(input_data=json.dumps(data))) """Run simulation and return result to the GUI.
"""
data["result"]["result_list"].append(self.runOneScenario(data))
# data["result"] = self.runOneScenario(data)
data["result"]["result_list"][-1]["score"] = 0
data["result"]["result_list"][-1]["key"] = "default"
return data
class PluginRegistry(object): class PluginRegistry(object):
"""Registry of plugins. """Registry of plugins.
...@@ -69,10 +80,7 @@ class PluginRegistry(object): ...@@ -69,10 +80,7 @@ class PluginRegistry(object):
for input_preparation in self.input_preparation_list: for input_preparation in self.input_preparation_list:
data = input_preparation.preprocess(deepcopy(data)) data = input_preparation.preprocess(deepcopy(data))
print 1 data = self.execution_plugin.run(data)
data["result"] = self.execution_plugin.run(data)
print 2
print data
for output_preparation in self.output_preparation_list: for output_preparation in self.output_preparation_list:
data = output_preparation.postprocess(deepcopy(data)) data = output_preparation.postprocess(deepcopy(data))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment