1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2024-10-05 18:31:12 +01:00

output_processors/postgresql: Ensure still connected to the database

Before exporting output to ensure that we are still connected to the
database. The connection may be dropped so reconnect if necessary, this
is a more of an issue with longer running jobs.
This commit is contained in:
Marc Bonnici 2019-08-28 11:05:48 +01:00 committed by setrofim
parent eeebd010b9
commit c1e095be51

View File

@ -222,6 +222,8 @@ class PostgresqlResultProcessor(OutputProcessor):
''' Run once for each job to upload information that is
updated on a job by job basis.
'''
# Ensure we're still connected to the database.
self.connect_to_database()
job_uuid = uuid.uuid4()
# Create a new job
self.cursor.execute(
@ -305,6 +307,9 @@ class PostgresqlResultProcessor(OutputProcessor):
'''
if not self.cursor: # Database did not connect correctly.
return
# Ensure we're still connected to the database.
self.connect_to_database()
# Update the job statuses following completion of the run
for job in run_output.jobs:
job_id = job.id