IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Aug 12, 2014, 4:10:18 PM (12 years ago)
Author:
eugene
Message:

merge changes from branches/eam_branches/ipp-20140717

File:
1 edited

Legend:

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

    r36709 r37246  
    160160                    self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids))
    161161
    162                     useFullTables = 0
    163162                    if batchType != "OB":
    164 
    165                         if (self.dvoDetections.useStilts):
    166                             # look in DVO for this box (with extra border)
    167                             self.logger.infoPair("Querying DVO for this sky area", "")
    168 
    169                             # XXXX EAM : This code should not be used anymore
    170                             boxSize = 0.0
    171                             self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSize)
    172                             #self.dvoDetections.setSkyArea()
    173                             sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested()
    174                             if sizeToBeIngested == 0.0: smfsPerGB = 999999999
    175                             else: smfsPerGB = len(ids)/sizeToBeIngested
    176                             self.logger.infoPair("DVO to be ingested", "%7.1e GB" % sizeToBeIngested)
    177                             self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)
    178 
    179                             # should do we pre-ingest stuff from DVO?
    180                             # NOTE EAM : this skychunk loads the dvo detections into the mysql db
    181                             # XXXX EAM : this should happen for both P2 and Stack detection
    182                             # XXXX EAM : in parallel model, this should happen for all P2 & Stack batches
    183                             #
    184                             if (batchType == 'P2' or batchType == 'ST' or batchType == 'DF' or batchType == 'FW') and smfsPerGB > 30:
    185                                 if not self.dvoDetections.sync():
    186                                     self.logger.errorPair("Could not sync DVO with MySQL", "skipping")
    187                                     continue
    188                                
    189                                 useFullTables = 1
    190                         else:
    191                             # XXX EAM : this is not currently optional
    192                             # (it is the only path). either remove the
    193                             # non-native ingest code or make it an
    194                             # option if we are using the native
    195                             # loader, always use it need to work out a
    196                             # good boundary / region strategy in
    197                             # coordination with impact of mysql
    198                             # insertion
    199                             if not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost):
    200                                 if not self.dvoDetections.nativeIngestDetections(boxId, boxDim):
    201                                     self.logger.error("Unable to ingest detections with nativeIngest")
    202                                     return False
    203 
    204                             useFullTables = 1
    205                
    206                     ## else:
    207                     ##     # if we are using the native loader, always use it
    208                     ##     # need to work out a good boundary / region strategy in coordination with
    209                     ##     # impact of mysql insertion
    210                     ##     self.dvoObjects.nativeIngestObjects(boxDim['RA'], boxDim['DEC'], boxSizeSansBorder)
    211                     ##     useFullTables = 1
     163                        if self.config.resetDvo or not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost):
     164                            if not self.dvoDetections.nativeIngestDetections(boxId, boxDim):
     165                                self.logger.error("Unable to ingest detections with nativeIngest")
     166                                return False
    212167
    213168                    '''
    214169                    NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches
    215170                    '''
    216                     self.logger.infoBool("Using pre-ingested DVO data?", useFullTables)
    217                     if not self.processTheseItems(batchType, ids, useFullTables):
     171                    if not self.processTheseItems(batchType, ids):
    218172                        abort = True
    219173                        break
    220174                    self.logger.infoPair("processed","ok")
    221175
     176            self.logger.infoPair("done with processing boxes, numAttempts: ", str(numAttempts))
    222177            if abort or not self.checkClientStatus(): abort = True
    223178            elif numAttempts > 1 and not self.waitForPollTime():  break
     
    228183    Actually loops through items and processes them
    229184    '''
    230     def processTheseItems(self, batchType, ids, useFullTables):
     185    def processTheseItems(self, batchType, ids):
    231186   
    232187        self.logger.infoPair("%s items queued" % batchType, "%d" % len(ids))
     
    246201                continue
    247202            #self.logger.infoPair("heather:","passed logic")
     203
    248204            self.ippToPspsDb.unlockTables()
    249205            #self.logger.infoPair("heather:","unlock table")
     206
    250207            self.ippToPspsDb.deletePendingItem(batchType, id)
    251208            #self.logger.infoPair("heather:","deleted pending item")
     
    262219                            self.scratchDb,
    263220                            id,
    264                             batchID,
    265                             useFullTables)
     221                            batchID)
    266222                elif batchType == "ST":
    267223                    self.logger.infoPair("defining ST batch for sky_id:",id)
     
    273229                            self.scratchDb,
    274230                            id,
    275                             batchID,
    276                             useFullTables)
     231                            batchID)
    277232   
    278233                elif batchType == "OB":
     
    284239                            self.scratchDb,
    285240                            id,
    286                             batchID,
    287                             useFullTables)
     241                            batchID)
    288242   
    289243                elif batchType == "DF":
     
    295249                            self.scratchDb,
    296250                            id,
    297                             batchID,
    298                             useFullTables)
     251                            batchID)
    299252   
    300253                elif batchType == "DO":
     
    306259                            self.scratchDb,
    307260                            id,
    308                             batchID,
    309                             useFullTables)
     261                            batchID)
    310262   
    311263                elif batchType == "FW":
     
    317269                            self.scratchDb,
    318270                            id,
    319                             batchID,
    320                             useFullTables)
     271                            batchID)
    321272   
    322273                elif batchType == "FO":
     
    328279                            self.scratchDb,
    329280                            id,
    330                             batchID,
    331                             useFullTables)
     281                            batchID)
    332282                   
    333283                batch.run()
     
    337287                self.logger.error("EXCEPTION: " + str(e))
    338288                self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping")
     289                sys.exit(1)
    339290                pass
    340291
Note: See TracChangeset for help on using the changeset viewer.