diff options
author | saksham115 <saksham.agrawal@research.iiit.ac.in> | 2017-08-28 17:37:32 +0530 |
---|---|---|
committer | saksham115 <saksham.agrawal@research.iiit.ac.in> | 2017-08-28 17:40:27 +0530 |
commit | 3bd890facc1546fcc1dea2e372937675236af4e8 (patch) | |
tree | 067b78b0c7fc52ea53beac802618967422d4a0bb /docker/storperf-reporting/src/app.py | |
parent | 383d814f0d5d4db55c6f4c621fa346ceab580a3f (diff) |
Handling multiple data scenario
JIRA: STORPERF-163
Change-Id: Id86774df42461088c7773d36ad5db6c15d2c9585
Signed-off-by: saksham115 <saksham.agrawal@research.iiit.ac.in>
Diffstat (limited to 'docker/storperf-reporting/src/app.py')
-rw-r--r-- | docker/storperf-reporting/src/app.py | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/docker/storperf-reporting/src/app.py b/docker/storperf-reporting/src/app.py index 330edf9..39ea259 100644 --- a/docker/storperf-reporting/src/app.py +++ b/docker/storperf-reporting/src/app.py @@ -19,15 +19,20 @@ app.secret_key = 'storperf_graphing_module' def get_data(data): metrics = {} report_data = {} - temp = data.get("results") or data.get("report") + temp = data.get("results") or data.get("report") or data.get("details") if type(temp) is list: - details = temp[0].get('details') - metrics = details.get('metrics') - report_data = details.get('report_data') + length = len(temp) + if length == 1: + details = temp[0].get('details') + metrics = details.get('metrics') + report_data = details.get('report_data') + return "single", metrics, report_data + else: + return "multi", temp else: metrics = temp.get('metrics') report_data = temp.get('report_data') - return metrics, report_data + return "single", metrics, report_data @app.route('/reporting/success/') @@ -39,9 +44,14 @@ def success(): else: data = open("./static/testdata/" + URL).read() data = json.loads(data) - metrics, report_data = get_data(data) - return render_template('plot_tables.html', - metrics=metrics, report_data=report_data) + response = get_data(data) + if response[0] == "single": + metrics, report_data = response[1], response[2] + return render_template('plot_tables.html', + metrics=metrics, report_data=report_data) + else: + return render_template('plot_multi_data.html', + results=response[1]) except Exception as e: session['server_error'] = e.message + ' ' + repr(e.args) return redirect(url_for('file_not_found')) |