IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 31808


Ignore:
Timestamp:
Jul 1, 2011, 8:49:25 AM (15 years ago)
Author:
rhenders
Message:

added stage_id column to batch table which is either cam_id or stack_id depending on batch type; simplified alreadyProcessed() method using new stage_id column

File:
1 edited

Legend:

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

    r31503 r31808  
    2323    Creates a new batch
    2424    '''
    25     def createNewBatch(self, batchType, survey, dvoDb, datastoreProduct):
     25    def createNewBatch(self, batchType, stageID, survey, dvoDb, datastoreProduct):
    2626
    2727        sql = "INSERT INTO batch ( \
    2828               batch_type, \
     29               stage_id, \
    2930               survey, \
    3031               dvo_db, \
     
    3233               ) VALUES ( \
    3334               '" + batchType + "', \
     35               " + str(stageID) + ", \
    3436               '" + survey + "', \
    3537               '" + dvoDb + "', \
     
    9193    Have we already processed and published this batch?
    9294    '''
    93     def alreadyProcessed(self, table, col, value):
     95    def alreadyProcessed(self, stage_id):
    9496
    95         sql = "SELECT COUNT(*) FROM \
    96                " + table + " \
    97                JOIN batch USING(batch_id) \
    98                WHERE " + col + " = " + str(value) + " \
     97        sql = "SELECT COUNT(*) \
     98               FROM batch \
     99               WHERE stage_id = " + str(stage_id) + " \
    99100               AND processed \
    100101               AND loaded_to_datastore"
     
    104105            rs.first()
    105106            if rs.getInt(1) > 0:
    106                 self.logger.error("Batch with "+col+" = "+str(value)+" has already been processed and published to datastore")
     107                self.logger.error("Batch with stage_id = "+str(stage_id) + " has already been processed and published to datastore")
    107108                return True
    108109            else:
     
    133134    Inserts some stack metadata for this batch ID
    134135    '''
    135     def insertStackMeta(self, batchID, skyID, stackID, filter, stackType):
     136    def insertStackMeta(self, batchID, stackID, filter, stackType):
    136137
    137138        sql = "INSERT INTO stack ( \
    138139               batch_id \
    139                ,sky_id \
    140140               ,stack_id \
    141141               ,filter \
     
    143143               ) VALUES ( \
    144144               " + str(batchID) + " \
    145                ," + str(skyID) + " \
    146145               ," + str(stackID) + " \
    147146               ,'" + filter + "' \
Note: See TracChangeset for help on using the changeset viewer.