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=[
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):
"""
"""
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)