Changeset 34661
- Timestamp:
- Nov 6, 2012, 3:19:54 PM (14 years ago)
- Location:
- trunk/ippToPsps/jython
- Files:
-
- 4 edited
-
ipptopspsdb.py (modified) (2 diffs)
-
loader.py (modified) (6 diffs)
-
objectbatch.py (modified) (1 diff)
-
stackbatch.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r33858 r34661 638 638 and not self.processingNow(batchType, stageID) \ 639 639 and not self.consistentlyFailed(batchType, stageID)): 640 641 self.logger.infoPair("heather:","passed logic") 640 642 641 643 sql = "INSERT INTO batch ( \ … … 652 654 '" + self.config.datastoreProduct + "' \ 653 655 )" 656 self.logger.infoPair("heather:","sql") 654 657 655 658 self.execute(sql) -
trunk/ippToPsps/jython/loader.py
r33832 r34661 123 123 124 124 self.logger.infoPair("Boxes with unprocessed data", "%d" % len(boxIds)) 125 125 self.logger.infoPair("numAttempts", str(numAttempts)) 126 126 if len(boxIds) > 0: numAttempts = 0 127 127 128 128 for boxId in boxIds: 129 129 self.logger.infoPair("Check","client status") 130 130 if not self.checkClientStatus(): 131 131 abort = True 132 132 break 133 133 self.logger.infoPair("client status", "ok") 134 134 # get box info. if boxes have changed, break and start again 135 135 try: … … 138 138 self.logger.infoPair("Can't get details for this box", "%d" % boxId) 139 139 break 140 140 self.logger.infoPair("client status", "ok") 141 141 ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType) 142 142 … … 150 150 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 151 151 boxSizeWithBorder = boxDim['SIDE'] + (self.config.BORDER * 2) 152 152 self.logger.infoPair("got here", "ok") 153 153 useFullTables = 0 154 154 if batchType != "OB": … … 174 174 abort = True 175 175 break 176 176 self.logger.infoPair("processed","ok") 177 177 if abort or not self.checkClientStatus(): abort = True 178 178 elif numAttempts > 1 and not self.waitForPollTime(): break … … 188 188 # loop round IDs of all items to be processed 189 189 self.ippToPspsDb.lockBatchTable() 190 self.logger.infoPair("heather:","lockbatchtable") 190 191 unattemptedCount = 0 191 192 for id in ids: 192 193 self.logger.infoPair("heather:","in ids") 194 self.logger.infoPair("heather:id",str(id)) 193 195 batchID = self.ippToPspsDb.createNewBatch(batchType, id) 194 196 self.logger.infoPair("heather:","creatednewbatch") 197 self.logger.infoPair("heather:batchId", str(batchID)) 195 198 if batchID < 0: 196 199 unattemptedCount += 1 197 200 continue 198 201 self.logger.infoPair("heather:","passed logic") 199 202 self.ippToPspsDb.unlockTables() 203 self.logger.infoPair("heather:","unlock table") 200 204 self.ippToPspsDb.deletePendingItem(batchType, id) 205 self.logger.infoPair("heather:","deleted pending item") 201 206 202 207 # catch any raised exceptions in batch constructors … … 234 239 235 240 # if batch fails, ignore and move on to the next one 236 except: 241 except Exception, e: 242 self.logger.error("EXCEPTION: " + str(e)) 237 243 self.logger.errorPair("Problem with this %s batch (%d)" % (batchType, id), "skipping") 238 244 pass 239 245 240 246 if not self.checkClientStatus(): return False 241 247 self.logger.infoPair("checkclient status", "ok") 248 242 249 self.ippToPspsDb.lockBatchTable() 243 250 self.logger.infoPair("lockbatchtable", "ok") 244 251 self.logger.infoSeparator() 245 252 -
trunk/ippToPsps/jython/objectbatch.py
r34649 r34661 206 206 cpsTableName = self.scratchDb.getDbFriendlyTableName(self.region + ".cps") 207 207 208 self.logger.infoPair("Populating", "Object") 208 self.logger.infoPair("setting to null > 1e-38 and < 1e-38 in", "cps FLUX_KRON_ERR") 209 sql = "UPDATE " + cpsTableName + " set FLUX_KRON_ERR = NULL where FLUX_KRON_ERR < 1e-37 AND FLUX_KRON_ERR > -1e-37 " 210 211 try: 212 self.scratchDb.execute(sql) 213 except: 214 self.logger.errorPair("Couldn't squash out of range stuff", sql) 215 return False 216 217 self.logger.infoPair("setting to null > 1e-38 and < 1e-38 in", "cps FLUX_KRON") 218 sql = "UPDATE " + cpsTableName + " set FLUX_KRON = NULL where FLUX_KRON < 1e-37 AND FLUX_KRON > -1e-37 " 219 220 try: 221 self.scratchDb.execute(sql) 222 except: 223 self.logger.errorPair("Couldn't squash out of range stuff", sql) 224 return False 225 226 227 228 229 230 self.logger.infoPair("Populating", "Object s") 209 231 self.logger.infoPair("Inserting objects from", "cpt file") 210 232 -
trunk/ippToPsps/jython/stackbatch.py
r34640 r34661 75 75 self.skycell = self.skycell[8:12] 76 76 self.projectioncell = self.skycell 77 78 # proposed new values. Need to coordinate with the SkyCell table 79 # this fits in 32 bits for 0 < tessID < 214 80 # self.skycell = str( (tessID * (10000 * 1000)) + (int(self.projectioncell) * 1000) + cellID ) 77 81 78 82 self.analysisVer = meta[2]; … … 611 615 ,surveyID \ 612 616 FROM StackDetection" 613 self.logger.info(sql)614 617 self.scratchDb.execute(sql) 615 618 # insert calibration information from dvoDetections into the Table … … 623 626 a.expTime = b.expTime, \ 624 627 a.airMass = b.airMass \ 625 WHERE a.objID = b.objID AND a.ippDetectID = b.ippDetectID" 626 # XXXX: this qualifier assumes that there is only one stack being processed at a time 627 self.logger.info(sql) 628 WHERE a.stackDetectID = b.detectID" 628 629 self.scratchDb.execute(sql) 629 630 self.scratchDb.updateAllRows(tableName, "dataRelease", str(self.config.dataRelease)) … … 669 670 self.scratchDb.execute("ALTER TABLE StackDetectionCalib CHANGE dec_ `dec` double") 670 671 671 672 673 672 return True 674 673 … … 696 695 sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \ 697 696 a.ippObjID = b.ippObjID, \ 698 a.stackDetectID = 10 * b.detectID + " + str(self.filterID) + ", \697 a.stackDetectID = b.detectID, \ 699 698 a.objID = b.objID \ 700 699 WHERE a.ippDetectID = b.ippDetectID \ … … 712 711 sql = "UPDATE " + table + " AS a, " + self.scratchDb.dvoDetectionTable + " AS b SET \ 713 712 a.ippObjID = b.ippObjID, \ 714 a.stackDetectID = 10 * b.detectID + " + str(self.filterID) + ", \713 a.stackDetectID = b.detectID, \ 715 714 a.objID = b.objID, \ 716 715 a.infoFlag = b.flags << 45 | a.infoFlag \
Note:
See TracChangeset
for help on using the changeset viewer.
