IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 3, 2012, 4:33:49 PM (14 years ago)
Author:
rhenders
Message:

added new OB batch type

File:
1 edited

Legend:

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

    r33562 r33677  
    1616from datastore import Datastore
    1717from batch import Batch
    18 from dvo import Dvo
     18from dvodetections import DvoDetections
    1919
    2020from initbatch import InitBatch
    2121from stackbatch import StackBatch
    2222from detectionbatch import DetectionBatch
     23from objectbatch import ObjectBatch
    2324
    2425'''
     
    5051            self.logger.errorPair("Cannot connect to a", "scratch database")
    5152       
    52         # create Dvo and Datastore objects
    53         self.dvo = Dvo(self.logger, self.config, self.scratchDb.dbName)
     53        # create Datastore objects
    5454        self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb)
    5555
     
    7272   
    7373
    74         # set a poll time of about 1 minutes
     74        # set a poll time of about 1 minute
    7575        self.parsePollTimeArg("0.0166")
    7676
     
    8383
    8484        ret = super(Loader, self).refreshConfig()
    85         try: self.dvo.checkDvoLocation()
    86         except:
    87             self.logger.errorPair("can't check", "dvo.checkDvoLocation()")
    88             return ret
     85        try: self.scratchDb
     86        except: return ret
     87           
     88        self.dvoDetections = DvoDetections(self.logger, self.config, self.scratchDb.dbName)
    8989
    9090        return ret
     
    134134                        boxDim = self.ippToPspsDb.getBoxDimensions(boxId)
    135135                    except:
    136                        self.logger.infoPair("Can't get details for this box", "%d" % boxId)
    137                        break
     136                        self.logger.infoPair("Can't get details for this box", "%d" % boxId)
     137                        break
    138138     
    139139                    ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType)
     
    148148                    self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
    149149                    boxSizeWithBorder = boxDim['SIDE'] + (self.config.BORDER * 2)
    150        
    151                     # look in DVO for this box (with extra border)
    152                     #self.dvo.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
    153                     #sizeToBeIngested = self.dvo.getDiskSizeOfRegionsToBeIngested()
    154                     #if sizeToBeIngested == 0.0: smfsPerGB = 999999999
    155                     #else: smfsPerGB = len(ids)/sizeToBeIngested
    156                     #self.logger.infoPair("DVO to be ingested", "%.1f GB" % sizeToBeIngested)
    157                     #self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
    158                     smfsPerGB = 0
    159                     # should do we pre-ingest stuff from DVO?
    160                     if smfsPerGB > 40:
    161                         if not self.dvo.sync():
    162                             self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
    163                             continue
    164150     
    165                         useFullTables = 1
    166                     else: useFullTables = 0
     151                    useFullTables = 0
     152                    if batchType != "OB":
     153                        # look in DVO for this box (with extra border)
     154                        #self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
     155                        self.dvoDetections.setSkyArea()
     156                        sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
     157                        if sizeToBeIngested == 0.0: smfsPerGB = 999999999
     158                        else: smfsPerGB = len(ids)/sizeToBeIngested
     159                        self.logger.infoPair("DVO to be ingested", "%.1f GB" % sizeToBeIngested)
     160                        self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
     161                        # should do we pre-ingest stuff from DVO?
     162                        if smfsPerGB > 30:
     163                            if not self.dvoDetections.sync():
     164                                self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
     165                                continue
     166     
     167                            useFullTables = 1
    167168               
    168169                    self.logger.infoBool("Using pre-ingested DVO data?", useFullTables)
     
    216217                        useFullTables)
    217218   
     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   
    218229            batch.run()
    219230   
     
    223234   
    224235            self.logger.infoSeparator()
    225    
    226             # if in test mode, then quit after one batch # TODO remove
    227             if self.config.test: break
    228236   
    229237        self.ippToPspsDb.unlockTables()
Note: See TracChangeset for help on using the changeset viewer.