summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docker/storperf-master/rest_server.py17
-rw-r--r--docker/storperf-master/storperf/db/job_db.py13
-rw-r--r--docker/storperf-master/storperf/storperf_master.py3
-rw-r--r--docs/testing/user/test-usage.rst9
4 files changed, 35 insertions, 7 deletions
diff --git a/docker/storperf-master/rest_server.py b/docker/storperf-master/rest_server.py
index ef8975c..d551b57 100644
--- a/docker/storperf-master/rest_server.py
+++ b/docker/storperf-master/rest_server.py
@@ -160,7 +160,7 @@ class Job(Resource):
"name": "id",
"description": "The UUID of the workload in the format "
"NNNNNNNN-NNNN-NNNN-NNNN-NNNNNNNNNNNN",
- "required": True,
+ "required": False,
"type": "string",
"allowMultiple": False,
"paramType": "query"
@@ -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)
diff --git a/docs/testing/user/test-usage.rst b/docs/testing/user/test-usage.rst
index 8ffa27a..586ba7a 100644
--- a/docs/testing/user/test-usage.rst
+++ b/docs/testing/user/test-usage.rst
@@ -232,6 +232,15 @@ remain to be executed.
curl -X DELETE --header 'Accept: application/json' http://StorPerf:5000/api/v1.0/jobs
+List all Jobs
+=============
+A list of all Jobs can also be queried. You just need to issue a GET request without any
+Job ID.
+
+.. code-block:: bash
+
+ curl -X GET --header 'Accept: application/json' http://StorPerf/api/v1.0/jobs
+
Delete the Environment
======================
After you are done testing, you can have StorPerf delete the Heat stack by