IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32193 for trunk/ippToPsps


Ignore:
Timestamp:
Aug 25, 2011, 1:08:36 PM (15 years ago)
Author:
rhenders
Message:

now using -1 to mean this stage has failed; changes queries to explicitely look for 1 or -1 or 0; added getProcessedButFailedDatastoreBatchIDs() method

File:
1 edited

Legend:

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

    r32166 r32193  
    6666               AND batch_type = '" + batchType + "' \
    6767               AND dvo_db = '" + dvoGpc1Label + "' \
    68                AND merged \
    69                AND !deleted"
     68               AND merged = 1\
     69               AND deleted = 0"
    7070
    7171        ids = []
     
    8484
    8585    '''
     86    Returns a list of processed batch IDs that are not loaded to the datastore
     87    '''
     88    def getProcessedButFailedDatastoreBatchIDs(self, epoch, dvoGpc1Label):
     89
     90        sql = "SELECT DISTINCT batch_id \
     91               FROM batch \
     92               WHERE timestamp > '" + epoch + "' \
     93               AND dvo_db = '" + dvoGpc1Label + "' \
     94               AND processed = 1\
     95               AND loaded_to_datastore = -1"
     96
     97        ids = []
     98        try:
     99            rs = self.executeQuery(sql)
     100            while (rs.next()):
     101                ids.append(rs.getInt(1))
     102        except:
     103            self.logger.exception("Can't query for processed batch ids not loaded to datastore ipptopsps Db")
     104
     105        rs.close()
     106
     107        self.logger.debug("Found %d processed but-not-on-datastore items" % len(ids))
     108
     109        return ids
     110
     111    '''
    86112    Returns a list of processed batch IDs that are not yet merged for this epoch and dvo label
    87113    '''
     
    92118               WHERE timestamp > '" + epoch + "' \
    93119               AND dvo_db = '" + dvoGpc1Label + "' \
    94                AND loaded_to_datastore \
    95                AND !merged"
     120               AND loaded_to_datastore = 1 \
     121               AND merged = 0 OR merged = -1"
    96122
    97123        ids = []
     
    161187               FROM batch \
    162188               WHERE batch_type = '" + batchType + "' \
    163                AND loaded_to_datastore \
     189               AND loaded_to_datastore = 1 \
    164190               AND timestamp > '" + epoch + "' \
    165191               AND dvo_db = '" + dvoGpc1Label + "' \
     
    299325               WHERE stage_id = " + str(stage_id) + " \
    300326               AND batch_type = '" + batchType + "' \
    301                AND processed \
    302                AND loaded_to_datastore"
     327               AND processed = 1 \
     328               AND loaded_to_datastore = 1"
    303329
    304330        try:
Note: See TracChangeset for help on using the changeset viewer.