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
0053c151
Commit
0053c151
authored
Mar 06, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unneeded check in broker removed
parent
ace10513
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
39 deletions
+25
-39
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+25
-39
No files found.
dream/simulation/OperatedPoolBroker.py
View file @
0053c151
...
@@ -91,49 +91,35 @@ class Broker(ObjectInterruption):
...
@@ -91,49 +91,35 @@ class Broker(ObjectInterruption):
self
.
timeWaitForOperatorStarted
=
self
.
env
.
now
self
.
timeWaitForOperatorStarted
=
self
.
env
.
now
#===============================================================
#===============================================================
from
Globals
import
G
from
Globals
import
G
# if the victim does not have a dedicated operator
if
not
self
.
victim
.
checkForDedicatedOperators
():
# if the victim already holds an entity that means that the machine's operation type
# if the victim already holds an entity that means that the machine's operation type
# is no Load or setup, in that case the router is already invoked and the machine is already assigned an operator
# is no Load or setup, in that case the router is already invoked and the machine is already assigned an operator
if
not
self
.
victimQueueIsEmpty
():
if
not
self
.
victimQueueIsEmpty
():
# add the currentEntity to the pendingEntities
# add the currentEntity to the pendingEntities
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
if
not
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
G
.
pendingEntities
.
append
(
self
.
victim
.
currentEntity
)
if
not
G
.
RouterList
[
0
].
invoked
and
G
.
RouterList
[
0
].
expectedSignals
[
'isCalled'
]:
if
not
G
.
RouterList
[
0
].
invoked
and
G
.
RouterList
[
0
].
expectedSignals
[
'isCalled'
]:
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
signal
=
'router (broker)'
)
self
.
sendSignal
(
receiver
=
G
.
RouterList
[
0
],
signal
=
G
.
RouterList
[
0
].
isCalled
)
self
.
sendSignal
(
receiver
=
G
.
RouterList
[
0
],
signal
=
G
.
RouterList
[
0
].
isCalled
)
G
.
RouterList
[
0
].
invoked
=
True
G
.
RouterList
[
0
].
invoked
=
True
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
expectedSignals
[
'resourceAvailable'
]
=
1
yield
self
.
resourceAvailable
transmitter
,
eventTime
=
self
.
resourceAvailable
.
value
self
.
resourceAvailable
=
self
.
env
.
event
()
# remove the currentEntity from the pendingEntities
if
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
self
.
victim
.
currentEntity
)
self
.
waitForOperator
=
False
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
resourceAvailable
=
'(broker)'
)
# else if the Router is already invoked for allocating purposes wait until a resource is allocated to the victim's operatorPool
# wait only if there is no current operator
# XXX discuss this
elif
G
.
RouterList
[
0
].
invoked
and
G
.
RouterList
[
0
].
allocation
and
not
self
.
victim
.
currentOperator
:
self
.
waitForOperator
=
True
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
self
.
expectedSignals
[
'resourceAvailable'
]
=
1
if
not
self
.
victim
.
operatorPool
.
checkIfResourceIsAvailable
():
yield
self
.
resourceAvailable
self
.
expectedSignals
[
'resourceAvailable'
]
=
1
yield
self
.
resourceAvailable
transmitter
,
eventTime
=
self
.
resourceAvailable
.
value
transmitter
,
eventTime
=
self
.
resourceAvailable
.
value
self
.
resourceAvailable
=
self
.
env
.
event
()
self
.
resourceAvailable
=
self
.
env
.
event
()
# remove the currentEntity from the pendingEntities
self
.
waitForOperator
=
False
if
self
.
victim
.
currentEntity
in
G
.
pendingEntities
:
G
.
pendingEntities
.
remove
(
self
.
victim
.
currentEntity
)
self
.
waitForOperator
=
False
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
resourceAvailable
=
'(broker)'
)
self
.
waitForOperator
=
False
#===============================================================
#===============================================================
assert
self
.
victim
.
operatorPool
.
checkIfResourceIsAvailable
(),
'there is no available operator to request'
assert
self
.
victim
.
operatorPool
.
checkIfResourceIsAvailable
(),
'there is no available operator to request'
# set the available resource as the currentOperator
# set the available resource as the currentOperator
currentOperator
=
None
currentOperator
=
None
...
...
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