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
94b64bfe
Commit
94b64bfe
authored
Feb 25, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Operators have schedulingRules for sorting the objects requesting them (sortEntities)
parent
d729090c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
6 deletions
+14
-6
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+5
-2
dream/simulation/Operator.py
dream/simulation/Operator.py
+7
-2
dream/simulation/OperatorManagedJob.py
dream/simulation/OperatorManagedJob.py
+2
-2
No files found.
dream/simulation/LineGenerationJSON.py
View file @
94b64bfe
...
...
@@ -204,7 +204,7 @@ def createObjects():
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
# get the scheduling rule of the el. (how to choose which
# station to serve first) / default 'FIFO' i.e. the one that
# called first
O
=
Operator
(
element_id
,
name
,
capacity
)
# create an operator object
O
=
Operator
(
element_id
,
name
,
capacity
,
schedulingRule
)
# create an operator object
O
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the operator operates
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
...
...
@@ -213,7 +213,10 @@ def createObjects():
id
=
element
.
get
(
'id'
,
'not found'
)
# get the id of the element / default 'not_found'
name
=
element
.
get
(
'name'
,
'not found'
)
# get the name of the element / default 'not_found'
capacity
=
int
(
element
.
get
(
'capacity'
,
'1'
))
# get the capacity of the el. / defautl '1'
O
=
OperatorManagedJob
(
element_id
,
name
,
capacity
)
# create an operator object
schedulingRule
=
element
.
get
(
'schedulingRule'
,
'FIFO'
)
# get the scheduling rule of the el. (how to choose which
# station to serve first) / default 'FIFO' i.e. the one that
# called first
O
=
OperatorManagedJob
(
element_id
,
name
,
capacity
,
schedulingRule
)
# create an operator object
O
.
coreObjectIds
=
getSuccessorList
(
id
)
# update the list of objects that the operator operates
# calling the getSuccesorList() method on the operator
G
.
OperatorsList
.
append
(
O
)
# add the operator to the RepairmanList
...
...
dream/simulation/Operator.py
View file @
94b64bfe
...
...
@@ -39,6 +39,11 @@ class Operator(Repairman):
self
.
type
=
"Operator"
self
.
activeCallersList
=
[]
self
.
schedulingRule
=
schedulingRule
# #=======================================================================
# # TESTING
# print now(), self.objName, 'schedulingRule'
# print self.schedulingRule
# #=======================================================================
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
...
...
@@ -50,7 +55,7 @@ class Operator(Repairman):
self
.
activeQSorter
(
criterion
=
criterion
)
#else we just use the default scheduling rule
else
:
self
.
activeQSorter
()
self
.
activeQSorter
(
self
.
schedulingRule
)
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
...
...
@@ -64,7 +69,7 @@ class Operator(Repairman):
pass
#if the schedulingRule is based on a pre-defined priority
elif
criterion
==
"Priority"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
priority
)
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
entityToGet
.
priority
)
#if the schedulingRule is earliest due date
elif
criterion
==
"EDD"
:
activeObjectQ
.
sort
(
key
=
lambda
x
:
x
.
dueDate
)
...
...
dream/simulation/OperatorManagedJob.py
View file @
94b64bfe
...
...
@@ -34,8 +34,8 @@ from Operator import Operator
# ===========================================================================
class
OperatorManagedJob
(
Operator
):
def
__init__
(
self
,
id
,
name
,
capacity
=
1
):
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
)
def
__init__
(
self
,
id
,
name
,
capacity
=
1
,
schedulingRule
=
"FIFO"
):
Operator
.
__init__
(
self
,
id
=
id
,
name
=
name
,
capacity
=
capacity
,
schedulingRule
=
schedulingRule
)
self
.
operatorAssignedTo
=
None
# =======================================================================
...
...
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