Author: tmckay
Date: 2010-12-22 13:32:50 +0000 (Wed, 22 Dec 2010)
New Revision: 4444
Modified:
branches/scale_testing/mint/python/mint/update.py
Log:
Tweak stats collecting, get rid of exceptions and bad values
on zero message intervals or dropped updates
Modified: branches/scale_testing/mint/python/mint/update.py
===================================================================
--- branches/scale_testing/mint/python/mint/update.py 2010-12-21 20:15:51 UTC (rev 4443)
+++ branches/scale_testing/mint/python/mint/update.py 2010-12-22 13:32:50 UTC (rev 4444)
@@ -36,6 +36,10 @@
def enqueue(self, update):
update.enqueue_time = time.time()
+ # make sure these exist to avoid exceptions if processing
+ # is truncated for some reason
+ update.start_process = update.finish_process = \
+ update.after_process = update.after_commit = update.enqueue_time
self.updates.put(update)
@@ -149,6 +153,7 @@
update.after_commit - update.after_process
except:
print "record update exception"
+ print_exc()
def capture(self):
now = copy.copy(self)
@@ -261,7 +266,7 @@
def get_update_durations(self):
total = self.now.record_samples
- if total == 0:
+ if total == 0 or self.now.dequeued == self.then.dequeued:
create_dur = proc_dur = que_dur = init_proc_time = commit_time = 0
else:
create_dur = self.now.update_queue_duration / total
@@ -322,6 +327,7 @@
def process(self, thread):
self.start_process = time.time()
+
log.debug("Processing %s", self)
try:
@@ -330,10 +336,15 @@
thread.conn.commit()
self.after_commit = time.time()
except UpdateDropped:
+ # Don't want to throw off stats with negatives if
+ # these are never set. Assume the time to reach
+ # this point.
+ self.after_process = time.time()
+ self.after_commit = self.after_process
+
log.debug("Update dropped")
thread.conn.rollback()
-
thread.stats.dropped += 1
try:
cls = self.get_class()
@@ -341,7 +352,6 @@
cls = None
if cls != None:
thread.stats.objects_dropped_by_class[cls] += 1
- self.after_commit = time.time()
except:
log.exception("Update failed")
Show replies by date