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
f0cc5d49
Commit
f0cc5d49
authored
Apr 11, 2014
by
Georgios Dagkakis
Committed by
Ioannis Papagiannopoulos
May 23, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
examples with failures seem to work. Cleanup needed
parent
05bfdc25
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
dream/simulation/CoreObject.py
dream/simulation/CoreObject.py
+1
-0
dream/simulation/Failure.py
dream/simulation/Failure.py
+6
-6
dream/simulation/Machine.py
dream/simulation/Machine.py
+5
-3
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+3
-2
No files found.
dream/simulation/CoreObject.py
View file @
f0cc5d49
...
...
@@ -57,6 +57,7 @@ class CoreObject(Process):
self
.
isRequested
=
SimEvent
(
'isRequested'
)
self
.
canDispose
=
SimEvent
(
'canDispose'
)
self
.
interruptionEnd
=
SimEvent
(
'interruptionEnd'
)
self
.
interruptionStart
=
SimEvent
(
'interruptionStart'
)
def
initialize
(
self
):
# XXX why call super.__init__ outside of __init__ ?
...
...
dream/simulation/Failure.py
View file @
f0cc5d49
...
...
@@ -112,9 +112,9 @@ class Failure(ObjectInterruption):
yield
release
,
self
,
self
.
repairman
.
getResource
()
self
.
repairman
.
totalWorkingTime
+=
now
()
-
timeOperationStarted
#===========================================================================
# interrupts the victim
#===========================================================================
def
interruptVictim
(
self
):
ObjectInterruption
.
interrupt
(
self
)
# TODO: check whether it is a good idea to update the failure timers here
\ No newline at end of file
# #===========================================================================
# # interrupts the victim
# #===========================================================================
# def interruptVictim(self):
# ObjectInterruption.interrupt(self)
# # TODO: check whether it is a good idea to update the failure timers here
\ No newline at end of file
dream/simulation/Machine.py
View file @
f0cc5d49
...
...
@@ -454,16 +454,18 @@ class Machine(CoreObject):
if
not
self
.
signalReceiver
():
# if there was no available receiver, get into blocking control
while
1
:
# wait the event canDispose, this means that the station can deliver the item to successor
yield
waitevent
,
self
,
self
.
canDispose
event
=
yield
waitevent
,
self
,
[
self
.
canDispose
,
self
.
interruptionStart
]
# if there was interruption
if
self
.
interrupted
():
#if self.interrupted():
# TODO not good implementation
if
self
.
interruptionStart
.
signalparam
==
now
():
# wait for the end of the interruption
self
.
interruptionActions
()
# execute interruption actions
yield
waitevent
,
self
,
self
.
interruptionEnd
# interruptionEnd to be triggered by ObjectInterruption
assert
self
==
self
.
interruptionEnd
.
signalparam
,
'the victim of the failure is not the object that received it'
self
.
postInterruptionActions
()
#=======================================================
# TODO: not sure if this is required now
# #if during the interruption the object became empty break
...
...
dream/simulation/ObjectInterruption.py
View file @
f0cc5d49
...
...
@@ -86,10 +86,11 @@ class ObjectInterruption(Process):
#interrupts the victim
def
interruptVictim
(
self
):
self
.
interrupt
(
self
.
victim
)
self
.
victim
.
interruptionStart
.
signal
(
now
())
#reactivate the victim
def
reactivateVictim
(
self
):
self
.
victim
.
interruptionEnd
.
signal
(
victim
)
self
.
victim
.
interruptionEnd
.
signal
(
self
.
victim
)
# reactivate(self.victim)
#outputs message to the trace.xls. Format is (Simulation Time | Victim Name | message)
...
...
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