Author: justi9
Date: 2007-11-27 10:59:34 -0500 (Tue, 27 Nov 2007)
New Revision: 1369
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Fixes the query behind the charts. Kind of a hack. Will need to introduce
another set of associations in the model to make this work better.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-11-27 03:37:34 UTC (rev 1368)
+++ mgmt/cumin/python/cumin/model.py 2007-11-27 15:59:34 UTC (rev 1369)
@@ -21,8 +21,9 @@
return self.classes[mint_object.__class__]
class CuminClass(object):
- def __init__(self, model, mint_class):
+ def __init__(self, model, name, mint_class):
self.model = model
+ self.name = name
self.mint_class = mint_class
self.mint_stats_class = None
@@ -65,8 +66,12 @@
return nvl(getattr(object.stats, self.name), -1)
def samples(self, object, limit=None):
+ name = self.cumin_class.name
cls = self.cumin_class.mint_stats_class
- stats = cls.select(orderBy="-id")[:limit]
+
+ stats = cls.select("%s_id = %i" % (name, object.id),
+ orderBy="-id")[:limit]
+
samples = list()
for stat in stats:
@@ -100,7 +105,7 @@
class CuminQueue(CuminClass):
def __init__(self, model):
- super(CuminQueue, self).__init__(model, mint.Queue)
+ super(CuminQueue, self).__init__(model, "queue", mint.Queue)
self.mint_stats_class = mint.QueueStats
@@ -265,7 +270,7 @@
class CuminExchange(CuminClass):
def __init__(self, model):
- super(CuminExchange, self).__init__(model, mint.Exchange)
+ super(CuminExchange, self).__init__(model, "exchange", mint.Exchange)
self.mint_stats_class = mint.ExchangeStats
Show replies by date