Changeset 32443
- Timestamp:
- Sep 23, 2011, 3:42:18 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippToPsps/jython/ipptopspsdb.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippToPsps/jython/ipptopspsdb.py
r32436 r32443 218 218 WHERE batch_type = '" + batchType + "' \ 219 219 AND timestamp > '" + epoch + "' \ 220 AND dvo_db = '" + dvoGpc1Label + "'" 220 AND dvo_db = '" + dvoGpc1Label + "' \ 221 AND processed = 1 \ 222 AND loaded_to_datastore = 1" 221 223 222 224 total = -1 … … 301 303 302 304 ''' 303 Returns batches per hour. Simply goes back in time for the specified number of hours, so will return 0.0 if not loading304 ''' 305 def getBatchesPerHour(self, batchType, epoch, dvoGpc1Label, hours):306 307 sql = "SELECT COUNT(batch_id) / " + str(hours) + "\305 Returns a count of batches processed in the specified time period. 306 ''' 307 def countBatchesInLastPeriod(self, batchType, epoch, dvoGpc1Label, interval): 308 309 sql = "SELECT COUNT(batch_id) \ 308 310 FROM batch \ 309 311 WHERE batch_type = '" + batchType + "' \ … … 311 313 AND timestamp > '" + epoch + "' \ 312 314 AND dvo_db = '" + dvoGpc1Label + "' \ 313 AND timestamp > (now() - INTERVAL " + str(hours) + " HOUR)"314 315 try: 316 rs = self.executeQuery(sql) 317 if rs.first(): return rs.get Float(1)318 except: 319 self.logger.exception("Unable to get batches per hour")320 return 0 .0315 AND timestamp BETWEEN now() - INTERVAL " + interval + " AND now()" 316 317 try: 318 rs = self.executeQuery(sql) 319 if rs.first(): return rs.getInt(1) 320 except: 321 self.logger.exception("Unable to count batches in interval") 322 return 0 321 323 322 324 '''
Note:
See TracChangeset
for help on using the changeset viewer.
