Changeset 33677 for trunk/ippToPsps
- Timestamp:
- Apr 3, 2012, 4:33:49 PM (14 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/loader.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/loader.py
r33562 r33677 16 16 from datastore import Datastore 17 17 from batch import Batch 18 from dvo import Dvo18 from dvodetections import DvoDetections 19 19 20 20 from initbatch import InitBatch 21 21 from stackbatch import StackBatch 22 22 from detectionbatch import DetectionBatch 23 from objectbatch import ObjectBatch 23 24 24 25 ''' … … 50 51 self.logger.errorPair("Cannot connect to a", "scratch database") 51 52 52 # create Dvo and Datastore objects 53 self.dvo = Dvo(self.logger, self.config, self.scratchDb.dbName) 53 # create Datastore objects 54 54 self.datastore = Datastore(self.logger, self.config, self.ippToPspsDb) 55 55 … … 72 72 73 73 74 # set a poll time of about 1 minute s74 # set a poll time of about 1 minute 75 75 self.parsePollTimeArg("0.0166") 76 76 … … 83 83 84 84 ret = super(Loader, self).refreshConfig() 85 try: self. dvo.checkDvoLocation()86 except: 87 self.logger.errorPair("can't check", "dvo.checkDvoLocation()")88 return ret85 try: self.scratchDb 86 except: return ret 87 88 self.dvoDetections = DvoDetections(self.logger, self.config, self.scratchDb.dbName) 89 89 90 90 return ret … … 134 134 boxDim = self.ippToPspsDb.getBoxDimensions(boxId) 135 135 except: 136 self.logger.infoPair("Can't get details for this box", "%d" % boxId)137 break136 self.logger.infoPair("Can't get details for this box", "%d" % boxId) 137 break 138 138 139 139 ids = self.ippToPspsDb.getPendingIdsForThisBox(boxId, batchType) … … 148 148 self.logger.infoPair(batchType + " items found in this box", "%d" % len(ids)) 149 149 boxSizeWithBorder = boxDim['SIDE'] + (self.config.BORDER * 2) 150 151 # look in DVO for this box (with extra border)152 #self.dvo.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder)153 #sizeToBeIngested = self.dvo.getDiskSizeOfRegionsToBeIngested()154 #if sizeToBeIngested == 0.0: smfsPerGB = 999999999155 #else: smfsPerGB = len(ids)/sizeToBeIngested156 #self.logger.infoPair("DVO to be ingested", "%.1f GB" % sizeToBeIngested)157 #self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB)158 smfsPerGB = 0159 # should do we pre-ingest stuff from DVO?160 if smfsPerGB > 40:161 if not self.dvo.sync():162 self.logger.errorPair("Could not sync DVO with MySQL", "skipping")163 continue164 150 165 useFullTables = 1 166 else: useFullTables = 0 151 useFullTables = 0 152 if batchType != "OB": 153 # look in DVO for this box (with extra border) 154 #self.dvoDetections.setSkyAreaAsBox(boxDim['RA'], boxDim['DEC'], boxSizeWithBorder) 155 self.dvoDetections.setSkyArea() 156 sizeToBeIngested = self.dvoDetections.getDiskSizeOfRegionsToBeIngested() 157 if sizeToBeIngested == 0.0: smfsPerGB = 999999999 158 else: smfsPerGB = len(ids)/sizeToBeIngested 159 self.logger.infoPair("DVO to be ingested", "%.1f GB" % sizeToBeIngested) 160 self.logger.infoPair("smfs-per-GB", "%.1f" % smfsPerGB) 161 # should do we pre-ingest stuff from DVO? 162 if smfsPerGB > 30: 163 if not self.dvoDetections.sync(): 164 self.logger.errorPair("Could not sync DVO with MySQL", "skipping") 165 continue 166 167 useFullTables = 1 167 168 168 169 self.logger.infoBool("Using pre-ingested DVO data?", useFullTables) … … 216 217 useFullTables) 217 218 219 elif batchType == "OB": 220 batch = ObjectBatch(self.logger, 221 self.config, 222 self.gpc1Db, 223 self.ippToPspsDb, 224 self.scratchDb, 225 id, 226 batchID, 227 useFullTables) 228 218 229 batch.run() 219 230 … … 223 234 224 235 self.logger.infoSeparator() 225 226 # if in test mode, then quit after one batch # TODO remove227 if self.config.test: break228 236 229 237 self.ippToPspsDb.unlockTables()
Note:
See TracChangeset
for help on using the changeset viewer.
