- Timestamp:
- Jan 12, 2015, 12:24:24 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-pv3-20140717-merge/ippToPsps/jython/loader.py
r36709 r37820 24 24 from objectbatch import ObjectBatch 25 25 26 from diffbatch import DiffBatch 27 from diffobjectbatch import DiffObjectBatch 28 29 #from forcedwarpbatch import ForcedWarpBatch 30 #from forcedobjectbatch import ForcedObjectBatch 31 # 32 # 26 33 ''' 27 34 Loader class … … 78 85 self.onePassOnly = 1 79 86 80 # set a poll time of about 1 minute 81 self.parsePollTimeArg("0.0166") 87 if self.config.loopBatch: 88 self.parsePollTimeArg("0.0166") 89 else: 90 self.parsePollTimeArg("0.0") 82 91 83 92 self.skychunk.printAll() … … 160 169 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 161 170 162 useFullTables = 0163 171 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 172 if self.config.resetDvo or not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost): 173 if not self.dvoDetections.nativeIngestDetections(boxId, boxDim): 174 self.logger.error("Unable to ingest detections with nativeIngest") 175 return False 212 176 213 177 ''' 214 178 NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches 215 179 ''' 216 self.logger.infoBool("Using pre-ingested DVO data?", useFullTables) 217 if not self.processTheseItems(batchType, ids, useFullTables): 180 if not self.processTheseItems(batchType, ids): 218 181 abort = True 219 182 break 220 183 self.logger.infoPair("processed","ok") 221 184 185 self.logger.infoPair("done with processing boxes, numAttempts: ", str(numAttempts)) 222 186 if abort or not self.checkClientStatus(): abort = True 223 187 elif numAttempts > 1 and not self.waitForPollTime(): break … … 228 192 Actually loops through items and processes them 229 193 ''' 230 def processTheseItems(self, batchType, ids , useFullTables):194 def processTheseItems(self, batchType, ids): 231 195 232 196 self.logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) … … 234 198 # loop round IDs of all items to be processed 235 199 self.ippToPspsDb.lockBatchTable() 236 #self.logger.infoPair("heather:","lockbatchtable")200 self.logger.infoPair("heather:","lockbatchtable") 237 201 unattemptedCount = 0 238 202 for id in ids: 239 #self.logger.infoPair("heather:","in ids")203 self.logger.infoPair("heather:","in ids") 240 204 #self.logger.infoPair("heather:id",str(id)) 241 205 batchID = self.ippToPspsDb.createNewBatch(batchType, id) … … 245 209 unattemptedCount += 1 246 210 continue 247 #self.logger.infoPair("heather:","passed logic") 211 self.logger.infoPair("heather:","passed logic") 212 248 213 self.ippToPspsDb.unlockTables() 249 214 #self.logger.infoPair("heather:","unlock table") 215 250 216 self.ippToPspsDb.deletePendingItem(batchType, id) 251 217 #self.logger.infoPair("heather:","deleted pending item") … … 262 228 self.scratchDb, 263 229 id, 264 batchID, 265 useFullTables) 230 batchID) 266 231 elif batchType == "ST": 267 232 self.logger.infoPair("defining ST batch for sky_id:",id) … … 273 238 self.scratchDb, 274 239 id, 275 batchID, 276 useFullTables) 240 batchID) 277 241 278 242 elif batchType == "OB": … … 284 248 self.scratchDb, 285 249 id, 286 batchID, 287 useFullTables) 250 batchID) 288 251 289 252 elif batchType == "DF": 253 self.logger.infoPair("wegothere!","we are awesome") 290 254 batch = DiffBatch(self.logger, 291 255 self.config, … … 295 259 self.scratchDb, 296 260 id, 297 batchID, 298 useFullTables) 261 batchID) 299 262 300 263 elif batchType == "DO": … … 306 269 self.scratchDb, 307 270 id, 308 batchID, 309 useFullTables) 271 batchID) 310 272 311 273 elif batchType == "FW": … … 317 279 self.scratchDb, 318 280 id, 319 batchID, 320 useFullTables) 281 batchID) 321 282 322 283 elif batchType == "FO": … … 328 289 self.scratchDb, 329 290 id, 330 batchID, 331 useFullTables) 291 batchID) 332 292 333 293 batch.run() … … 337 297 self.logger.error("EXCEPTION: " + str(e)) 338 298 self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping") 299 sys.exit(1) 339 300 pass 340 301
Note:
See TracChangeset
for help on using the changeset viewer.
