IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 32220


Ignore:
Timestamp:
Aug 29, 2011, 9:32:12 PM (15 years ago)
Author:
rhenders
Message:

added methid to check for consistent failures for a particular stage_id; added constraints to alreadyProcessed() method

File:
1 edited

Legend:

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

    r32209 r32220  
    351351    Have we already processed and published this batch?
    352352    '''
    353     def alreadyProcessed(self, batchType, stage_id):
     353    def alreadyProcessed(self, batchType, stage_id, epoch, dvoGpc1Label):
    354354
    355355        sql = "SELECT COUNT(*) \
     
    357357               WHERE stage_id = " + str(stage_id) + " \
    358358               AND batch_type = '" + batchType + "' \
     359               AND timestamp > '" + epoch + "' \
     360               AND dvo_db = '" + dvoGpc1Label + "' \
    359361               AND processed = 1 \
    360362               AND loaded_to_datastore = 1"
     
    364366            rs.first()
    365367            if rs.getInt(1) > 0:
    366                 self.logger.error("Batch with stage_id = "+str(stage_id) + " has already been processed and published to datastore")
     368                self.logger.errorPair(str(stage_id) + " has already been published", "skipping")
    367369                return True
    368370            else:
     
    370372        except:
    371373            self.logger.exception("Unable to check whether this batch has already been processed")
     374
     375    '''
     376    Has this stage_id consistently failed to process?
     377    '''
     378    def consistentlyFailed(self, batchType, stage_id, epoch, dvoGpc1Label, count):
     379
     380        sql = "SELECT COUNT(*) \
     381               FROM batch \
     382               WHERE stage_id = " + str(stage_id) + " \
     383               AND batch_type = '" + batchType + "' \
     384               AND timestamp > '" + epoch + "' \
     385               AND dvo_db = '" + dvoGpc1Label + "' \
     386               AND processed != 1"
     387
     388        try:
     389            rs = self.executeQuery(sql)
     390            rs.first()
     391            if rs.getInt(1) >= count:
     392                self.logger.errorPair(str(stage_id) + " has failed %d times" % count, "skipping")
     393                return True
     394            else:
     395                return False
     396        except:
     397            self.logger.exception("Unable to check whether this batch has consistently failed")
    372398
    373399     
Note: See TracChangeset for help on using the changeset viewer.