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
45da702a
Commit
45da702a
authored
Mar 03, 2015
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
buffers not displayed in component Gantt. task_id also displayed
parent
8a42de9a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
20 deletions
+36
-20
dream/plugins/JSComponentGantt.py
dream/plugins/JSComponentGantt.py
+36
-20
No files found.
dream/plugins/JSComponentGantt.py
View file @
45da702a
...
...
@@ -7,12 +7,15 @@ from dream.plugins.TimeSupport import TimeSupportMixin
import
datetime
class
JSComponentGantt
(
plugin
.
OutputPreparationPlugin
,
TimeSupportMixin
):
# XXX hardoced classes of different components to be displayed in the gantt
'''class that gets the results and prepares the data for the component gantt graph'''
# XXX hard-coded classes of different components to be displayed in the gantt
COMPONENT_CLASS_SET
=
set
([
"Dream.OrderComponent"
,
"Dream.OrderDesign"
,
"Dream.Mould"
])
# XXX hard-coded classes of stations to be displayed in the gantt
STATION_CLASS_SET
=
set
([
"Dream.MachineJobShop"
,
"Dream.MouldAssembly"
])
def
postprocess
(
self
,
data
):
"""Post process the data for Gantt gadget
"""
print
"trying to prepare gantt data for components"
strptime
=
datetime
.
datetime
.
strptime
# read the current date and define dateFormat from it
try
:
...
...
@@ -29,7 +32,6 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
# loop in the results to find Operators
for
element
in
resultElements
:
if
element
[
'_class'
]
in
self
.
COMPONENT_CLASS_SET
:
print
element
[
"id"
]
componentId
=
element
[
'id'
]
# add the component in the task_dict
task_dict
[
element
[
'id'
]]
=
dict
(
...
...
@@ -43,24 +45,38 @@ class JSComponentGantt(plugin.OutputPreparationPlugin, TimeSupportMixin):
schedule
=
element
[
'results'
].
get
(
'schedule'
,
[])
if
schedule
:
for
record
in
schedule
:
stationId
=
record
[
'stationId'
]
stationClass
=
data
[
"graph"
][
"node"
][
stationId
][
"_class"
]
entranceTime
=
record
[
'entranceTime'
]
try
:
exitTime
=
schedule
[
k
][
'entranceTime'
]
except
IndexError
:
exitTime
=
maxSimTime
k
+=
1
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
parent
=
componentId
,
text
=
record
[
'stationId'
],
start_date
=
self
.
convertToRealWorldTime
(
entranceTime
).
strftime
(
date_format
),
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
).
strftime
(
date_format
),
open
=
False
,
entranceTime
=
entranceTime
,
duration
=
exitTime
-
entranceTime
,
)
taskId
=
record
.
get
(
"task_id"
,
None
)
# text to be displayed (if there is no task id display just the stationId)
if
not
taskId
:
task_to_display
=
record
[
'stationId'
]
else
:
task_to_display
=
record
[
'stationId'
]
+
"; "
+
taskId
# get the exitTime from the record
exitTime
=
record
.
get
(
"exitTime"
,
None
)
if
exitTime
==
None
:
# if there is no exitTime get it from the entranceTime of the next step
try
:
exitTime
=
schedule
[
k
][
'entranceTime'
]
# if there is no next step
except
IndexError
:
exitTime
=
maxSimTime
k
+=
1
if
stationClass
in
self
.
STATION_CLASS_SET
:
task_dict
[
componentId
+
record
[
'stationId'
]
+
str
(
k
)]
=
dict
(
id
=
componentId
+
record
[
'stationId'
]
+
str
(
k
),
parent
=
componentId
,
text
=
task_to_display
,
#record['stationId']+"; "+taskId,
start_date
=
self
.
convertToRealWorldTime
(
entranceTime
).
strftime
(
date_format
),
stop_date
=
self
.
convertToRealWorldTime
(
exitTime
).
strftime
(
date_format
),
open
=
False
,
entranceTime
=
entranceTime
,
duration
=
exitTime
-
entranceTime
,
)
# return the result to the gadget
result
=
data
[
'result'
][
'result_list'
][
-
1
]
...
...
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