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
df5712d6
Commit
df5712d6
authored
Sep 09, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Machine and operatedPoolBroker updated
parent
b77c5256
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
36 deletions
+19
-36
dream/simulation/Machine.py
dream/simulation/Machine.py
+13
-34
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+6
-2
No files found.
dream/simulation/Machine.py
View file @
df5712d6
...
...
@@ -328,9 +328,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -358,13 +356,8 @@ class Machine(CoreObject):
# machine has to release the operator
self
.
releaseOperator
()
# wait until the Broker has finished processing
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
yield
self
.
brokerIsSet
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -451,9 +444,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -485,9 +476,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -518,9 +507,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -571,9 +558,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -594,6 +579,7 @@ class Machine(CoreObject):
if
oi
.
expectedSignals
[
'victimStartsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimStartsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimStartsProcess'
]
=
0
# this loop is repeated until the processing time is expired with no failure
...
...
@@ -629,7 +615,6 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
...
...
@@ -663,9 +648,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -683,7 +666,6 @@ class Machine(CoreObject):
self
.
releaseOperator
()
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
self
.
brokerIsSet
=
self
.
env
.
event
()
from
Globals
import
G
# append the entity that was stopped to the pending ones
...
...
@@ -693,7 +675,6 @@ class Machine(CoreObject):
self
.
requestOperator
()
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
self
.
brokerIsSet
=
self
.
env
.
event
()
# carry post interruption actions
self
.
postInterruptionActions
()
...
...
@@ -714,9 +695,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -745,9 +724,7 @@ class Machine(CoreObject):
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
transmitter
,
eventTime
=
self
.
brokerIsSet
.
value
assert
transmitter
==
self
.
broker
,
'brokerIsSet is not sent by the stations broker'
assert
eventTime
==
self
.
env
.
now
,
'brokerIsSet is not received on time'
...
...
@@ -890,6 +867,7 @@ class Machine(CoreObject):
if
oi
.
expectedSignals
[
'victimEndsProcess'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimEndsProcess
.
succeed
(
succeedTuple
)
oi
.
expectedSignals
[
'victimEndsProcess'
]
=
0
# in case Machine just performed the last work before the scheduled maintenance signal the corresponding object
if
self
.
isWorkingOnTheLast
:
...
...
@@ -902,7 +880,8 @@ class Machine(CoreObject):
if
interruption
.
expectedSignals
[
'endedLastProcessing'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
endedLastProcessing
.
succeed
(
succeedTuple
)
interruption
.
waitinSignal
=
False
interruption
.
waitingSignal
=
False
interruption
.
expectedSignals
[
'endedLastProcessing'
]
=
0
self
.
isWorkingOnTheLast
=
False
# set timeLastShiftEnded attribute so that if it is overtime working it is not counted as off-shift time
if
self
.
interruptedBy
==
'ShiftScheduler'
:
...
...
dream/simulation/OperatedPoolBroker.py
View file @
df5712d6
...
...
@@ -103,7 +103,8 @@ class Broker(ObjectInterruption):
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
self
.
waitForOperator
=
True
self
.
victim
.
printTrace
(
self
.
victim
.
id
,
waitEvent
=
'(resourceIsAvailable broker)'
)
...
...
@@ -157,12 +158,13 @@ class Broker(ObjectInterruption):
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
# update the schedule of the operator
self
.
victim
.
currentOperator
.
schedule
.
append
([
self
.
victim
,
self
.
env
.
now
])
# wait till the processing is over
self
.
expectedSignals
[
'isCalled'
]
=
1
yield
self
.
isCalled
self
.
expectedSignals
[
'isCalled'
]
=
0
...
...
@@ -184,6 +186,7 @@ class Broker(ObjectInterruption):
G
.
Router
.
invoked
=
True
succeedTuple
=
(
self
,
self
.
env
.
now
)
G
.
Router
.
isCalled
.
succeed
(
succeedTuple
)
G
.
Router
.
expectedSignals
[
'isCalled'
]
=
0
# TODO: signalling the router will give the chance to it to take the control, but when will it eventually receive it.
# after signalling the broker will signal it's victim that it has finished it's processes
# TODO: this wont work for the moment. The actions that follow must be performed by all operated brokers.
...
...
@@ -201,4 +204,5 @@ class Broker(ObjectInterruption):
if
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
self
.
victim
.
brokerIsSet
.
succeed
(
succeedTuple
)
self
.
victim
.
expectedSignals
[
'brokerIsSet'
]
=
0
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