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
a5c2c8af
Commit
a5c2c8af
authored
Feb 17, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'downloadTrace'
parents
d8c8e265
337c9aea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
2 deletions
+46
-2
dream/plugins/ParseTraceFile.py
dream/plugins/ParseTraceFile.py
+18
-0
dream/simulation/Examples/DefaultAllInOneEmptyNoOperators.json
.../simulation/Examples/DefaultAllInOneEmptyNoOperators.json
+13
-1
dream/simulation/LineGenerationJSON.py
dream/simulation/LineGenerationJSON.py
+15
-1
No files found.
dream/plugins/ParseTraceFile.py
0 → 100644
View file @
a5c2c8af
from
dream.plugins
import
plugin
class
ParseTraceFile
(
plugin
.
OutputPreparationPlugin
):
""" Output the result of demand planning in a format compatible with
Output_viewDownloadFile
"""
def
postprocess
(
self
,
data
):
outPutFile
=
None
for
record
in
data
[
'result'
][
'result_list'
][
-
1
][
'elementList'
]:
if
record
.
get
(
'id'
,
None
)
==
'TraceFile'
:
outPutFile
=
record
[
'results'
][
'trace'
]
data
[
'result'
][
'result_list'
][
-
1
][
self
.
configuration_dict
[
'output_id'
]]
=
{
'name'
:
'Trace.xls'
,
'mime_type'
:
'application/vnd.ms-excel'
,
'data'
:
outPutFile
}
return
data
dream/simulation/Examples/DefaultAllInOneEmptyNoOperators.json
View file @
a5c2c8af
...
...
@@ -205,11 +205,23 @@
"gadget"
:
"Output_viewSpreadsheet"
,
"title"
:
"Tabular_Results"
,
"type"
:
"object_view"
}
},
"view_downaload_spreadsheet"
:
{
"configuration"
:
{
"output_id"
:
"trace_spreadSheet"
},
"gadget"
:
"Output_viewDownloadFile"
,
"title"
:
"Download Result Spreadsheet"
,
"type"
:
"object_view"
}
},
"post_processing"
:
{
"description"
:
""
,
"plugin_list"
:
[
{
"_class"
:
"dream.plugins.ParseTraceFile.ParseTraceFile"
,
"output_id"
:
"trace_spreadSheet"
},
{
"_class"
:
"dream.plugins.DefaultTabularExit.DefaultTabularExit"
}
...
...
dream/simulation/LineGenerationJSON.py
View file @
a5c2c8af
...
...
@@ -668,6 +668,10 @@ def main(argv=[], input_data=None):
#output trace to excel
if
(
G
.
trace
==
"Yes"
):
ExcelHandler
.
outputTrace
(
'trace'
+
str
(
i
))
import
StringIO
traceStringIO
=
StringIO
.
StringIO
()
G
.
traceFile
.
save
(
traceStringIO
)
encodedTrace
=
traceStringIO
.
getvalue
().
encode
(
'base64'
)
ExcelHandler
.
resetTrace
()
G
.
outputJSON
[
'_class'
]
=
'Dream.Simulation'
;
...
...
@@ -680,7 +684,17 @@ def main(argv=[], input_data=None):
#output data to JSON for every object in the topology
for
object
in
G
.
ObjectResourceList
+
G
.
EntityList
+
G
.
ObjList
:
object
.
outputResultsJSON
()
# output the trace as encoded if it is set on
if
G
.
trace
==
"Yes"
:
# XXX discuss names on this
jsonTRACE
=
{
'_class'
:
'Dream.Simulation'
,
'id'
:
'TraceFile'
,
'results'
:
{
'trace'
:
encodedTrace
}
}
G
.
outputJSON
[
'elementList'
].
append
(
jsonTRACE
)
outputJSONString
=
json
.
dumps
(
G
.
outputJSON
,
indent
=
True
)
if
0
:
G
.
outputJSONFile
=
open
(
'outputJSON.json'
,
mode
=
'w'
)
...
...
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