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
06cc6f82
Commit
06cc6f82
authored
May 01, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Broker signalling made more generic
parent
2e9e212c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
4 deletions
+5
-4
dream/simulation/ObjectInterruption.py
dream/simulation/ObjectInterruption.py
+1
-1
dream/simulation/OperatedPoolBroker.py
dream/simulation/OperatedPoolBroker.py
+4
-3
No files found.
dream/simulation/ObjectInterruption.py
View file @
06cc6f82
...
@@ -57,7 +57,7 @@ class ObjectInterruption(Process):
...
@@ -57,7 +57,7 @@ class ObjectInterruption(Process):
# signalling can be done via Machine request/releaseOperator
# signalling can be done via Machine request/releaseOperator
# =======================================================================
# =======================================================================
def
invoke
(
self
):
def
invoke
(
self
):
self
.
brokerI
sCalled
.
signal
(
now
())
self
.
i
sCalled
.
signal
(
now
())
# # =======================================================================
# # =======================================================================
# # return control to the Machine.run
# # return control to the Machine.run
...
...
dream/simulation/OperatedPoolBroker.py
View file @
06cc6f82
...
@@ -48,7 +48,7 @@ class Broker(ObjectInterruption):
...
@@ -48,7 +48,7 @@ class Broker(ObjectInterruption):
self
.
timeLastOperationEnded
=
0
self
.
timeLastOperationEnded
=
0
self
.
timeWaitForOperatorStarted
=
0
self
.
timeWaitForOperatorStarted
=
0
# Broker events
# Broker events
self
.
brokerI
sCalled
=
SimEvent
(
'brokerIsCalled'
)
self
.
i
sCalled
=
SimEvent
(
'brokerIsCalled'
)
self
.
victimQueueIsEmpty
=
SimEvent
(
'victimQueueIsEmpty'
)
self
.
victimQueueIsEmpty
=
SimEvent
(
'victimQueueIsEmpty'
)
self
.
resourceAvailable
=
SimEvent
(
'resourceAvailable'
)
self
.
resourceAvailable
=
SimEvent
(
'resourceAvailable'
)
self
.
waitForOperator
=
False
self
.
waitForOperator
=
False
...
@@ -69,8 +69,8 @@ class Broker(ObjectInterruption):
...
@@ -69,8 +69,8 @@ class Broker(ObjectInterruption):
def
run
(
self
):
def
run
(
self
):
while
1
:
while
1
:
# TODO: add new broker event - brokerIsCalled
# TODO: add new broker event - brokerIsCalled
yield
waitevent
,
self
,
self
.
brokerI
sCalled
yield
waitevent
,
self
,
self
.
i
sCalled
assert
self
.
brokerI
sCalled
.
signalparam
==
now
(),
'the broker should be granted control instantly'
assert
self
.
i
sCalled
.
signalparam
==
now
(),
'the broker should be granted control instantly'
# ======= request a resource
# ======= request a resource
if
self
.
victim
.
isOperated
()
\
if
self
.
victim
.
isOperated
()
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
and
any
(
type
==
'Load'
or
type
==
'Setup'
or
type
==
'Processing'
\
...
@@ -129,6 +129,7 @@ class Broker(ObjectInterruption):
...
@@ -129,6 +129,7 @@ class Broker(ObjectInterruption):
yield
release
,
self
,
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
)
yield
release
,
self
,
self
.
victim
.
operatorPool
.
getResource
(
self
.
victim
.
currentOperator
)
# signal the other brokers waiting for the same operators that they are now free
# signal the other brokers waiting for the same operators that they are now free
# also signal the stations that were not requested to receive because the operator was occupied
# also signal the stations that were not requested to receive because the operator was occupied
# self.victim.router.isCalled.signal(now())
self
.
signalLoadStations
()
self
.
signalLoadStations
()
# # but now must have the option to proceed
# # but now must have the option to proceed
...
...
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