IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 22, 2011, 4:19:29 PM (15 years ago)
Author:
rhenders
Message:

added insertDetectionMeta() and alreadyProcessed() methods

File:
1 edited

Legend:

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

    r31345 r31355  
    8989
    9090    '''
     91    Have we already processed and published this batch?
     92    '''
     93    def alreadyProcessed(self, table, col, value):
     94
     95        sql = "SELECT COUNT(*) FROM \
     96               " + table + " \
     97               JOIN batch USING(batch_id) \
     98               WHERE " + col + " = " + str(value) + " \
     99               AND processed \
     100               AND loaded_to_datastore"
     101
     102        try:
     103            rs = self.stmt.executeQuery(sql)
     104            rs.first()
     105            if rs.getInt(1) > 0:
     106                self.logger.error("Batch with "+col+" = "+str(value)+" has already been processed and published to datastore")
     107                return True
     108            else:
     109                return False
     110        except:
     111            self.logger.exception("Unable to check whether this batch has already been processed")
     112
     113     
     114
     115    '''
     116    Inserts some detection metadata for this batch ID
     117    '''
     118    def insertDetectionMeta(self, batchID, expID, filter):
     119
     120        sql = "INSERT INTO detection ( \
     121               batch_id \
     122               ,exp_id \
     123               ,filter \
     124               ) VALUES ( \
     125               " + str(batchID) + " \
     126               ," + str(expID) + " \
     127               ,'" + filter + "' \
     128               )"
     129
     130        self.stmt.execute(sql)
     131
     132    '''
    91133    Inserts some stack metadata for this batch ID
    92134    '''
Note: See TracChangeset for help on using the changeset viewer.