Changeset 37246 for trunk/ippToPsps/jython/loader.py
- Timestamp:
- Aug 12, 2014, 4:10:18 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/loader.py (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/loader.py
r36709 r37246 160 160 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 161 161 162 useFullTables = 0163 162 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 212 167 213 168 ''' 214 169 NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches 215 170 ''' 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): 218 172 abort = True 219 173 break 220 174 self.logger.infoPair("processed","ok") 221 175 176 self.logger.infoPair("done with processing boxes, numAttempts: ", str(numAttempts)) 222 177 if abort or not self.checkClientStatus(): abort = True 223 178 elif numAttempts > 1 and not self.waitForPollTime(): break … … 228 183 Actually loops through items and processes them 229 184 ''' 230 def processTheseItems(self, batchType, ids , useFullTables):185 def processTheseItems(self, batchType, ids): 231 186 232 187 self.logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) … … 246 201 continue 247 202 #self.logger.infoPair("heather:","passed logic") 203 248 204 self.ippToPspsDb.unlockTables() 249 205 #self.logger.infoPair("heather:","unlock table") 206 250 207 self.ippToPspsDb.deletePendingItem(batchType, id) 251 208 #self.logger.infoPair("heather:","deleted pending item") … … 262 219 self.scratchDb, 263 220 id, 264 batchID, 265 useFullTables) 221 batchID) 266 222 elif batchType == "ST": 267 223 self.logger.infoPair("defining ST batch for sky_id:",id) … … 273 229 self.scratchDb, 274 230 id, 275 batchID, 276 useFullTables) 231 batchID) 277 232 278 233 elif batchType == "OB": … … 284 239 self.scratchDb, 285 240 id, 286 batchID, 287 useFullTables) 241 batchID) 288 242 289 243 elif batchType == "DF": … … 295 249 self.scratchDb, 296 250 id, 297 batchID, 298 useFullTables) 251 batchID) 299 252 300 253 elif batchType == "DO": … … 306 259 self.scratchDb, 307 260 id, 308 batchID, 309 useFullTables) 261 batchID) 310 262 311 263 elif batchType == "FW": … … 317 269 self.scratchDb, 318 270 id, 319 batchID, 320 useFullTables) 271 batchID) 321 272 322 273 elif batchType == "FO": … … 328 279 self.scratchDb, 329 280 id, 330 batchID, 331 useFullTables) 281 batchID) 332 282 333 283 batch.run() … … 337 287 self.logger.error("EXCEPTION: " + str(e)) 338 288 self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping") 289 sys.exit(1) 339 290 pass 340 291
Note:
See TracChangeset
for help on using the changeset viewer.
