mirror of
				https://github.com/ARM-software/workload-automation.git
				synced 2025-10-31 15:12:25 +00: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:
		| @@ -222,6 +222,8 @@ class PostgresqlResultProcessor(OutputProcessor): | |||||||
|         ''' Run once for each job to upload information that is |         ''' Run once for each job to upload information that is | ||||||
|             updated on a job by job basis. |             updated on a job by job basis. | ||||||
|         ''' |         ''' | ||||||
|  |         # Ensure we're still connected to the database. | ||||||
|  |         self.connect_to_database() | ||||||
|         job_uuid = uuid.uuid4() |         job_uuid = uuid.uuid4() | ||||||
|         # Create a new job |         # Create a new job | ||||||
|         self.cursor.execute( |         self.cursor.execute( | ||||||
| @@ -305,6 +307,9 @@ class PostgresqlResultProcessor(OutputProcessor): | |||||||
|         ''' |         ''' | ||||||
|         if not self.cursor:  # Database did not connect correctly. |         if not self.cursor:  # Database did not connect correctly. | ||||||
|             return |             return | ||||||
|  |         # Ensure we're still connected to the database. | ||||||
|  |         self.connect_to_database() | ||||||
|  |  | ||||||
|         # Update the job statuses following completion of the run |         # Update the job statuses following completion of the run | ||||||
|         for job in run_output.jobs: |         for job in run_output.jobs: | ||||||
|             job_id = job.id |             job_id = job.id | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user