Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
458622cc
Commit
458622cc
authored
Feb 21, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
methods moved to generic plugin object
parent
51adee60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
20 deletions
+20
-20
dream/plugins/plugin.py
dream/plugins/plugin.py
+20
-20
No files found.
dream/plugins/plugin.py
View file @
458622cc
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment