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
01456cdc
Commit
01456cdc
authored
Aug 19, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
method to help in sorting the stations according to their sequence
parent
95bbebcc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
4 deletions
+15
-4
dream/plugins/Batches/BatchesWIPShort.py
dream/plugins/Batches/BatchesWIPShort.py
+15
-4
No files found.
dream/plugins/Batches/BatchesWIPShort.py
View file @
01456cdc
...
...
@@ -16,8 +16,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
nodes
=
data
[
'graph'
][
'node'
]
WIPData
=
data
[
'input'
].
get
(
self
.
configuration_dict
[
'input_id'
],
{})
from
pprint
import
pprint
# pprint(WIPData)
# get the number of units for a standard batch
standardBatchUnits
=
0
for
node_id
,
node
in
nodes
.
iteritems
():
...
...
@@ -45,6 +44,7 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
sharingStations
=
self
.
findSharingStations
(
data
,
stationId
)
self
.
checkIfDefinitionIsValid
(
data
,
WIPData
,
stationId
,
sharingStations
,
standardBatchUnits
)
print
stationId
,
self
.
getDistanceFromSource
(
data
,
stationId
)
return
data
# gets the data and a station id and returns a list with all the stations that the station may share batches
...
...
@@ -102,8 +102,19 @@ class BatchesWIPShort(plugin.InputPreparationPlugin):
totalUnits
+=
int
(
row
[
2
])
assert
totalUnits
%
standardBatchUnits
==
0
,
'wrong wip definition in group '
+
str
(
allStations
)
+
'. Not full batches.'
# returns how far a station is from source. Useful for sorting
def
getDistanceFromSource
(
self
,
data
,
stationId
):
distance
=
0
nodes
=
data
[
'graph'
][
'node'
]
current
=
stationId
# find all the predecessors that may share batches
while
1
:
previous
=
self
.
getPredecessors
(
data
,
current
)[
0
]
if
'Source'
in
nodes
[
previous
][
'_class'
]:
break
distance
+=
1
current
=
previous
return
distance
\ No newline at end of file
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