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
1bae5d7d
Commit
1bae5d7d
authored
Mar 13, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sortCandidateEntities simplified
parent
2eca07ac
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
dream/simulation/Operator.py
dream/simulation/Operator.py
+1
-1
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+6
-6
dream/simulation/OperatorRouter.py
dream/simulation/OperatorRouter.py
+3
-2
No files found.
dream/simulation/Operator.py
View file @
1bae5d7d
...
...
@@ -64,7 +64,7 @@ class Operator(Repairman): # XXX isn't it the other way around ?
# TODO: clean the comments
# TODO: maybe the argument is not needed. the candidate entities is a variable of the object
# =======================================================================
def
sortCandidateEntities
(
self
,
candidateEntities
=
[]
):
def
sortCandidateEntities
(
self
):
pass
# # TODO: have to consider what happens in case of a critical order
# # FIFO sorting has no meaning when sorting candidateEntities
...
...
dream/simulation/OperatorManagedJob.py
View file @
1bae5d7d
...
...
@@ -71,22 +71,22 @@ class OperatorManagedJob(Operator):
# sorts the candidateEntities of the Operator according to the scheduling rule
# TODO: maybe the argument is not needed. the candidate entities is a variable of the object
# =======================================================================
def
sortCandidateEntities
(
self
,
candidateEntities
=
[]
):
def
sortCandidateEntities
(
self
):
# TODO: have to consider what happens in case of a critical order
#if we have sorting according to multiple criteria we have to call the sorter many times
if
self
.
schedulingRule
==
"MC"
:
for
criterion
in
reversed
(
self
.
multipleCriterionList
):
self
.
activeCandidateQSorter
(
criterion
=
criterion
,
candidateEntities
=
candidateEntities
)
self
.
activeCandidateQSorter
(
criterion
=
criterion
)
#else we just use the default scheduling rule
else
:
self
.
activeCandidateQSorter
(
self
.
schedulingRule
,
candidateEntities
=
candidateEntities
)
self
.
activeCandidateQSorter
(
self
.
schedulingRule
)
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
# =======================================================================
# TODO: entityToGet is not updated for all stations, consider using it for all stations or withdraw the idea
def
activeCandidateQSorter
(
self
,
criterion
=
None
,
candidateEntities
=
[]
):
activeObjectQ
=
candidateEntities
def
activeCandidateQSorter
(
self
,
criterion
=
None
):
activeObjectQ
=
self
.
candidateEntities
if
not
activeObjectQ
:
assert
False
,
"empty candidate list"
if
criterion
==
None
:
...
...
@@ -94,7 +94,7 @@ class OperatorManagedJob(Operator):
#if the schedulingRule is first in first out
if
criterion
==
"FIFO"
:
# FIFO sorting has no meaning when sorting candidateEntities
self
.
activeCandidateQSorter
(
'WT'
,
candidateEntities
=
candidateEntities
)
self
.
activeCandidateQSorter
(
'WT'
)
# added for testing
# print 'there is no point of using FIFO scheduling rule for operators candidateEntities,\
# WT scheduling rule used instead'
...
...
dream/simulation/OperatorRouter.py
View file @
1bae5d7d
...
...
@@ -146,7 +146,7 @@ class Router(ObjectInterruption):
# check if the candidateReceivers are inPositionToGet and if they are already called
try
:
receiverIsActive
=
(
operator
.
candidateEntity
.
candidateReceiver
in
operator
.
activeCallersList
\
and
operator
.
candidateEntity
.
candidateReceiver
in
self
.
pendingObjects
)
and
operator
.
candidateEntity
.
candidateReceiver
in
self
.
pendingObjects
)
except
:
receiverIsActive
=
True
...
...
@@ -277,6 +277,7 @@ class Router(ObjectInterruption):
del
self
.
calledOperators
[:]
del
self
.
pendingObjects
[:]
del
self
.
multipleCriterionList
[:]
# reset the call flag of the Router
self
.
call
=
False
#=======================================================================
...
...
@@ -381,7 +382,7 @@ class Router(ObjectInterruption):
# sort the candidateEntities list of each operator according to its schedulingRule
for
operator
in
[
x
for
x
in
self
.
candidateOperators
if
x
.
candidateEntities
]:
operator
.
sortCandidateEntities
(
operator
.
candidateEntities
)
operator
.
sortCandidateEntities
()
# if there operators that have only one option then sort the candidateOperators according to the first one of these
# TODO: find out what happens if there are many operators with one option
...
...
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