Changeset 32496
- Timestamp:
- Oct 5, 2011, 5:04:07 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/ipptopspsdb.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r32461 r32496 23 23 24 24 ''' 25 Returns a list of processed batch IDs that are merged but not yet deleted 25 Returns a list of merged batch IDs that are merged but not yet deleted 26 ''' 27 def getMergedButNotDeletedBatchIDs(self, batchType, epoch, dvoGpc1Label, column): 28 29 sql = "SELECT DISTINCT batch_id \ 30 FROM batch \ 31 WHERE timestamp > '" + epoch + "' \ 32 AND batch_type = '" + batchType + "' \ 33 AND dvo_db = '" + dvoGpc1Label + "' \ 34 AND merged = 1 \ 35 AND " + column + " = 0" 36 37 ids = [] 38 try: 39 rs = self.executeQuery(sql) 40 while (rs.next()): 41 ids.append(rs.getInt(1)) 42 except: 43 self.logger.exception("Can't query for merged batch ids in ipptopsps Db") 44 45 rs.close() 46 47 self.logger.debug("Found %d merged but un-deleted items" % len(ids)) 48 49 return ids 50 51 ''' 52 Returns a list of processed batch IDs that have been loaded to the ODM but not yet deleted 26 53 ''' 27 54 def getLoadedToODMButNotDeletedBatchIDs(self, batchType, epoch, dvoGpc1Label, column): … … 50 77 51 78 ''' 52 Returns a list of processed batch IDs that are merged but not deleted from local disk 79 Returns a list of merged batch IDs that are not deleted from local disk 80 ''' 81 def getMergedButNotDeletedFromLocalDisk(self, batchType, epoch, dvoGpc1Label): 82 return self.getMergedButNotDeletedBatchIDs(batchType, epoch, dvoGpc1Label, "deleted_local") 83 84 ''' 85 Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from local disk 53 86 ''' 54 87 def getLoadedToODMButNotDeletedFromLocalDisk(self, batchType, epoch, dvoGpc1Label): … … 56 89 57 90 ''' 58 Returns a list of processed batch IDs that are mergedbut not deleted from datastore91 Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from datastore 59 92 ''' 60 93 def getLoadedToODMButNotDeletedFromDatastore(self, batchType, epoch, dvoGpc1Label): … … 62 95 63 96 ''' 64 Returns a list of processed batch IDs that are mergedbut not deleted from DXLayer97 Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from DXLayer 65 98 ''' 66 99 def getLoadedToODMButNotDeletedFromDXLayer(self, batchType, epoch, dvoGpc1Label): … … 97 130 ''' 98 131 Returns a list of processed batch IDs that have not yet been loaded to the ODM 132 NOTE we exclude batches already deleted from the datastore, as sometimes we delete stuff prior to 133 loading to ODM if there is a known problem with the batch 99 134 ''' 100 135 def getUnloadedBatchIDs(self, epoch, dvoGpc1Label, batchType): … … 106 141 AND loaded_to_datastore = 1 \ 107 142 AND batch_type = '" + batchType + "' \ 108 AND loaded_to_ODM = 0 "109 143 AND loaded_to_ODM = 0 \ 144 AND deleted_datastore = 0" 110 145 111 146 ids = [] … … 192 227 rs = self.executeQuery(sql) 193 228 rs.first() 194 total = rs.get Int(1)229 total = rs.getLong(1) 195 230 except: 196 231 self.logger.exception("Can't query for total detections published") … … 266 301 ''' 267 302 def getStages(self): 268 return ['processed', 'loaded_to_datastore', 'loaded_to_ODM', 'merge_worthy', 'deleted_datastore', 'merged', 'deleted_ dxlayer', 'deleted_local']303 return ['processed', 'loaded_to_datastore', 'loaded_to_ODM', 'merge_worthy', 'deleted_datastore', 'merged', 'deleted_local', 'deleted_dxlayer'] 269 304 270 305 ''' … … 414 449 except: 415 450 self.logger.exception("Unable to check whether this batch is being processed") 451 452 ''' 453 Gets the batch type of this batch 454 ''' 455 def getBatchType(self, batch_id): 456 457 sql = "SELECT batch_type \ 458 FROM batch \ 459 WHERE batch_id = " + str(batch_id) 460 461 batch_type = "NA" 462 try: 463 rs = self.executeQuery(sql) 464 rs.first() 465 batch_type = rs.getString(1) 466 except: 467 self.logger.exception("Unable to check whether this batch has already been processed") 468 469 return batch_type 416 470 417 471 '''
Note:
See TracChangeset
for help on using the changeset viewer.
