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:
parent
3e8a85b029
commit
5b27e438a9
|
@ -0,0 +1,28 @@
|
|||
"""PVC version 0.9.37
|
||||
|
||||
Revision ID: 5c2109dbbeae
|
||||
Revises: bae4d5a77c74
|
||||
Create Date: 2021-10-02 00:47:29.693579
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '5c2109dbbeae'
|
||||
down_revision = 'bae4d5a77c74'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.add_column('storage_benchmarks', sa.Column('test_format', sa.Integer(), server_default='0', nullable=False))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('storage_benchmarks', 'test_format')
|
||||
# ### end Alembic commands ###
|
|
@ -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)
|
||||
|
|
|
@ -961,6 +961,7 @@
|
|||
"storagebenchmark": {
|
||||
"properties": {
|
||||
"benchmark_result": {
|
||||
"description": "A format 0 test result",
|
||||
"properties": {
|
||||
"test_name": {
|
||||
"properties": {
|
||||
|
@ -1094,6 +1095,10 @@
|
|||
"job": {
|
||||
"description": "The job name (an ISO date) of the test result",
|
||||
"type": "string"
|
||||
},
|
||||
"test_format": {
|
||||
"description": "The PVC benchmark format of the results",
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"type": "object"
|
||||
|
|
Loading…
Reference in New Issue