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
10eef807
Commit
10eef807
authored
Jul 16, 2014
by
Ioannis Papagiannopoulos
Committed by
Georgios Dagkakis
Sep 01, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
failure to signal Router if it is not initiated fixed
parent
59855e0f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
16 deletions
+26
-16
dream/simulation/RoutingQueue.py
dream/simulation/RoutingQueue.py
+26
-16
No files found.
dream/simulation/RoutingQueue.py
View file @
10eef807
...
...
@@ -89,12 +89,15 @@ class RoutingQueue(Queue):
def
removeEntity
(
self
,
entity
=
None
):
activeEntity
=
Queue
.
removeEntity
(
self
,
entity
)
#run the default method
# check if the queue is empty, if yes then try to signal the router, operators may need reallocation
try
:
if
self
.
level
:
if
not
len
(
self
.
getActiveObjectQueue
()):
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
succeed
(
G
.
env
.
now
)
except
:
pass
return
activeEntity
# =======================================================================
...
...
@@ -104,22 +107,26 @@ class RoutingQueue(Queue):
def
getEntity
(
self
):
activeEntity
=
Queue
.
getEntity
(
self
)
#run the default behavior
# update the receiver object of the entity just received according to the routing of the parent batch
route
=
activeEntity
.
parentBatch
.
routing
()
activeEntity
.
receiver
=
None
try
:
for
nextObj
in
self
.
next
:
if
nextObj
in
e
ntity
.
parentBatch
.
routing
():
e
ntity
.
receiver
=
nextObj
if
nextObj
in
activeE
ntity
.
parentBatch
.
routing
():
activeE
ntity
.
receiver
=
nextObj
break
# if none of the siblings (same parentBatch) has gone through the buffer then the receiver should remain None
except
:
pass
# if the level is reached then try to signal the Router to reallocate the operators
try
:
if
self
.
level
:
if
len
(
self
.
getActiveObjectQueue
())
==
self
.
level
:
from
Globals
import
G
if
not
G
.
Router
.
invoked
:
G
.
Router
.
invoked
=
True
G
.
Router
.
isCalled
.
succeed
(
G
.
env
.
now
)
except
:
pass
return
activeEntity
# =======================================================================
...
...
@@ -137,4 +144,7 @@ class RoutingQueue(Queue):
self
.
activeQSorter
()
# sort again according to the existence or not of receiver attribute of the entities
activeObjectQueue
=
self
.
getActiveObjectQueue
()
activeObjectQueue
.
sort
(
key
=
lambda
x
:
x
.
receiver
,
reverse
=
True
)
# if no entity.receiver, then show preference to these entities
activeObjectQueue
.
sort
(
key
=
lambda
x
:
x
.
receiver
==
None
,
reverse
=
True
)
# if there is entity.receiver then check if it is the same as the self.receiver of the queue (if any)
activeObjectQueue
.
sort
(
key
=
lambda
x
:
x
.
receiver
==
self
.
receiver
,
reverse
=
True
)
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