- Timestamp:
- Sep 19, 2014, 4:05:27 PM (12 years ago)
- Location:
- branches/eam_branches/ps2-tc3-20130727
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
ippToPsps/jython/loader.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ps2-tc3-20130727
- Property svn:mergeinfo changed
-
branches/eam_branches/ps2-tc3-20130727/ippToPsps/jython/loader.py
r35417 r37403 78 78 self.onePassOnly = 1 79 79 80 # set a poll time of about 1 minute 81 self.parsePollTimeArg("0.0166") 80 if self.config.loopBatch: 81 self.parsePollTimeArg("0.0166") 82 else: 83 self.parsePollTimeArg("0.0") 82 84 83 85 self.skychunk.printAll() … … 160 162 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 161 163 162 useFullTables = 0163 164 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') 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 165 if self.config.resetDvo or not self.ippToPspsDb.isBoxIngested(boxId, self.scratchDb.dbHost): 166 if not self.dvoDetections.nativeIngestDetections(boxId, boxDim): 167 self.logger.error("Unable to ingest detections with nativeIngest") 168 return False 212 169 213 170 ''' 214 171 NOTE EAM : "TheseItems" refers to each of the stack CMFs, camera SMFs, or object batches 215 172 ''' 216 self.logger.infoBool("Using pre-ingested DVO data?", useFullTables) 217 if not self.processTheseItems(batchType, ids, useFullTables): 173 if not self.processTheseItems(batchType, ids): 218 174 abort = True 219 175 break 220 176 self.logger.infoPair("processed","ok") 221 177 178 self.logger.infoPair("done with processing boxes, numAttempts: ", str(numAttempts)) 222 179 if abort or not self.checkClientStatus(): abort = True 223 180 elif numAttempts > 1 and not self.waitForPollTime(): break … … 228 185 Actually loops through items and processes them 229 186 ''' 230 def processTheseItems(self, batchType, ids , useFullTables):187 def processTheseItems(self, batchType, ids): 231 188 232 189 self.logger.infoPair("%s items queued" % batchType, "%d" % len(ids)) … … 234 191 # loop round IDs of all items to be processed 235 192 self.ippToPspsDb.lockBatchTable() 236 self.logger.infoPair("heather:","lockbatchtable")193 #self.logger.infoPair("heather:","lockbatchtable") 237 194 unattemptedCount = 0 238 195 for id in ids: 239 self.logger.infoPair("heather:","in ids")240 self.logger.infoPair("heather:id",str(id))196 #self.logger.infoPair("heather:","in ids") 197 #self.logger.infoPair("heather:id",str(id)) 241 198 batchID = self.ippToPspsDb.createNewBatch(batchType, id) 242 self.logger.infoPair("heather:","creatednewbatch")243 self.logger.infoPair("heather:batchId", str(batchID))199 #self.logger.infoPair("heather:","creatednewbatch") 200 #self.logger.infoPair("heather:batchId", str(batchID)) 244 201 if batchID < 0: 245 202 unattemptedCount += 1 246 203 continue 247 self.logger.infoPair("heather:","passed logic") 204 #self.logger.infoPair("heather:","passed logic") 205 248 206 self.ippToPspsDb.unlockTables() 249 self.logger.infoPair("heather:","unlock table") 207 #self.logger.infoPair("heather:","unlock table") 208 250 209 self.ippToPspsDb.deletePendingItem(batchType, id) 251 self.logger.infoPair("heather:","deleted pending item")210 #self.logger.infoPair("heather:","deleted pending item") 252 211 253 212 # catch any raised exceptions in batch constructors 254 213 try: 255 214 if batchType == "P2": 215 self.logger.infoPair("defining P2 batch for cam_id:",id) 256 216 batch = DetectionBatch(self.logger, 257 217 self.config, … … 261 221 self.scratchDb, 262 222 id, 263 batchID, 264 useFullTables) 223 batchID) 265 224 elif batchType == "ST": 225 self.logger.infoPair("defining ST batch for sky_id:",id) 266 226 batch = StackBatch(self.logger, 267 227 self.config, … … 271 231 self.scratchDb, 272 232 id, 273 batchID, 274 useFullTables) 233 batchID) 275 234 276 235 elif batchType == "OB": … … 282 241 self.scratchDb, 283 242 id, 284 batchID, 285 useFullTables) 286 243 batchID) 244 245 elif batchType == "DF": 246 batch = DiffBatch(self.logger, 247 self.config, 248 self.skychunk, 249 self.gpc1Db, 250 self.ippToPspsDb, 251 self.scratchDb, 252 id, 253 batchID) 254 255 elif batchType == "DO": 256 batch = DiffObjectBatch(self.logger, 257 self.config, 258 self.skychunk, 259 self.gpc1Db, 260 self.ippToPspsDb, 261 self.scratchDb, 262 id, 263 batchID) 264 265 elif batchType == "FW": 266 batch = ForcedWarpBatch(self.logger, 267 self.config, 268 self.skychunk, 269 self.gpc1Db, 270 self.ippToPspsDb, 271 self.scratchDb, 272 id, 273 batchID) 274 275 elif batchType == "FO": 276 batch = ForcedObjectBatch(self.logger, 277 self.config, 278 self.skychunk, 279 self.gpc1Db, 280 self.ippToPspsDb, 281 self.scratchDb, 282 id, 283 batchID) 284 287 285 batch.run() 288 286 … … 291 289 self.logger.error("EXCEPTION: " + str(e)) 292 290 self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping") 291 sys.exit(1) 293 292 pass 294 293
Note:
See TracChangeset
for help on using the changeset viewer.
