IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35016


Ignore:
Timestamp:
Jan 22, 2013, 9:43:22 AM (13 years ago)
Author:
eugene
Message:

add dvopsps-based method to ingest detections; do not use foreign key constraint if using dvopsps

Location:
branches/eam_branches/ipp-20121219/ippToPsps/jython
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvo.py

    r34988 r35016  
    562562      return tableName
    563563
     564
     565    '''
     566    ingest skyregion into MySQL database using the native DVO program dvopsps
     567    Populates dvoDetections and dvoDone with FITS tables from DVO for the defined sky area, this
     568    includes purging detections outside sky area
     569    '''
     570    def nativeIngestDetections(self, raCenter, decCenter, boxSize):
     571
     572        # self.scratchDb.resetAllDvoTables()
     573
     574        # make sure we have an up-to-date Images table
     575        self.loadImages()
     576
     577        # XXX blow away existing dvoDetection table?
     578
     579        # dvopsps -D catdir CATDIR -region .... -dbhost xx -dbname xx -dbuser xx -dbpass xx
     580        halfSize = boxSize / 2.0
     581        # -region raCenter-halfSize raCenter+halfSize decCenter-halfSize decCenter+halfSize
     582
     583        # TODO path to DVO prog hardcoded temporarily
     584        cmd = "dvopsps detections"
     585        cmd += " -dbhost " + self.scratchDb.dbHost
     586        cmd += " -dbname " + self.scratchDb.dbName
     587        cmd += " -dbuser " + self.scratchDb.dbUser
     588        cmd += " -dbpass " + self.scratchDb.dbPass
     589        cmd += " -D CATDIR " + self.config.dvoLocation
     590        cmd += " -region "
     591        cmd += " " + str(raCenter-halfSize)
     592        cmd += " " + str(raCenter+halfSize)
     593        cmd += " " + str(decCenter-halfSize)
     594        cmd += " " + str(decCenter+halfSize)
     595
     596        self.logger.infoPair("Running dvopsps", cmd)
     597        p = Popen(cmd, shell=True, stdout=PIPE)
     598        p.wait()
     599
     600
     601        # update lists after attempted sync
     602        # self.printSummary()
     603
     604        return True
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/dvodetections.py

    r35009 r35016  
    166166
    167167       return True
    168 
    169 
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/loader.py

    r35011 r35016  
    160160                    useFullTables = 0
    161161                    if batchType != "OB":
    162                         # look in DVO for this box (with extra border)
    163                         self.logger.infoPair("Querying DVO for this sky area", "")
    164                         self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
    165                         #self.dvoDetections.setSkyArea()
    166                         sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
    167                         if sizeToBeIngested == 0.0: smfsPerGB = 999999999
    168                         else: smfsPerGB = len(ids)/sizeToBeIngested
    169                         self.logger.infoPair("DVO to be ingested", "%7.1e GB" % sizeToBeIngested)
    170                         self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
    171 
    172                         # should do we pre-ingest stuff from DVO?
    173                         # NOTE EAM : this chunk loads the dvo detections into the mysql db
    174                         # XXXX EAM : this should happen for both P2 and Stack detection
    175                         # XXXX EAM : in parallel model, this should happen for all P2 & Stack batches
    176                         #
    177                         if (batchType == 'P2' or batchType == 'ST') and smfsPerGB > 30:
    178                             if not self.dvoDetections.sync():
    179                                 self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
    180                                 continue
    181      
     162
     163                        if (self.dvoDetections.useStilts):
     164                            # look in DVO for this box (with extra border)
     165                            self.logger.infoPair("Querying DVO for this sky area", "")
     166                            self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
     167                            #self.dvoDetections.setSkyArea()
     168                            sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
     169                            if sizeToBeIngested == 0.0: smfsPerGB = 999999999
     170                            else: smfsPerGB = len(ids)/sizeToBeIngested
     171                            self.logger.infoPair("DVO to be ingested", "%7.1e GB" % sizeToBeIngested)
     172                            self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
     173
     174                            # should do we pre-ingest stuff from DVO?
     175                            # NOTE EAM : this chunk loads the dvo detections into the mysql db
     176                            # XXXX EAM : this should happen for both P2 and Stack detection
     177                            # XXXX EAM : in parallel model, this should happen for all P2 & Stack batches
     178                            #
     179                            if (batchType == 'P2' or batchType == 'ST') and smfsPerGB > 30:
     180                                if not self.dvoDetections.sync():
     181                                    self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
     182                                    continue
     183                               
     184                                useFullTables = 1
     185                        else:
     186                            # if we are using the native loader, always use it
     187                            self.dvoDetections.nativeIngestDetections(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)
    182188                            useFullTables = 1
    183189               
  • branches/eam_branches/ipp-20121219/ippToPsps/jython/scratchdb.py

    r35007 r35016  
    485485       self.createIndex(self.dvoDetectionTable, "fileID")
    486486
    487        # now add a delete cascading foreign key constraint on fileID
    488        sql = "ALTER TABLE dvoDetectionFull \
     487       # XXX : this should be based on choice of useStilts (which is set in dvo.py and must be moved)
     488       if (False):
     489           # now add a delete cascading foreign key constraint on fileID
     490           sql = "ALTER TABLE dvoDetectionFull \
    489491              ADD CONSTRAINT fk_fileID \
    490492              FOREIGN KEY (fileID) \
    491493              REFERENCES dvoDone(id) \
    492494              ON DELETE CASCADE"
    493        try: self.execute(sql)
    494        except:
    495            self.logger.errorPair("Unable to create foreign key on", self.dvoDoneTable)
    496            return False
     495           try: self.execute(sql)
     496           except:
     497               self.logger.errorPair("Unable to create foreign key on", self.dvoDoneTable)
     498               return False
    497499
    498500       return True
Note: See TracChangeset for help on using the changeset viewer.