summaryrefslogtreecommitdiffstats
path: root/docker
diff options
context:
space:
mode:
authorTaseer <taseer94@gmail.com>2017-07-24 22:34:57 +0500
committerTaseer <taseer94@gmail.com>2017-07-25 00:20:24 +0500
commit5effa0d2ce6faf12098ba2f0ad9ae90114dda05f (patch)
treeb4ced0e8a09b41a9b9f288be4783b82c13c9a330 /docker
parent0afe85092131e5ed7ef277df715ff9941778b29e (diff)
Returns all job ID's if queried without ID.
JIRA: STORPERF-184 Change-Id: I631b4adbd830420a3b502e4f2a86a66824c87fcd Signed-off-by: Taseer Ahmed <taseer94@gmail.com>
Diffstat (limited to 'docker')
-rw-r--r--docker/storperf-master/rest_server.py15
-rw-r--r--docker/storperf-master/storperf/db/job_db.py13
-rw-r--r--docker/storperf-master/storperf/storperf_master.py3
3 files changed, 25 insertions, 6 deletions
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=[
diff --git a/docker/storperf-master/storperf/db/job_db.py b/docker/storperf-master/storperf/db/job_db.py
index 3308fa8..eb35cac 100644
--- a/docker/storperf-master/storperf/db/job_db.py
+++ b/docker/storperf-master/storperf/db/job_db.py
@@ -233,6 +233,19 @@ class JobDB(object):
db.commit()
db.close()
+ def fetch_jobs(self):
+ jobs = []
+ db = sqlite3.connect(JobDB.db_name)
+ cursor = db.cursor()
+ cursor.execute("select distinct job_id from jobs")
+ while (True):
+ row = cursor.fetchone()
+ if row is None:
+ break
+ jobs.append(row[0])
+ db.close()
+ return jobs
+
def fetch_workload_params(self, job_id):
"""
"""
diff --git a/docker/storperf-master/storperf/storperf_master.py b/docker/storperf-master/storperf/storperf_master.py
index 054d2a7..b30d266 100644
--- a/docker/storperf-master/storperf/storperf_master.py
+++ b/docker/storperf-master/storperf/storperf_master.py
@@ -346,6 +346,9 @@ class StorPerfMaster(object):
def fetch_job_status(self, job_id):
return self._test_executor.execution_status(job_id)
+ def fetch_all_jobs(self):
+ return self.job_db.fetch_jobs()
+
def _setup_slave(self, slave):
logger = logging.getLogger(__name__ + ":" + slave)