From 5effa0d2ce6faf12098ba2f0ad9ae90114dda05f Mon Sep 17 00:00:00 2001 From: Taseer Date: Mon, 24 Jul 2017 22:34:57 +0500 Subject: Returns all job ID's if queried without ID. JIRA: STORPERF-184 Change-Id: I631b4adbd830420a3b502e4f2a86a66824c87fcd Signed-off-by: Taseer Ahmed --- docker/storperf-master/rest_server.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'docker/storperf-master/rest_server.py') diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py index ef8975c..3df2856 100644 --- a/docker/storperf-master/rest_server.py +++ b/docker/storperf-master/rest_server.py @@ -194,14 +194,17 @@ class Job(Resource): workload_id = request.args.get('id') - if metrics_type == "metrics": - return jsonify(storperf.fetch_results(workload_id)) + if workload_id: + if metrics_type == "metrics": + return jsonify(storperf.fetch_results(workload_id)) - if metrics_type == "metadata": - return jsonify(storperf.fetch_metadata(workload_id)) + if metrics_type == "metadata": + return jsonify(storperf.fetch_metadata(workload_id)) - if metrics_type == "status": - return jsonify(storperf.fetch_job_status(workload_id)) + if metrics_type == "status": + return jsonify(storperf.fetch_job_status(workload_id)) + else: + return jsonify({"job_ids": storperf.fetch_all_jobs()}) @swagger.operation( parameters=[ -- cgit 1.2.3-korg