summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaksham115 <saksham.agrawal@research.iiit.ac.in>2017-08-23 04:49:47 +0530
committersaksham115 <saksham.agrawal@research.iiit.ac.in>2017-08-23 04:54:20 +0530
commit6ca2c9387c41a5980af0f0d5aa1d24cd6c7fa94d (patch)
treeab0f9ce258210325c8469fb54f6ead3d090038e4
parent596470aa54a78537434343e6cd310b77128d2ad6 (diff)
Removing the hardcoded variable to get the data from json object
JIRA: STORPERF-194 Change-Id: I545b46833662ef1b12ed4f5df56044e73aec65c8 Signed-off-by: saksham115 <saksham.agrawal@research.iiit.ac.in>
-rw-r--r--docker/storperf-reporting/src/app.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/docker/storperf-reporting/src/app.py b/docker/storperf-reporting/src/app.py
index 74d1339..330edf9 100644
--- a/docker/storperf-reporting/src/app.py
+++ b/docker/storperf-reporting/src/app.py
@@ -19,14 +19,14 @@ app.secret_key = 'storperf_graphing_module'
def get_data(data):
metrics = {}
report_data = {}
- temp = data.keys()[0]
- if type(data[temp]) is list:
- details = data[temp][0].get('details')
+ temp = data.get("results") or data.get("report")
+ if type(temp) is list:
+ details = temp[0].get('details')
metrics = details.get('metrics')
report_data = details.get('report_data')
else:
- metrics = data[temp].get('metrics')
- report_data = data[temp].get('report_data')
+ metrics = temp.get('metrics')
+ report_data = temp.get('report_data')
return metrics, report_data