Commit 458622cc authored by Georgios Dagkakis's avatar Georgios Dagkakis

methods moved to generic plugin object

parent 51adee60
......@@ -11,6 +11,26 @@ class Plugin(object):
def __init__(self, logger, configuration_dict):
self.logger = logger
self.configuration_dict = configuration_dict
# returns the predecessors of a node
def getPredecessors(self, data, node_id):
predecessors=[]
from copy import copy
edges=copy(data['graph']['edge'])
for edge_id,edge in edges.iteritems():
if edge['destination']==node_id:
predecessors.append(edge['source'])
return predecessors
# returns the successors of a node
def getSuccessors(self, data, node_id):
successors=[]
from copy import copy
edges=copy(data['graph']['edge'])
for edge_id,edge in edges.iteritems():
if edge['source']==node_id:
successors.append(edge['destination'])
return successors
class ExecutionPlugin(Plugin):
"""Plugin to handle the execution of multiple simulation runs.
......@@ -41,26 +61,6 @@ class InputPreparationPlugin(Plugin):
}
return data
# returns the predecessors of a node
def getPredecessors(self, data, node_id):
predecessors=[]
from copy import copy
edges=copy(data['graph']['edge'])
for edge_id,edge in edges.iteritems():
if edge['destination']==node_id:
predecessors.append(edge['source'])
return predecessors
# returns the successors of a node
def getSuccessors(self, data, node_id):
successors=[]
from copy import copy
edges=copy(data['graph']['edge'])
for edge_id,edge in edges.iteritems():
if edge['source']==node_id:
successors.append(edge['destination'])
return successors
class OutputPreparationPlugin(Plugin):
def postprocess(self, data):
"""Postprocess the data after simulation run.
......
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