Loading transfer_service/db_connector.py +36 −0 Original line number Diff line number Diff line Loading @@ -550,6 +550,42 @@ class DbConnector(object): if not conn.closed: conn.rollback() def setTotalBlocks(self, jobId, totalBlocks): """ Sets the job 'total_blocks' parameter for a data retrieve operation. """ with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" UPDATE job SET total_blocks = %s WHERE job_id = %s; """, (totalBlocks, jobId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() def updateProcessedBlocks(self, jobId, processedBlocks): """ Updates the job 'processed_blocks' parameter for a data retrieve operation. """ with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" UPDATE job SET processed_blocks = %s WHERE job_id = %s; """, (processedBlocks, jobId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() def setResults(self, jobId, results): """Sets the job 'results' parameter.""" with self.getConnection() as conn: Loading Loading
transfer_service/db_connector.py +36 −0 Original line number Diff line number Diff line Loading @@ -550,6 +550,42 @@ class DbConnector(object): if not conn.closed: conn.rollback() def setTotalBlocks(self, jobId, totalBlocks): """ Sets the job 'total_blocks' parameter for a data retrieve operation. """ with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" UPDATE job SET total_blocks = %s WHERE job_id = %s; """, (totalBlocks, jobId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() def updateProcessedBlocks(self, jobId, processedBlocks): """ Updates the job 'processed_blocks' parameter for a data retrieve operation. """ with self.getConnection() as conn: try: cursor = conn.cursor(cursor_factory = RealDictCursor) cursor.execute(""" UPDATE job SET processed_blocks = %s WHERE job_id = %s; """, (processedBlocks, jobId,)) conn.commit() except Exception as e: if not conn.closed: conn.rollback() def setResults(self, jobId, results): """Sets the job 'results' parameter.""" with self.getConnection() as conn: Loading