- Timestamp:
- Aug 1, 2014, 5:27:11 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20140717/ippToPsps/jython/ipptopspsdb.py
r37133 r37171 166 166 167 167 return ids 168 169 ## '''170 ## XXX EAM : removed this function and made it more explicit (with an additional block)171 ## Returns a list of merged batch IDs that are merged but not yet deleted172 ## '''173 ## def getMergedButNotDeletedBatchIDs(self, batchType, column):174 ##175 ## sql = "SELECT DISTINCT batch_id \176 ## FROM batch \177 ## WHERE timestamp > '" + self.skychunk.epoch + "' \178 ## AND batch_type = '" + batchType + "' \179 ## AND dvo_db = '" + self.skychunk.dvoLabel + "' \180 ## AND merged = 1 \181 ## AND " + column + " = 0"182 ##183 ## ids = []184 ## try:185 ## rs = self.executeQuery(sql)186 ## while (rs.next()): ids.append(rs.getInt(1))187 ## rs.close()188 ## except:189 ## self.logger.exception("Can't query for merged batch ids in ipptopsps Db")190 ##191 ## self.logger.debug("Found %d merged but un-deleted items" % len(ids))192 ##193 ## return ids194 195 ## '''196 ## Returns a list of batch IDs marked as 'purged' but not yet deleted197 ## XXX EAM : removed this function and made it more explicit (with an additional block)198 ## '''199 ## def getPurgedButNotDeletedBatchIDs(self, batchType, column):200 ##201 ## sql = "SELECT DISTINCT batch_id \202 ## FROM batch \203 ## WHERE timestamp > '" + self.skychunk.epoch + "' \204 ## AND batch_type = '" + batchType + "' \205 ## AND dvo_db = '" + self.skychunk.dvoLabel + "' \206 ## AND purged = 1 \207 ## AND " + column + " = 0"208 ##209 ## ids = []210 ## try:211 ## rs = self.executeQuery(sql)212 ## while (rs.next()): ids.append(rs.getInt(1))213 ## rs.close()214 ## except:215 ## self.logger.exception("Can't query for merged batch ids in ipptopsps Db")216 ##217 ##218 ## self.logger.debug("Found %d merged but un-deleted items" % len(ids))219 ##220 ## return ids221 222 ## '''223 ## Returns a list of processed batch IDs that have been loaded to the ODM but not yet deleted224 ## '''225 ## def getLoadedToODMButNotDeletedBatchIDs(self, batchType, column):226 ##227 ## sql = "SELECT DISTINCT batch_id \228 ## FROM batch \229 ## WHERE timestamp > '" + self.skychunk.epoch + "' \230 ## AND batch_type = '" + batchType + "' \231 ## AND dvo_db = '" + self.skychunk.dvoLabel + "' \232 ## AND (loaded_to_ODM = -1 OR merge_worthy = 1) \233 ## AND " + column + " = 0"234 ##235 ## ids = []236 ## try:237 ## rs = self.executeQuery(sql)238 ## while (rs.next()): ids.append(rs.getInt(1))239 ## rs.close()240 ## except:241 ## self.logger.exception("Can't query for merged batch ids in ipptopsps Db")242 ##243 ## self.logger.debug("Found %d merged but un-deleted items" % len(ids))244 ##245 ## return ids246 247 # '''248 # Returns a list of merged batch IDs that are not deleted from local disk249 # '''250 # def getMergedButNotDeletedFromLocalDisk(self, batchType):251 # return self.getMergedButNotDeletedBatchIDs(batchType, "deleted_local")252 253 ## '''254 ## Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from local disk255 ## '''256 ## def getLoadedToODMButNotDeletedFromLocalDisk(self, batchType):257 ## return self.getLoadedToODMButNotDeletedBatchIDs(batchType, "deleted_local")258 ##259 ## '''260 ## Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from datastore261 ## '''262 ## def getLoadedToODMButNotDeletedFromDatastore(self, batchType):263 ## return self.getLoadedToODMButNotDeletedBatchIDs(batchType, "deleted_datastore")264 ##265 ## '''266 ## Returns a list of processed batch IDs that are loaded to the ODM, but not deleted from DXLayer267 ## '''268 ## def getLoadedToODMButNotDeletedFromDXLayer(self, batchType):269 ## return self.getLoadedToODMButNotDeletedBatchIDs(batchType, "deleted_dxlayer")270 271 ## '''272 ## Returns a list of purged batch IDs that not deleted from local disk273 ## '''274 ## def getPurgedButNotDeletedFromLocalDisk(self, batchType):275 ## return self.getPurgedButNotDeletedBatchIDs(batchType, "deleted_local")276 ##277 ## '''278 ## Returns a list of purged batch IDs that are not deleted from datastore279 ## '''280 ## def getPurgedButNotDeletedFromDatastore(self, batchType):281 ## return self.getPurgedButNotDeletedBatchIDs(batchType, "deleted_datastore")282 283 168 284 169 ''' … … 1700 1585 pass 1701 1586 1702 # XXX EAM : 20140727: for now this is not temporary (for debugging) 1703 # self.execute("CREATE TEMPORARY TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1704 self.execute("CREATE TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1587 self.execute("CREATE TEMPORARY TABLE all_pending (stage_id bigint(20), ra_bore float, dec_bore float)") 1705 1588 for row in rows: 1706 1589 … … 1714 1597 count = self.getRowCount("all_pending") 1715 1598 self.logger.infoPair("Items written to Db", "%d" % count) 1716 1717 # try:1718 # self.execute("DROP TABLE all_pending_alt")1719 # except:1720 # pass1721 #1722 # self.execute("CREATE TABLE all_pending_alt (stage_id bigint(20), ra_bore float, dec_bore float)")1723 # for row in rows:1724 # try:1725 # sql = "INSERT INTO all_pending_alt (stage_id, ra_bore, dec_bore) \1726 # VALUES (%d, %f, %f)" % (row[0], row[1], row[2])1727 # print "sql 2: ", sql1728 # self.execute(sql)1729 # except: continue1730 #1731 # count = self.getRowCount("all_pending_alt")1732 # self.logger.infoPair("Items written to alt Db", "%d" % count)1733 1734 1599 1735 1600 ''' … … 1765 1630 def getItemsInThisBox(self, minRA, maxRA, minDEC, maxDEC): 1766 1631 1767 # the old linear size is ill-conceived1768 ## XX halfSide = self.skychunk.boxSize/2.01769 ## XX minRa = ra-halfSide1770 ## XX maxRa = ra+halfSide1771 ## XX minDec = dec-halfSide1772 ## XX maxDec = dec+halfSide1773 1774 1632 ids = [] 1775 1633
Note:
See TracChangeset
for help on using the changeset viewer.
