IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 29, 2012, 5:07:20 PM (14 years ago)
Author:
eugene
Message:

merging changes from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120405/ippToPsps/jython/loader.py

    r33677 r33948  
    4545                self.scratchDb.disconnect()
    4646                continue
    47             self.logger.infoPair("Using scratch Db", self.scratchDb.dbName)
    4847            break
    4948
    50         if not self.scratchDb.connected:
    51             self.logger.errorPair("Cannot connect to a", "scratch database")
     49        if not self.scratchDb.connected:
     50            self.exitProgram("Cannot connect to a scratch database")
     51            raise
    5252       
    5353        # create Datastore objects
     
    108108    '''
    109109    def run(self):
     110
     111        if not self.scratchDb.connected: return
    110112
    111113        numAttempts = 0
     
    152154                    if batchType != "OB":
    153155                        # look in DVO for this box (with extra border)
    154                         #self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
    155                         self.dvoDetections.setSkyArea()
     156                        self.logger.infoPair("Querying DVO for this sky area", "")
     157                        self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
     158                        #self.dvoDetections.setSkyArea()
    156159                        sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
    157160                        if sizeToBeIngested == 0.0: smfsPerGB = 999999999
     
    160163                        self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
    161164                        # should do we pre-ingest stuff from DVO?
    162                         if smfsPerGB > 30:
     165                        if batchType == 'P2' and smfsPerGB > 30:
    163166                            if not self.dvoDetections.sync():
    164167                                self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
     
    195198   
    196199            self.ippToPspsDb.unlockTables()
     200            self.ippToPspsDb.deletePendingItem(batchType, id)
     201
     202            # catch any raised exceptions in batch constructors
     203            try:
     204                if batchType == "P2":
     205                    batch = DetectionBatch(self.logger,
     206                            self.config,
     207                            self.gpc1Db,
     208                            self.ippToPspsDb,
     209                            self.scratchDb,
     210                            id,
     211                            batchID,
     212                            useFullTables)
     213                elif batchType == "ST":
     214                    batch = StackBatch(self.logger,
     215                            self.config,
     216                            self.gpc1Db,
     217                            self.ippToPspsDb,
     218                            self.scratchDb,
     219                            id,
     220                            batchID,
     221                            useFullTables)
     222   
     223                elif batchType == "OB":
     224                    batch = ObjectBatch(self.logger,
     225                            self.config,
     226                            self.gpc1Db,
     227                            self.ippToPspsDb,
     228                            self.scratchDb,
     229                            id,
     230                            batchID,
     231                            useFullTables)
     232   
     233                batch.run()
    197234   
    198             self.ippToPspsDb.deletePendingItem(batchType, id)
    199 
    200             if batchType == "P2":
    201                 batch = DetectionBatch(self.logger,
    202                         self.config,
    203                         self.gpc1Db,
    204                         self.ippToPspsDb,
    205                         self.scratchDb,
    206                         id,
    207                         batchID,
    208                         useFullTables)
    209             elif batchType == "ST":
    210                 batch = StackBatch(self.logger,
    211                         self.config,
    212                         self.gpc1Db,
    213                         self.ippToPspsDb,
    214                         self.scratchDb,
    215                         id,
    216                         batchID,
    217                         useFullTables)
    218    
    219             elif batchType == "OB":
    220                 batch = ObjectBatch(self.logger,
    221                         self.config,
    222                         self.gpc1Db,
    223                         self.ippToPspsDb,
    224                         self.scratchDb,
    225                         id,
    226                         batchID,
    227                         useFullTables)
    228    
    229             batch.run()
    230    
     235            # if batch fails, ignore and move on to the next one
     236            except:
     237                self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping")
     238                pass
     239
    231240            if not self.checkClientStatus(): return False
    232241   
     
    253262    loader = Loader(sys.argv)
    254263    loader.run()
    255     loader.exitProgram("finished")
     264    loader.exitProgram("completed")
    256265except Exception, e:
    257266    print str(e)
    258267    traceback.print_exc()
     268
Note: See TracChangeset for help on using the changeset viewer.