Author: eallen
Date: 2009-07-04 14:12:38 -0400 (Sat, 04 Jul 2009)
New Revision: 3474
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Ensure we get at least data 2 points for rate charts
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-07-02 15:40:22 UTC (rev 3473)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-07-04 18:12:38 UTC (rev 3474)
@@ -617,9 +617,16 @@
now = datetime.now()
col = self.cumin_class.mint_stats_class.q.qmfUpdateTime
- dt = now - timedelta(seconds=int(secs * 1.5))
- stats = stats.filter(col >= dt)
+ def ensure_at_least(min_count, more_time):
+ dt = now - timedelta(seconds=int(secs + more_time))
+ stats2 = stats.filter(col >= dt)
+ if stats2.count() < min_count:
+ more_time += 30
+ if more_time <= 24 * 60 * 60:
+ return ensure_at_least(min_count, more_time)
+ return stats2
+ stats = ensure_at_least(2, 0)
stats = stats.orderBy("-qmfUpdateTime")
samples = list()
Show replies by date