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
5a9dfa2d
Commit
5a9dfa2d
authored
Apr 02, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
initialize method added to Router
parent
ec5965ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
18 deletions
+35
-18
dream/simulation/Machine.py
dream/simulation/Machine.py
+19
-12
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+16
-6
No files found.
dream/simulation/Machine.py
View file @
5a9dfa2d
...
@@ -128,16 +128,29 @@ class Machine(CoreObject):
...
@@ -128,16 +128,29 @@ class Machine(CoreObject):
self
.
multOperationTypeList
=
OTlist
self
.
multOperationTypeList
=
OTlist
else
:
else
:
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
self
.
multOperationTypeList
.
append
(
self
.
operationType
)
# initiate the Broker and the router
if
(
self
.
operatorPool
!=
'None'
):
self
.
broker
=
Broker
(
self
)
from
Globals
import
G
# if there is no router in G.RouterList
if
len
(
G
.
RoutersList
)
==
0
:
self
.
router
=
Router
()
G
.
RoutersList
.
append
(
self
.
router
)
# otherwise set the already existing router as the machines Router
else
:
self
.
router
=
G
.
RoutersList
[
0
]
# lists to hold statistics of multiple runs
# lists to hold statistics of multiple runs
self
.
WaitingForOperator
=
[]
self
.
WaitingForOperator
=
[]
self
.
WaitingForLoadOperator
=
[]
self
.
WaitingForLoadOperator
=
[]
self
.
Loading
=
[]
self
.
Loading
=
[]
self
.
SettingUp
=
[]
self
.
SettingUp
=
[]
# flags used for preemption purposes
self
.
isPreemptive
=
isPreemptive
self
.
isPreemptive
=
isPreemptive
self
.
resetOnPreemption
=
resetOnPreemption
self
.
resetOnPreemption
=
resetOnPreemption
# event used by the router
self
.
routerCycleOver
=
SimEvent
(
'routerCycleOver'
)
self
.
routerCycleOver
=
SimEvent
(
'routerCycleOver'
)
# =======================================================================
# =======================================================================
# initialize the machine
# initialize the machine
...
@@ -152,18 +165,12 @@ class Machine(CoreObject):
...
@@ -152,18 +165,12 @@ class Machine(CoreObject):
# initialize the operator pool if any
# initialize the operator pool if any
if
(
self
.
operatorPool
!=
"None"
):
if
(
self
.
operatorPool
!=
"None"
):
self
.
operatorPool
.
initialize
()
self
.
operatorPool
.
initialize
()
self
.
broker
=
Broker
(
self
)
self
.
broker
.
initialize
(
)
activate
(
self
.
broker
,
self
.
broker
.
run
())
activate
(
self
.
broker
,
self
.
broker
.
run
())
# if there is no router in G.RouterList
# initialise the router only once
# initialise a new router
if
not
self
.
router
.
isInitialized
:
from
Globals
import
G
self
.
router
.
initialize
()
if
len
(
G
.
RoutersList
)
==
0
:
self
.
router
=
Router
()
activate
(
self
.
router
,
self
.
router
.
run
())
activate
(
self
.
router
,
self
.
router
.
run
())
G
.
RoutersList
.
append
(
self
.
router
)
# otherwise set the already existing router as the machines Router
else
:
self
.
router
=
G
.
RoutersList
[
0
]
for
operator
in
self
.
operatorPool
.
operators
:
for
operator
in
self
.
operatorPool
.
operators
:
operator
.
coreObjectIds
.
append
(
self
.
id
)
operator
.
coreObjectIds
.
append
(
self
.
id
)
operator
.
coreObjects
.
append
(
self
)
operator
.
coreObjects
.
append
(
self
)
...
...
dream/simulation/OperatorRouter.py
View file @
5a9dfa2d
...
@@ -46,20 +46,30 @@ class Router(ObjectInterruption):
...
@@ -46,20 +46,30 @@ class Router(ObjectInterruption):
self
.
type
=
"Router"
self
.
type
=
"Router"
# variable used to hand in control to the Broker
# variable used to hand in control to the Broker
self
.
call
=
False
self
.
call
=
False
# list that holds all the objects that can receive
self
.
pendingObjects
=
[]
self
.
calledOperators
=
[]
# signal used to initiate the generator of the Router
# signal used to initiate the generator of the Router
self
.
startCycle
=
SimEvent
(
'startCycle'
)
self
.
startCycle
=
SimEvent
(
'startCycle'
)
# # TODO: consider if there must be an argument set for the schedulingRules of the Router
# TODO: create an initialise method for router to reset the attributes for every replication
# self.schedulingRule=''
self
.
isInitialized
=
False
self
.
candidateOperators
=
[]
self
.
multipleCriterionList
=
[]
self
.
schedulingRule
=
'WT'
#===========================================================================
# the initialize method
#===========================================================================
def
initialize
(
self
):
ObjectInterruption
.
initialize
(
self
)
self
.
call
=
False
# list that holds all the objects that can receive
self
.
pendingObjects
=
[]
self
.
calledOperator
=
[]
# list of the operators that may handle a machine at the current simulation time
# list of the operators that may handle a machine at the current simulation time
self
.
candidateOperators
=
[]
self
.
candidateOperators
=
[]
# list of criteria
# list of criteria
self
.
multipleCriterionList
=
[]
self
.
multipleCriterionList
=
[]
# TODO: find out which must be the default for the scheduling Rule
# TODO: find out which must be the default for the scheduling Rule
self
.
schedulingRule
=
'WT'
self
.
schedulingRule
=
'WT'
# TODO: create an initialise method for router to reset the attributes for every replication
self
.
isInitialized
=
True
# =======================================================================
# =======================================================================
# the run method
# the run method
...
...
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