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
338a0241
Commit
338a0241
authored
Oct 21, 2014
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ShiftScheduler may count threshold time as off-shift or waiting
parent
e7db559a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
dream/simulation/ShiftScheduler.py
dream/simulation/ShiftScheduler.py
+7
-4
No files found.
dream/simulation/ShiftScheduler.py
View file @
338a0241
...
...
@@ -39,13 +39,15 @@ class ShiftScheduler(ObjectInterruption):
# =======================================================================
# the __init__() method of the class
# =======================================================================
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
shiftPattern
=
[],
endUnfinished
=
False
,
receiveBeforeEndThreshold
=
0.0
,
**
kw
):
def
__init__
(
self
,
id
=
''
,
name
=
''
,
victim
=
None
,
shiftPattern
=
[],
endUnfinished
=
False
,
receiveBeforeEndThreshold
=
0.0
,
thresholdTimeIsOnShift
=
True
,
**
kw
):
ObjectInterruption
.
__init__
(
self
,
victim
=
victim
)
self
.
type
=
'ShiftScheduler'
self
.
shiftPattern
=
shiftPattern
self
.
endUnfinished
=
endUnfinished
#flag that shows if half processed Jobs should end after the shift ends
# if the end of shift is below this threshold then the victim is on shift but does not accept new entities
self
.
receiveBeforeEndThreshold
=
receiveBeforeEndThreshold
self
.
thresholdTimeIsOnShift
=
thresholdTimeIsOnShift
# =======================================================================
# initialize for every replications
...
...
@@ -103,9 +105,10 @@ class ShiftScheduler(ObjectInterruption):
else
:
timeToEndShift
=
float
(
self
.
remainingShiftPattern
[
0
][
1
]
-
self
.
env
.
now
)
yield
self
.
env
.
timeout
(
timeToEndShift
-
self
.
receiveBeforeEndThreshold
)
# wait until the entry threshold
self
.
victim
.
isLocked
=
True
# lock the entry of the victim
yield
self
.
env
.
timeout
(
self
.
receiveBeforeEndThreshold
)
# wait until the shift is over
self
.
victim
.
isLocked
=
False
# unlock the entry of the victim
if
self
.
thresholdTimeIsOnShift
:
self
.
victim
.
isLocked
=
True
# lock the entry of the victim
yield
self
.
env
.
timeout
(
self
.
receiveBeforeEndThreshold
)
# wait until the shift is over
self
.
victim
.
isLocked
=
False
# unlock the entry of the victim
# if the victim is station
if
issubclass
(
self
.
victim
.
__class__
,
CoreObject
):
# if the mode is to end current work before going off-shift and there is current work,
...
...
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