Fix bug cleaning up successful benchmark results

This commit is contained in:
Joshua Boniface 2024-03-08 14:22:07 -05:00
parent 9fdb6d8708
commit a461791ce8
1 changed files with 7 additions and 5 deletions

View File

@ -115,12 +115,13 @@ class BenchmarkError(Exception):
# #
def cleanup(job_name, db_conn=None, db_cur=None, zkhandler=None): def cleanup(job_name, db_conn=None, db_cur=None, zkhandler=None, final=False):
if db_conn is not None and db_cur is not None: if db_conn is not None and db_cur is not None:
# Clean up our dangling result if not final:
query = "DELETE FROM storage_benchmarks WHERE job = %s;" # Clean up our dangling result (non-final runs only)
args = (job_name,) query = "DELETE FROM storage_benchmarks WHERE job = %s;"
db_cur.execute(query, args) args = (job_name,)
db_cur.execute(query, args)
db_conn.commit() db_conn.commit()
# Close the database connections cleanly # Close the database connections cleanly
close_database(db_conn, db_cur) close_database(db_conn, db_cur)
@ -410,6 +411,7 @@ def worker_run_benchmark(zkhandler, celery, config, pool):
db_conn=db_conn, db_conn=db_conn,
db_cur=db_cur, db_cur=db_cur,
zkhandler=zkhandler, zkhandler=zkhandler,
final=True,
) )
current_stage += 1 current_stage += 1