Add test format versioning to storage benchmarks
Adds a test_format database column and a value in the API return for the test format version, starting at 0 for the existing format as of 0.9.37. References #143
This commit is contained in:
@ -95,6 +95,7 @@ def list_benchmarks(job=None):
|
||||
benchmark_data = dict()
|
||||
benchmark_data['id'] = benchmark['id']
|
||||
benchmark_data['job'] = benchmark['job']
|
||||
benchmark_data['test_format'] = benchmark['test_format']
|
||||
benchmark_data['benchmark_result'] = loads(benchmark['result'])
|
||||
# Append the new data to our actual output structure
|
||||
data.append(benchmark_data)
|
||||
@ -111,6 +112,9 @@ def run_benchmark(self, pool):
|
||||
import json
|
||||
from datetime import datetime
|
||||
|
||||
# Define the current test format
|
||||
TEST_FORMAT = 0
|
||||
|
||||
time.sleep(2)
|
||||
|
||||
# Phase 0 - connect to databases
|
||||
@ -135,8 +139,8 @@ def run_benchmark(self, pool):
|
||||
|
||||
print("Storing running status for job '{}' in database".format(job_name))
|
||||
try:
|
||||
query = "INSERT INTO storage_benchmarks (job, result) VALUES (%s, %s);"
|
||||
args = (job_name, "Running",)
|
||||
query = "INSERT INTO storage_benchmarks (job, test_format, result) VALUES (%s, %s);"
|
||||
args = (job_name, TEST_FORMAT, "Running",)
|
||||
db_cur.execute(query, args)
|
||||
db_conn.commit()
|
||||
except Exception as e:
|
||||
|
@ -3420,8 +3420,12 @@ class API_Storage_Ceph_Benchmark(Resource):
|
||||
job:
|
||||
type: string
|
||||
description: The job name (an ISO date) of the test result
|
||||
test_format:
|
||||
type: integer
|
||||
description: The PVC benchmark format of the results
|
||||
benchmark_result:
|
||||
type: object
|
||||
description: A format 0 test result
|
||||
properties:
|
||||
test_name:
|
||||
type: object
|
||||
|
@ -231,11 +231,13 @@ class DBStorageBenchmarks(db.Model):
|
||||
|
||||
id = db.Column(db.Integer, primary_key=True)
|
||||
job = db.Column(db.Text, nullable=False)
|
||||
test_format = db.Column(db.Integer, nullable=False, default=0, server_default='0')
|
||||
result = db.Column(db.Text, nullable=False)
|
||||
|
||||
def __init__(self, job, result):
|
||||
def __init__(self, job, result, test_format):
|
||||
self.job = job
|
||||
self.result = result
|
||||
self.test_format = test_format
|
||||
|
||||
def __repr__(self):
|
||||
return '<id {}>'.format(self.id)
|
||||
|
Reference in New Issue
Block a user