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
b77c5256
Commit
b77c5256
authored
Sep 09, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
processOperatorUnavailable signal to work in new way
parent
82a06417
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
dream/simulation/Machine.py
dream/simulation/Machine.py
+4
-0
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+8
-9
No files found.
dream/simulation/Machine.py
View file @
b77c5256
...
...
@@ -681,7 +681,9 @@ class Machine(CoreObject):
self
.
interruptionActions
()
# machine has to release the operator
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
...
...
@@ -689,7 +691,9 @@ class Machine(CoreObject):
G
.
pendingEntities
.
append
(
self
.
currentEntity
)
# machine has to request again for operaror
self
.
requestOperator
()
self
.
expectedSignals
[
'brokerIsSet'
]
=
1
yield
self
.
brokerIsSet
self
.
expectedSignals
[
'brokerIsSet'
]
=
0
self
.
brokerIsSet
=
self
.
env
.
event
()
# carry post interruption actions
self
.
postInterruptionActions
()
...
...
dream/simulation/ShiftScheduler.py
View file @
b77c5256
...
...
@@ -75,7 +75,7 @@ class ShiftScheduler(ObjectInterruption):
# interrupt the victim only if it was not previously interrupted
self
.
interruptVictim
()
# interrupt the victim
else
:
CoreObject
.
requestAllocation
()
self
.
requestAllocation
()
self
.
victim
.
timeLastShiftEnded
=
self
.
env
.
now
self
.
outputTrace
(
self
.
victim
.
name
,
"is off shift"
)
...
...
@@ -85,10 +85,15 @@ class ShiftScheduler(ObjectInterruption):
yield
self
.
env
.
timeout
(
float
(
self
.
remainingShiftPattern
[
0
][
0
]
-
self
.
env
.
now
))
# wait for the onShift
# if the victim is CoreObject reactivate it. Else ask the router for allocation of operators
# TODO more generic implementation
self
.
victim
.
onShift
=
True
self
.
victim
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
timeLastShiftStarted
=
self
.
env
.
now
self
.
outputTrace
(
self
.
victim
.
name
,
"is on shift"
)
startShift
=
self
.
env
.
now
if
issubclass
(
self
.
victim
.
__class__
,
CoreObject
):
self
.
reactivateVictim
()
# re-activate the victim in case it was interrupted
else
:
CoreObject
.
requestAllocation
()
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for
oi
in
self
.
victim
.
objectInterruptions
:
...
...
@@ -96,12 +101,6 @@ class ShiftScheduler(ObjectInterruption):
if
oi
.
expectedSignals
[
'victimOnShift'
]:
succeedTuple
=
(
self
,
self
.
env
.
now
)
oi
.
victimOnShift
.
succeed
(
succeedTuple
)
self
.
victim
.
totalOffShiftTime
+=
self
.
env
.
now
-
self
.
victim
.
timeLastShiftEnded
self
.
victim
.
onShift
=
True
self
.
victim
.
timeLastShiftStarted
=
self
.
env
.
now
self
.
outputTrace
(
self
.
victim
.
name
,
"is on shift"
)
startShift
=
self
.
env
.
now
else
:
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
yield
self
.
env
.
timeout
(
timeToEndShift
-
self
.
receiveBeforeEndThreshold
)
# wait until the entry threshold
...
...
@@ -132,7 +131,7 @@ class ShiftScheduler(ObjectInterruption):
if
not
self
.
endUnfinished
and
station
.
isProcessing
:
station
.
processOperatorUnavailable
.
succeed
(
self
.
env
.
now
)
station
.
expectedSignals
[
'processOperatorUnavailable'
]
=
0
CoreObject
.
requestAllocation
()
self
.
requestAllocation
()
# if the victim has interruptions that measure only the on-shift time, they have to be notified
for
oi
in
self
.
victim
.
objectInterruptions
:
...
...
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