- Timestamp:
- Mar 5, 2013, 2:23:09 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130207/ippToPsps
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
jython/loader.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130207/ippToPsps
- Property svn:mergeinfo changed
/trunk/ippToPsps (added) merged: 35170-35171,35173-35175,35177-35179,35181-35188,35190-35191,35203-35204,35216-35218,35222-35226,35232-35233
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130207/ippToPsps/jython/loader.py
r35097 r35235 8 8 import sys 9 9 import os 10 import math 10 11 import traceback 11 12 import logging.config … … 43 44 44 45 # connect to scratch database 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) 50 self.scratchDb.disconnect() 51 continue 52 break 53 54 if not self.scratchDb.connected: 46 self.scratchDb = ScratchDb(self.logger, self.config) 47 if not self.config.test and self.scratchDb.anyOtherConnections(): 48 self.logger.errorPair("This scratch Db is already in use", self.scratchDb.dbName) 49 self.scratchDb.disconnect() 55 50 self.exitProgram("Cannot connect to a scratch database") 56 51 raise … … 97 92 except: return ret 98 93 99 self.dvoDetections = DvoDetections(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb .dbName)94 self.dvoDetections = DvoDetections(self.logger, self.config, self.skychunk, self.ippToPspsDb, self.scratchDb) 100 95 101 96 return ret … … 123 118 124 119 numAttempts = 0 120 abort = False 125 121 while True: 126 122 127 abort = False 128 for batchType in self.skychunk.batchTypes: 129 130 # get a stripe's worth of box IDs 131 boxIds = self.ippToPspsDb.getStripeBoxIds(self.HOST, self.PID, batchType) 132 133 numAttempts += 1 134 135 self.logger.infoPair("Boxes with unprocessed data", "%d" % len(boxIds)) 136 self.logger.infoPair("numAttempts", str(numAttempts)) 137 if len(boxIds) > 0: numAttempts = 0 138 139 for boxId in boxIds: 123 # get a stripe's worth of box IDs 124 boxIds = self.ippToPspsDb.getStripeBoxIdsAnyBatch(self.HOST, self.PID) 125 self.logger.infoPair("Boxes with unprocessed data", "%d" % len(boxIds)) 126 self.logger.infoPair("numAttempts", str(numAttempts)) 127 128 if len(boxIds) > 0: numAttempts = 0 129 numAttempts += 1 130 131 for boxId in boxIds: 132 133 # get box info. if boxes have changed, break and start again 134 try: 135 boxDim = self.ippToPspsDb.getBoxDimensions(boxId) 136 except: 137 self.logger.infoPair("Can't get details for this box", "%d" % boxId) 138 break 139 self.logger.infoPair("client status", "ok") 140 141 for batchType in self.skychunk.batchTypes: 142 140 143 self.logger.infoPair("Check","client status") 141 144 if not self.checkClientStatus(): … … 143 146 break 144 147 self.logger.infoPair("client status", "ok") 145 # get box info. if boxes have changed, break and start again 146 try: 147 boxDim = self.ippToPspsDb.getBoxDimensions(boxId) 148 except: 149 self.logger.infoPair("Can't get details for this box", "%d" % boxId) 150 break 151 self.logger.infoPair("client status", "ok") 148 152 149 ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType) 153 150 154 151 # ids are the stage_ids for items to be processed (eg, stack_id for a stack CMF, cam_id for P2 smf) 155 152 … … 160 157 self.logger.infoSeparator() 161 158 self.logger.infoTitle("New box") 162 self.logger.infoPair("Box dimensions ", "%.1f / %.1f / %.1f" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE']))159 self.logger.infoPair("Box dimensions: ", "ra / dec / size : %.1f / %.1f / %.1f -- sky bounds : (%.2f - %2.f, %2.f - %2.f)" % (boxDim['RA'], boxDim['DEC'], boxDim['SIDE'], boxDim['minRA'], boxDim['maxRA'], boxDim['minDEC'], boxDim['maxDEC'])) 163 160 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 164 boxSizeWithBorder = boxDim['SIDE'] + (self.skychunk.BORDER * 2) 165 boxSizeSansBorder = boxDim['SIDE'] 166 self.logger.infoPair("got here", "ok") 161 167 162 useFullTables = 0 168 163 if batchType != "OB": … … 171 166 # look in DVO for this box (with extra border) 172 167 self.logger.infoPair("Querying DVO for this sky area", "") 173 self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder) 168 169 # XXXX EAM : This code should not be used anymore 170 boxSize = 0.0 171 self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSize) 174 172 #self.dvoDetections.setSkyArea() 175 173 sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested() … … 191 189 useFullTables = 1 192 190 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) 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 self.dvoDetections.nativeIngestDetections(boxId, boxDim) 201 201 202 202 useFullTables = 1
Note:
See TracChangeset
for help on using the changeset viewer.
