Commit 337c9aea authored by Georgios Dagkakis's avatar Georgios Dagkakis

correction on how ManPy returns the trace and how the plugin sends it back to the platform

parent 4a85c766
...@@ -9,12 +9,10 @@ class ParseTraceFile(plugin.OutputPreparationPlugin): ...@@ -9,12 +9,10 @@ class ParseTraceFile(plugin.OutputPreparationPlugin):
outPutFile=None outPutFile=None
for record in data['result']['result_list'][-1]['elementList']: for record in data['result']['result_list'][-1]['elementList']:
if record.get('id',None)=='TraceFile': if record.get('id',None)=='TraceFile':
outPutFile=record outPutFile=record['results']['trace']
data['result']['result_list'][-1][self.configuration_dict['output_id']] = { data['result']['result_list'][-1][self.configuration_dict['output_id']] = {
'name': 'Trace.xlsx', 'name': 'Trace.xls',
'mime_type': 'application/vnd.ms-excel', 'mime_type': 'application/vnd.ms-excel',
'data': outPutFile 'data': outPutFile
} }
print data['result']['result_list'][-1][self.configuration_dict['output_id']]['data']
return data return data
...@@ -668,6 +668,10 @@ def main(argv=[], input_data=None): ...@@ -668,6 +668,10 @@ def main(argv=[], input_data=None):
#output trace to excel #output trace to excel
if(G.trace=="Yes"): if(G.trace=="Yes"):
ExcelHandler.outputTrace('trace'+str(i)) ExcelHandler.outputTrace('trace'+str(i))
import StringIO
traceStringIO = StringIO.StringIO()
G.traceFile.save(traceStringIO)
encodedTrace=traceStringIO.getvalue().encode('base64')
ExcelHandler.resetTrace() ExcelHandler.resetTrace()
G.outputJSON['_class'] = 'Dream.Simulation'; G.outputJSON['_class'] = 'Dream.Simulation';
...@@ -683,13 +687,10 @@ def main(argv=[], input_data=None): ...@@ -683,13 +687,10 @@ def main(argv=[], input_data=None):
# output the trace as encoded if it is set on # output the trace as encoded if it is set on
if G.trace=="Yes": if G.trace=="Yes":
import StringIO
out = StringIO.StringIO()
G.traceFile.save(out)
# XXX discuss names on this # XXX discuss names on this
jsonTRACE = {'_class': 'Dream.Simulation', jsonTRACE = {'_class': 'Dream.Simulation',
'id': 'TraceFile', 'id': 'TraceFile',
'results': {'Trace':out.getvalue().encode('base64')} 'results': {'trace':encodedTrace}
} }
G.outputJSON['elementList'].append(jsonTRACE) G.outputJSON['elementList'].append(jsonTRACE)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment