diff options
author | Mark Beierl <mark.beierl@emc.com> | 2016-05-04 22:53:07 -0400 |
---|---|---|
committer | Mark Beierl <mark.beierl@emc.com> | 2016-05-05 14:58:39 -0400 |
commit | 05e863781ce6746fabec176d1fc5f7454f2cdd73 (patch) | |
tree | 0ff7f2aa9e55b33c3f95c0521bbd3991a9e4e2c0 /storperf/db/job_db.py | |
parent | 1e0544d70dabed4f33e0624cb4a7cde4c8c6b691 (diff) |
Add Stats report and Swagger UI
Add Swagger web ui at /swagger
Add ability to fetch read/write latency status via ReST ui
Can now delete where stack was removed from OpenStack but not from the
storperf DB
Change to use Floating IPs instead of private IP
Fix delete bug where there was no dependency on resources in
the resource group.
JIRA: STORPERF-19
JIRA: STORPERF-20
Change-Id: I0a4b3386789c38d6745906ba896b8ff851dc122f
Signed-off-by: Mark Beierl <mark.beierl@emc.com>
Diffstat (limited to 'storperf/db/job_db.py')
-rw-r--r-- | storperf/db/job_db.py | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/storperf/db/job_db.py b/storperf/db/job_db.py index 0e94358..d42568a 100644 --- a/storperf/db/job_db.py +++ b/storperf/db/job_db.py @@ -7,7 +7,7 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -from _sqlite3 import OperationalError +from sqlite3 import OperationalError from threading import Lock import calendar import logging @@ -15,8 +15,6 @@ import sqlite3 import time import uuid -import requests - db_mutex = Lock() @@ -172,22 +170,14 @@ class JobDB(object): db.commit() db.close() - def fetch_results(self, workload_prefix=""): - if (workload_prefix is None): - workload_prefix = "" - - workload_prefix = workload_prefix + "%" - - start_time = str(calendar.timegm(time.gmtime())) - end_time = "0" - - self.logger.debug("Workload like: " + workload_prefix) + def fetch_workloads(self, workload): + workload_prefix = workload + "%" + workload_executions = [] with db_mutex: - db = sqlite3.connect(JobDB.db_name) cursor = db.cursor() - cursor.execute("""select start, end, workload + cursor.execute("""select workload, start, end from jobs where workload like ?""", (workload_prefix,)) @@ -195,27 +185,8 @@ class JobDB(object): row = cursor.fetchone() if (row is None): break - - start_time = str(row[0]) - end_time = str(row[1]) - workload = str(row[2]) - - # for most of these stats, we just want the final one - # as that is cumulative average or whatever for the whole - # run - - self.logger.info("workload=" + workload + - "start=" + start_time + " end=" + end_time) - - request = ("http://127.0.0.1:8000/render/?target=" - "*.%s.%s.jobs.1.*.clat.mean" - "&format=json&from=%s&until=%s" - % (self.job_id, workload, start_time, end_time)) - response = requests.get(request) - - if (response.status_code == 200): - data = response.json() - print data - else: - pass + workload_execution = [row[0], row[1], row[2]] + workload_executions.append(workload_execution) db.close() + + return workload_executions |