IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Feb 6, 2013, 3:16:35 PM (13 years ago)
Author:
eugene
Message:

upgrade to ippToPsps (see doc/upgrade.txt): adds native dvo to mysql ingest operations, adds autogen configuration & installation, splits out global config information from new "skychunk" information (current region on the sky being processed), adds test suites

Location:
trunk/ippToPsps
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippToPsps

  • trunk/ippToPsps/jython

    • Property svn:ignore
      •  

        old new  
        11*.class
         2Makefile
         3Makefile.in
  • trunk/ippToPsps/jython/loader.py

    r34661 r35097  
    3434        super(Loader, self).__init__(argv, 1, 1)
    3535
    36         # create gpc1 database objects
     36        if self.skychunk.parallel:
     37            print "PARALLEL dvo"
     38        else:
     39            print "SERIAL dvo"
     40
     41        # connect to the gpc1 database
    3742        self.gpc1Db = Gpc1Db(self.logger, self.config)
    3843
    3944        # connect to scratch database
    40         scratchDbs = ['ipptopsps_scratch', 'ipptopsps_scratch2', 'ipptopsps_scratch3']
    41         for dbName in scratchDbs:
    42             self.scratchDb = ScratchDb(self.logger, self.config, dbName)
    43             if self.scratchDb.anyOtherConnections():
    44                 self.logger.errorPair("This scratch Db is already in use", dbName)
     45        scratchDbs = ['1', '2', '3']
     46        for dbVersion in scratchDbs:
     47            self.scratchDb = ScratchDb(self.logger, self.config, dbVersion)
     48            if not self.config.test and self.scratchDb.anyOtherConnections():
     49                self.logger.errorPair("This scratch Db is already in use", self.scratchDb.dbName)
    4550                self.scratchDb.disconnect()
    4651                continue
     
    5257       
    5358        # create Datastore objects
    54         self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb)
     59        self.datastore = Datastore(self.logger, self.skychunk, self.ippToPspsDb)
    5560
    5661        # if an IN batch is requested, create and quit
     
    6065               batch = InitBatch(self.logger,
    6166                       self.config,
     67                       self.skychunk,
    6268                       self.gpc1Db,
    6369                       self.ippToPspsDb,
     
    7278   
    7379
     80        # if the 'once' option is passed, we do not loop multiple times in 'run'
     81        self.onePassOnly = 0
     82        if len(sys.argv) > 2 and sys.argv[2] == "once":
     83           self.onePassOnly = 1
     84
    7485        # set a poll time of about 1 minute
    7586        self.parsePollTimeArg("0.0166")
    7687
    77         self.config.printAll()
     88        self.skychunk.printAll()
    7889
    7990    '''
    8091    Overrides base-class version so we can ensure our scratch Db is using the right DVO Db
    8192    '''
    82     def refreshConfig(self):
    83 
    84         ret = super(Loader, self).refreshConfig()
     93    def refreshSkychunk(self):
     94
     95        ret = super(Loader, self).refreshSkychunk()
    8596        try: self.scratchDb
    8697        except: return ret
    8798           
    88         self.dvoDetections = DvoDetections(self.logger, self.config, self.scratchDb.dbName)
     99        self.dvoDetections = DvoDetections(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb.dbName)
    89100
    90101        return ret
    91102
    92103    '''
    93     Overrides base_class version so we can break out of processing loops if the config changes
     104    Overrides base_class version so we can break out of processing loops if the skychunk changes
    94105    '''
    95106    def checkClientStatus(self):
    96107
    97         oldConfigName = self.config.name
     108        oldSkychunkName = self.skychunk.name
    98109        super(Loader, self).checkClientStatus()
    99         if oldConfigName != self.config.name:
    100             self.logger.infoPair("Config changed",  "from '" + oldConfigName + "' to '" + self.config.name + "'")
    101             self.config.printAll()
     110        if oldSkychunkName != self.skychunk.name:
     111            self.logger.infoPair("Skychunk changed",  "from '" + oldSkychunkName + "' to '" + self.skychunk.name + "'")
     112            self.skychunk.printAll()
    102113            return False
    103114
     
    115126
    116127            abort = False
    117             for batchType in self.config.batchTypes:
     128            for batchType in self.skychunk.batchTypes:
    118129
    119130                # get a stripe's worth of box IDs
     
    141152                    ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType)
    142153               
     154                    # ids are the stage_ids for items to be processed (eg, stack_id for a stack CMF, cam_id for P2 smf)
     155
    143156                    if len(ids) < 1:
    144157                        self.logger.debugPair("No " + batchType + " items found in this box", "skipping")
     
    149162                    self.logger.infoPair("Box dimensions", "%.1f / %.1f / %.1f" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE']))
    150163                    self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
    151                     boxSizeWithBorder = boxDim['SIDE'] + (self.config.BORDER * 2)
     164                    boxSizeWithBorder = boxDim['SIDE'] + (self.skychunk.BORDER * 2)
     165                    boxSizeSansBorder = boxDim['SIDE']
    152166                    self.logger.infoPair("got here", "ok")
    153167                    useFullTables = 0
    154168                    if batchType != "OB":
    155                         # look in DVO for this box (with extra border)
    156                         self.logger.infoPair("Querying DVO for this sky area", "")
    157                         self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
    158                         #self.dvoDetections.setSkyArea()
    159                         sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
    160                         if sizeToBeIngested == 0.0: smfsPerGB = 999999999
    161                         else: smfsPerGB = len(ids)/sizeToBeIngested
    162                         self.logger.infoPair("DVO to be ingested", "%.1f GB" % sizeToBeIngested)
    163                         self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
    164                         # should do we pre-ingest stuff from DVO?
    165                         if batchType == 'P2' and smfsPerGB > 30:
    166                             if not self.dvoDetections.sync():
    167                                 self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
    168                                 continue
    169      
     169
     170                        if (self.dvoDetections.useStilts):
     171                            # look in DVO for this box (with extra border)
     172                            self.logger.infoPair("Querying DVO for this sky area", "")
     173                            self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
     174                            #self.dvoDetections.setSkyArea()
     175                            sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
     176                            if sizeToBeIngested == 0.0: smfsPerGB = 999999999
     177                            else: smfsPerGB = len(ids)/sizeToBeIngested
     178                            self.logger.infoPair("DVO to be ingested", "%7.1e GB" % sizeToBeIngested)
     179                            self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
     180
     181                            # should do we pre-ingest stuff from DVO?
     182                            # NOTE EAM : this skychunk loads the dvo detections into the mysql db
     183                            # XXXX EAM : this should happen for both P2 and Stack detection
     184                            # XXXX EAM : in parallel model, this should happen for all P2 & Stack batches
     185                            #
     186                            if (batchType == 'P2' or batchType == 'ST') and smfsPerGB > 30:
     187                                if not self.dvoDetections.sync():
     188                                    self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
     189                                    continue
     190                               
     191                                useFullTables = 1
     192                        else:
     193                            # XXX EAM : this is not currently an
     194                            # option. either remove the non-native
     195                            # ingest code or make it an option
     196                            # if we are using the native loader, always use it
     197                            # need to work out a good boundary / region strategy in coordination with
     198                            # impact of mysql insertion
     199                            if not self.ippToPspsDb.isBoxIngested(boxId):
     200                                self.dvoDetections.nativeIngestDetections(boxId, boxDim['RA'], boxDim['DEC'], boxSizeSansBorder)
     201
    170202                            useFullTables = 1
    171203               
     204                    ## else:
     205                    ##     # if we are using the native loader, always use it
     206                    ##     # need to work out a good boundary / region strategy in coordination with
     207                    ##     # impact of mysql insertion
     208                    ##     self.dvoObjects.nativeIngestObjects(boxDim['RA'], boxDim['DEC'], boxSizeSansBorder)
     209                    ##     useFullTables = 1
     210
     211                    '''
     212                    NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches
     213                    '''
    172214                    self.logger.infoBool("Using pre-ingested DVO data?", useFullTables)
    173215                    if not self.processTheseItems(batchType, ids, useFullTables):
     
    175217                        break
    176218                    self.logger.infoPair("processed","ok")
     219
    177220            if abort or not self.checkClientStatus(): abort = True
    178221            elif numAttempts > 1 and not self.waitForPollTime():  break
    179222
     223            if self.onePassOnly: self.exitProgram("one pass completed")
    180224       
    181225    '''
     
    210254                    batch = DetectionBatch(self.logger,
    211255                            self.config,
     256                            self.skychunk,
    212257                            self.gpc1Db,
    213258                            self.ippToPspsDb,
     
    219264                    batch = StackBatch(self.logger,
    220265                            self.config,
     266                            self.skychunk,
    221267                            self.gpc1Db,
    222268                            self.ippToPspsDb,
     
    229275                    batch = ObjectBatch(self.logger,
    230276                            self.config,
     277                            self.skychunk,
    231278                            self.gpc1Db,
    232279                            self.ippToPspsDb,
     
    260307    '''
    261308    def printUsage(self):
    262         super(Cleanup, self).printUsage("<[init]>")
     309        super(Loader, self).printUsage("<[init]>")
    263310
    264311   
Note: See TracChangeset for help on using the changeset viewer.