Report Generation for QTIP 57/8057/1
authorNauman_Ahad <Nauman_Ahad@dell.com>
Tue, 26 Jan 2016 16:07:03 +0000 (21:07 +0500)
committerNauman_Ahad <Nauman_Ahad@dell.com>
Tue, 26 Jan 2016 16:07:03 +0000 (21:07 +0500)
Creates a PDF file for QTIP, along with a graph of results

Change-Id: Iac66bf53cf8c41554d38e3a9d6cdfec236cff3ec
Signed-off-by: Nauman_Ahad <Nauman_Ahad@dell.com>
data/report/Qtip_Report.py [new file with mode: 0644]
data/report/get_indices.py [new file with mode: 0644]
data/report/qtip_graph.py [new file with mode: 0644]
qtip.py

diff --git a/data/report/Qtip_Report.py b/data/report/Qtip_Report.py
new file mode 100644 (file)
index 0000000..e8b52c1
--- /dev/null
@@ -0,0 +1,48 @@
+from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Image
+from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
+from reportlab.lib.units import inch
+from reportlab.lib.pagesizes import letter
+import qtip_graph  as graph
+import get_indices as results 
+doc = SimpleDocTemplate("../../results/QTIP_results.pdf",pagesize=letter,
+                        rightMargin=72,leftMargin=72,
+                        topMargin=72,bottomMargin=18)
+
+Stor=[]
+Style=getSampleStyleSheet()
+Title="QTIP Benchmark Suite"
+Stor.append(Paragraph(Title,Style['Title']))
+H1="Results"
+Stor.append(Spacer(0,36))
+Stor.append(Paragraph(H1, Style['h2']))
+compute=0
+storage=0
+network=0
+try:
+    compute=results.get_index('compute_result')
+except IOError:
+    pass
+
+try:
+    storage=results.get_index('storage_result')
+except IOError:
+    pass
+try:
+    network=results.get_index('network_result')
+except IOError:
+    pass
+
+Stor.append(Paragraph("Compute Suite:   %f" %compute, Style['h5']))
+Stor.append(Paragraph("Storage Suite:   %f" %storage, Style['h5'])) 
+Stor.append(Paragraph("Netowrk Suite:   %f" %network, Style['h5']))
+graph.plot_indices(compute,storage,network)
+qtip_graph=('qtip_graph.jpeg')
+im=Image(qtip_graph, 5*inch,4*inch)
+Stor.append(im)
+Stor.append(Spacer(0, 12))
+ptext="For Details of the Reference POD hardware, please visit: https://wiki.opnfv.org/reference_pod_hardware_details"
+Stor.append(Paragraph(ptext,Style['Normal']))
+Stor.append(Spacer(0, 12))
+ptext="For Details of the Reference POD Results, please visit: https://wiki.opnfv.org/reference_pod_qtip_results"
+Stor.append(Paragraph(ptext,Style['Normal']))
+doc.build(Stor)
diff --git a/data/report/get_indices.py b/data/report/get_indices.py
new file mode 100644 (file)
index 0000000..e23fdb8
--- /dev/null
@@ -0,0 +1,8 @@
+import json
+
+def get_index(suite):
+    with open ('../../results/'+suite+'.json') as result_file:
+         result_djson=json.load(result_file)
+         index=result_djson['index']
+        
+    return index
diff --git a/data/report/qtip_graph.py b/data/report/qtip_graph.py
new file mode 100644 (file)
index 0000000..3d95282
--- /dev/null
@@ -0,0 +1,34 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+def plot_indices(a,b,c):
+    N=3
+    ind= np.arange(N)
+    y_axis = (a,b,c )
+    width=0.35
+    f=plt.figure()
+    ax=f.gca()
+    ax.set_autoscale_on(True)
+    my_bars=ax.bar(ind,y_axis,width, color='b')
+    ax.set_ylabel('Index Score*')
+    ax.set_xlabel('Suite')
+    ax.set_title(' QTIP benchmark scores')
+    ax.axis('on')
+    my_bars=ax.bar(ind,y_axis,width)
+    ax.set_xticks(ind+width/2)
+    ax.set_xticklabels(['Compute','Storage','Network'])
+    ax.axis([0,3,0,1.25])
+    f.text(0.7,0.01,'* With Comparison to Refernece POD', fontsize=9) 
+    
+    for rect in my_bars:
+        height = rect.get_height()
+        ax.text(rect.get_x() + rect.get_width()/2., 1.05*height, height , ha='center', va='bottom')
+
+    f.savefig('qtip_graph.jpeg')
+
+         
+def main():
+    plot_indices(0.83,0.7,1.0)
+
+if __name__ == "__main__":
+    main()
diff --git a/qtip.py b/qtip.py
index 01c4994..c540d70 100644 (file)
--- a/qtip.py
+++ b/qtip.py
@@ -15,6 +15,10 @@ import os
 def main():
     os.system('./data/file_permission.sh')
     Objcli = cli()
+    os.system('cd data/ref_results && python compute_suite.py')
+    os.system('cd data/ref_results && python storage_suite.py')
+    os.system('cd data/ref_results && python network_suite.py')
+    os.system('cd data/report && python Qtip_Report.py')
 
 if __name__ == "__main__":
     main()