IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 33266 for trunk/ippToPsps


Ignore:
Timestamp:
Feb 14, 2012, 4:31:36 PM (14 years ago)
Author:
rhenders
Message:

getter methids for 'purged' batches; removed need for LOADFAILED field passed-back from ODM

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps/jython/ipptopspsdb.py

    r33259 r33266  
    5050
    5151    '''
     52    Returns a list of batch IDs marked as 'purged' but not yet deleted
     53    '''
     54    def getPurgedButNotDeletedBatchIDs(self, batchType, epoch, dvoGpc1Label, column):
     55
     56        sql = "SELECT DISTINCT batch_id \
     57               FROM batch \
     58               WHERE timestamp > '" + epoch + "' \
     59               AND batch_type = '" + batchType + "' \
     60               AND dvo_db = '" + dvoGpc1Label + "' \
     61               AND purged = 1 \
     62               AND " + column + " = 0"
     63
     64        ids = []
     65        try:
     66            rs = self.executeQuery(sql)
     67            while (rs.next()):
     68                ids.append(rs.getInt(1))
     69        except:
     70            self.logger.exception("Can't query for merged batch ids in ipptopsps Db")
     71
     72        rs.close()
     73
     74        self.logger.debug("Found %d merged but un-deleted items" % len(ids))
     75
     76        return ids
     77
     78    '''
    5279    Returns a list of processed batch IDs that have been loaded to the ODM but not yet deleted
    5380    '''
     
    99126    def getLoadedToODMButNotDeletedFromDXLayer(self, batchType, epoch, dvoGpc1Label):
    100127        return self.getLoadedToODMButNotDeletedBatchIDs(batchType, epoch, dvoGpc1Label, "deleted_dxlayer")
     128
     129    '''
     130    Returns a list of purged  batch IDs that not deleted from local disk
     131    '''
     132    def getPurgedButNotDeletedFromLocalDisk(self, batchType, epoch, dvoGpc1Label):
     133        return self.getPurgedButNotDeletedBatchIDs(batchType, epoch, dvoGpc1Label, "deleted_local")
     134
     135    '''
     136    Returns a list of purged batch IDs that are not deleted from datastore
     137    '''
     138    def getPurgedButNotDeletedFromDatastore(self, batchType, epoch, dvoGpc1Label):
     139        return self.getPurgedButNotDeletedBatchIDs(batchType, epoch, dvoGpc1Label, "deleted_datastore")
    101140
    102141
     
    454493    def updateOdmStatus(self, batchID, odmStatus):
    455494
    456         if odmStatus['LOADFAILED'] == 1: loadedToODM = -1
    457         else: loadedToODM = odmStatus['LOADEDTOODM']
    458495        sql = "UPDATE batch \
    459                SET loaded_to_ODM = " + str(loadedToODM) + ", \
     496               SET loaded_to_ODM = " + str(odmStatus['LOADEDTOODM']) + ", \
    460497               merge_worthy = " + str(odmStatus['MERGEWORTHY']) + ", \
    461498               merged = " + str(odmStatus['MERGED']) + " \
Note: See TracChangeset for help on using the changeset viewer.