[rhmessaging-commits] rhmessaging commits: r1345 - mgmt/cumin/python/cumin.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Tue Nov 20 16:21:41 EST 2007


Author: justi9
Date: 2007-11-20 16:21:40 -0500 (Tue, 20 Nov 2007)
New Revision: 1345

Modified:
   mgmt/cumin/python/cumin/model.py
Log:
For now use -1 to indicate no data in stats.



Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py	2007-11-20 21:01:25 UTC (rev 1344)
+++ mgmt/cumin/python/cumin/model.py	2007-11-20 21:21:40 UTC (rev 1345)
@@ -2,6 +2,8 @@
 from wooly import *
 from wooly.model import *
 
+from util import *
+
 class CuminModel(object):
     def __init__(self):
         self.classes = dict()
@@ -48,7 +50,7 @@
         self.highlow = False
 
     def value(self, object):
-        return getattr(object.stats, self.name)
+        return nvl(getattr(object.stats, self.name), -1)
 
     def rate(self, object):
         if object.stats:
@@ -59,6 +61,12 @@
 
                 if curr is not None and prev is not None:
                     return (curr - prev) / float(1)
+                else:
+                    return -1
+            else:
+                return -1
+        else:
+            return -1
 
     def write_xml(self, object, writer):
         writer.write("<stat name=\"%s\" value=\"%i\" rate=\"%i\"/>" \




More information about the rhmessaging-commits mailing list