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
e897f16f
Commit
e897f16f
authored
Jun 25, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
plugin to read wip from project spreadsheet
parent
6dcc5896
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
0 deletions
+64
-0
dream/plugins/CapacityStations/CapacityStationWIP.py
dream/plugins/CapacityStations/CapacityStationWIP.py
+64
-0
No files found.
dream/plugins/CapacityStations/CapacityStationWIP.py
0 → 100644
View file @
e897f16f
from
copy
import
copy
import
json
import
time
import
random
import
operator
from
datetime
import
datetime
from
dream.plugins
import
plugin
class
CapacityStationWIP
(
plugin
.
InputPreparationPlugin
):
""" Input prepration
read the wip from the project spreadsheet.
"""
def
preprocess
(
self
,
data
):
""" Set the WIP in queue from spreadsheet data.
"""
projectData
=
data
[
'input'
].
get
(
'projects_spreadsheet'
,
None
)
# find the column where the WIP is given
i
=
0
for
element
in
projectData
[
0
]:
if
element
==
'WIP'
:
wipColumn
=
i
break
i
+=
1
print
wipColumn
if
projectData
:
alreadyConsideredProjects
=
[]
for
row
in
range
(
1
,
len
(
projectData
)):
if
projectData
[
row
][
0
]
and
not
(
projectData
[
row
][
0
]
in
alreadyConsideredProjects
):
projectId
=
projectData
[
row
][
0
]
alreadyConsideredProjects
.
append
(
projectData
[
row
][
0
])
numberOfOperations
=
1
i
=
1
# if the id changes or is empty it means there is no more data on the project
while
(
not
projectData
[
row
+
i
][
0
])
or
(
projectData
[
row
+
i
][
0
]
==
projectId
):
# if a completely empty line is found break
if
all
(
v
in
[
None
,
''
]
for
v
in
projectData
[
row
+
i
]):
break
numberOfOperations
+=
1
i
+=
1
# for every operation get the wip and define it
for
stationRecord
in
range
(
numberOfOperations
):
stationId
=
projectData
[
row
+
stationRecord
][
4
]
requiredCapacity
=
float
(
projectData
[
row
+
stationRecord
][
wipColumn
])
print
projectId
,
'has wip requirements of'
,
requiredCapacity
,
'from'
,
stationId
if
requiredCapacity
:
capacityBuffer
=
self
.
getBuffer
(
data
,
stationId
)
data
[
'graph'
][
'node'
][
capacityBuffer
][
'wip'
].
append
({
"_class"
:
"dream.simulation.applications.CapacityStations.CapacityEntity.CapacityEntity"
,
"requiredCapacity"
:
requiredCapacity
,
"capacityProjectId"
:
projectId
,
"name"
:
projectId
+
'_'
+
stationId
+
'_'
+
str
(
requiredCapacity
)
})
return
data
# gets the data and the station id and returns the buffer id of this station
def
getBuffer
(
self
,
data
,
stationId
):
for
(
edge_id
,
edge
)
in
data
[
'graph'
][
'edge'
].
iteritems
():
if
edge
[
'destination'
]
==
stationId
:
return
edge
[
'source'
]
\ 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