Changeset 35175 for trunk/ippToPsps/jython/ipptopspsdb.py
- Timestamp:
- Feb 16, 2013, 3:36:57 PM (13 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/ipptopspsdb.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r35097 r35175 1168 1168 rs.close() 1169 1169 except: 1170 self.logger.errorPair("No free stripes", "trying to s hare withother client...")1170 self.logger.errorPair("No free stripes", "trying to steal boxes from other client...") 1171 1171 sql = "SELECT ra_center, COUNT(*) AS numPending\ 1172 1172 FROM box \ … … 1184 1184 rs.close() 1185 1185 except: 1186 self.logger.errorPair("No available stripes to share", "no stripe obtained")1186 self.logger.errorPair("No outstanding boxes to steal", "no stripe obtained") 1187 1187 1188 1188 self.logger.infoPair("Using RA stripe", "%f" % raCenter) … … 1203 1203 1204 1204 self.registerStripe(host, pid, raCenter) 1205 1206 self.unlockTables() 1207 1208 return ids 1209 1210 ''' 1211 Returns ids for all boxes with pending items in a stripe of RA not already being processed 1212 by another client. If none are available, then it uses the stripe already used by another 1213 client that has the most pending items 1214 ''' 1215 def getStripeBoxIdsAnyBatch(self, host, pid): 1216 1217 self.execute("LOCK TABLES box READ, pending READ, stripe WRITE, clients WRITE") 1218 1219 ids = [] 1220 raCenter = -1.0 1221 sql = "SELECT ra_center \ 1222 FROM box \ 1223 JOIN pending ON (id = box_id) \ 1224 WHERE skychunk = '" + self.skychunk.name + "' \ 1225 AND ra_center NOT IN \ 1226 (SELECT ra_center \ 1227 FROM stripe \ 1228 WHERE skychunk = '" + self.skychunk.name + "') \ 1229 GROUP BY ra_center LIMIT 1" 1230 1231 try: 1232 rs = self.executeQuery(sql) 1233 rs.first() 1234 raCenter = rs.getFloat(1) 1235 rs.close() 1236 except: 1237 self.logger.errorPair("No free stripes", "trying to steal boxes from other client...") 1238 sql = "SELECT ra_center, COUNT(*) AS numPending\ 1239 FROM box \ 1240 JOIN pending ON (id = box_id) \ 1241 WHERE skychunk = '" + self.skychunk.name + "' \ 1242 GROUP BY ra_center \ 1243 ORDER BY numPending \ 1244 DESC LIMIT 1" 1245 1246 try: 1247 rs = self.executeQuery(sql) 1248 rs.first() 1249 raCenter = rs.getFloat(1) 1250 rs.close() 1251 except: 1252 self.logger.errorPair("No outstanding boxes to steal", "no stripe obtained") 1253 1254 self.logger.infoPair("Using RA stripe", "%f" % raCenter) 1255 sql = "SELECT DISTINCT id \ 1256 FROM box \ 1257 JOIN pending ON (id = box_id) \ 1258 WHERE ra_center = " + str(raCenter) + " \ 1259 AND skychunk = '" + self.skychunk.name + "' \ 1260 ORDER BY dec_center DESC" 1261 1262 try: 1263 rs = self.executeQuery(sql) 1264 while (rs.next()): ids.append(rs.getInt(1)) 1265 rs.close() 1266 except: 1267 self.logger.errorPair("Can't get stripe boxes", sql) 1205 1268 1206 1269 self.unlockTables()
Note:
See TracChangeset
for help on using the changeset viewer.
