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
50df0c02
Commit
50df0c02
authored
Jun 25, 2015
by
Dipo Olaitan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allocation and Utilization chart plugins for Capacity Stations
parent
0a24e21b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
0 deletions
+91
-0
dream/plugins/CapacityStations/CapacityAllocationByPeriod.py
dream/plugins/CapacityStations/CapacityAllocationByPeriod.py
+43
-0
dream/plugins/CapacityStations/CapacityProjectOperationUtilization.py
...s/CapacityStations/CapacityProjectOperationUtilization.py
+48
-0
No files found.
dream/plugins/CapacityStations/CapacityAllocationByPeriod.py
0 → 100644
View file @
50df0c02
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
from
datetime
import
datetime
,
timedelta
from
copy
import
deepcopy
class
StationAllocations
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
""" Output the queue statistics in a format compatible with Output_viewGraph, for the second widget by week.
"""
def
postprocess
(
self
,
data
):
startPeriod
=
datetime
.
strptime
(
data
[
'general'
][
'currentDate'
],
data
[
'general'
][
'dateFormat'
])
for
result
in
data
[
'result'
][
'result_list'
]:
#result = data['result']['result_list'][0]
bottleNeckUtilizationDict
=
result
[
'bottleneck_utilization_by_week'
]
=
{}
operationNames
=
[]
byPeriod
=
dict
((
period
,{})
for
period
in
range
(
len
(
result
[
'elementList'
][
10
][
'results'
][
'capacityUsed'
])))
opNo
=
0
for
recd
in
result
[
'elementList'
]:
if
recd
.
get
(
'family'
)
==
'CapacityStation'
:
operationNames
.
append
(
recd
.
get
(
'id'
))
projectNames
=
list
(
set
([
rc
[
'project'
]
for
rc
in
recd
[
'results'
][
'detailedWorkPlan'
]]))
for
prd
,
pln
in
enumerate
(
recd
[
'results'
][
'capacityUsed'
]):
totalCapa
=
max
(
0.01
,
sum
([
pln
.
setdefault
(
project
,
0
)
for
project
in
projectNames
]))
totalUtilization
=
pln
[
"utilization"
]
for
pr
in
projectNames
:
if
pr
in
byPeriod
[
prd
]:
#byPeriod[prd]:
byPeriod
[
prd
][
pr
].
append
([
opNo
,(
pln
.
setdefault
(
pr
,
0
)
/
totalCapa
*
totalUtilization
)])
else
:
byPeriod
[
prd
][
pr
]
=
[[
opNo
,(
pln
.
setdefault
(
pr
,
0
)
/
totalCapa
*
totalUtilization
)]]
opNo
+=
1
for
pd
in
byPeriod
:
series
=
[]
currentPeriod
=
str
(
startPeriod
+
timedelta
(
days
=
pd
))[:
10
]
#ticks = [[num,oprtn] for num,oprtn in enumerate(operationNames)]
ticks
=
list
(
enumerate
(
operationNames
))
options
=
{
"xaxis"
:
{
"minTickSize"
:
1
,
"ticks"
:
ticks
},
"series"
:
{
"bars"
:
{
"show"
:
True
,
"barWidth"
:
0.10
,
"order"
:
1
,
"align"
:
"center"
},
"stack"
:
False
}}
bottleNeckUtilizationDict
[
currentPeriod
]
=
{
"series"
:
series
,
"options"
:
options
}
for
pj
in
byPeriod
[
pd
]:
series
.
append
({
"label"
:
pj
,
"data"
:
byPeriod
[
pd
][
pj
]})
return
data
dream/plugins/CapacityStations/CapacityProjectOperationUtilization.py
0 → 100644
View file @
50df0c02
from
dream.plugins
import
plugin
from
dream.plugins.TimeSupport
import
TimeSupportMixin
from
datetime
import
datetime
,
timedelta
from
copy
import
deepcopy
class
PeriodUtilizations
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
""" Output the queue statistics in a format compatible with Output_viewGraph, for the second widget by week.
"""
def
postprocess
(
self
,
data
):
startPeriod
=
datetime
.
strptime
(
data
[
'general'
][
'currentDate'
],
data
[
'general'
][
'dateFormat'
])
for
result
in
data
[
'result'
][
'result_list'
]:
self
.
initializeTimeSupport
(
data
)
#bottleNeckUtilizationDict = result['capacity_utilization'] = {}
operationNames
=
[]
byPeriod
=
dict
((
period
,{})
for
period
in
range
(
len
(
result
[
'elementList'
][
10
][
'results'
][
'capacityUsed'
])))
opNo
=
0
operationUtil
=
{}
for
recd
in
result
[
'elementList'
]:
if
recd
.
get
(
'family'
)
==
'CapacityStation'
:
operationNames
.
append
(
recd
.
get
(
'id'
))
operationUtil
[
recd
.
get
(
'id'
)]
=
[]
#projectNames = list(set([rc['project'] for rc in recd['results']['detailedWorkPlan']]))
for
prd
,
pln
in
enumerate
(
recd
[
'results'
][
'capacityUsed'
]):
currentPeriod
=
str
(
startPeriod
+
timedelta
(
days
=
prd
))[:
10
]
#totalCapa = max(0.01,sum([pln.setdefault(project,0) for project in projectNames]))
totalUtilization
=
pln
[
"utilization"
]
operationUtil
[
recd
.
get
(
'id'
)].
append
([
prd
,
pln
[
"utilization"
]])
ticks
=
[
lb
[
0
]
for
lb
in
operationUtil
[
recd
.
get
(
'id'
)]]
series
=
[]
options
=
{
"xaxis"
:
{
"ticks"
:
ticks
,
"minTickSize"
:
[
1
,
self
.
getTimeUnitText
()]}}
result
[
'capacity_utilization'
]
=
{
"series"
:
series
,
"options"
:
options
}
for
operation
in
operationUtil
:
series
.
append
({
"label"
:
operation
,
"data"
:
operationUtil
[
operation
]})
#currentPeriod = str(startPeriod + timedelta(days=pd))[:10]
#ticks = [[num,oprtn] for num,oprtn in enumerate(operationNames)]
#label = operation
#ticks = list(enumerate(operationNames))
#options = {"xaxis": {"minTickSize": 1,"ticks": ticks},"series": {"bars": {"show": True,"barWidth": 0.10,"order": 1,"align": "center"},"stack": False}}
#bottleNeckUtilizationDict = {"series": series,"options": options}
#for pj in byPeriod[pd]:
#series.append({"label":operation,"data": operationUtil[operation]})
return
data
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