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
e73fd39f
Commit
e73fd39f
authored
Aug 19, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
progress in creating the sub-batches
parent
3de1f971
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletion
+34
-1
dream/plugins/Batches/BatchesWIPShort.py
dream/plugins/Batches/BatchesWIPShort.py
+34
-1
No files found.
dream/plugins/Batches/BatchesWIPShort.py
View file @
e73fd39f
...
@@ -58,6 +58,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
...
@@ -58,6 +58,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
# if we have stations that may share sub-batches
# if we have stations that may share sub-batches
if
len
(
group
)
>
1
:
if
len
(
group
)
>
1
:
currentBatchId
=
'Batch_'
+
str
(
batchCounter
)
+
'_WIP'
currentBatchId
=
'Batch_'
+
str
(
batchCounter
)
+
'_WIP'
subBatchCounter
=
0
unitsToCompleteBatch
=
standardBatchUnits
unitsToCompleteBatch
=
standardBatchUnits
group
.
sort
(
key
=
lambda
x
:
self
.
getDistanceFromSource
(
data
,
x
))
group
.
sort
(
key
=
lambda
x
:
self
.
getDistanceFromSource
(
data
,
x
))
for
stationId
in
group
:
for
stationId
in
group
:
...
@@ -76,13 +77,45 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
...
@@ -76,13 +77,45 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
proceeded
=
complete
-
(
complete
%
workingBatchSize
)
proceeded
=
complete
-
(
complete
%
workingBatchSize
)
currentCompleted
=
awaiting
%
workingBatchSize
currentCompleted
=
awaiting
%
workingBatchSize
print
buffered
,
proceeded
,
currentCompleted
print
buffered
,
proceeded
,
currentCompleted
# set the buffered sub-batches to the previous station
for
i
in
range
(
int
(
buffered
/
workingBatchSize
)):
bufferId
=
self
.
getPredecessors
(
data
,
stationId
)[
0
]
self
.
createSubBatch
(
data
,
bufferId
,
currentBatchId
,
currentBatchId
,
subBatchCounter
,
workingBatchSize
,
receiver
=
stationId
)
subBatchCounter
+=
1
unitsToCompleteBatch
-=
workingBatchSize
if
unitsToCompleteBatch
==
0
:
subBatchCounter
=
0
batchCounter
+=
1
# set the buffered sub-batches to the previous station
for
i
in
range
(
int
(
proceeded
/
workingBatchSize
)):
bufferId
=
self
.
getSuccessors
(
data
,
stationId
)[
0
]
self
.
createSubBatch
(
data
,
bufferId
,
currentBatchId
,
currentBatchId
,
subBatchCounter
,
workingBatchSize
)
subBatchCounter
+=
1
unitsToCompleteBatch
-=
workingBatchSize
if
unitsToCompleteBatch
==
0
:
subBatchCounter
=
0
batchCounter
+=
1
# for stations that do not share sub-batches with others
# for stations that do not share sub-batches with others
else
:
else
:
pass
pass
return
data
return
data
# creates a sub-batch in a station
def
createSubBatch
(
self
,
data
,
stationId
,
parentBatchId
,
parentBatchName
,
subBatchId
,
numberOfUnits
,
unitsToProcess
=
0
,
receiver
=
None
):
print
'creating'
,
stationId
,
parentBatchId
data
[
'graph'
][
'node'
][
stationId
][
'wip'
].
append
({
"_class"
:
'Dream.SubBatch'
,
"id"
:
parentBatchId
+
'_SB_'
+
str
(
subBatchId
)
+
'_wip'
,
"name"
:
parentBatchName
+
'_SB_'
+
str
(
subBatchId
)
+
'_wip'
,
"numberOfUnits"
:
numberOfUnits
,
"unitsToProcess"
:
unitsToProcess
,
"parentBatchId"
:
parentBatchId
,
"parentBatchName"
:
parentBatchName
,
"receiver"
:
receiver
})
# gets the data and a station id and returns a list with all the stations that the station may share batches
# gets the data and a station id and returns a list with all the stations that the station may share batches
def
findSharingStations
(
self
,
data
,
stationId
):
def
findSharingStations
(
self
,
data
,
stationId
):
...
...
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