Author: eallen
Date: 2011-04-05 17:56:33 +0000 (Tue, 05 Apr 2011)
New Revision: 4685
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/stat.py
Log:
Fix problem with stats. The unit from the schema wasn't properly being used when
formatting the value.
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2011-04-05 17:36:52 UTC (rev 4684)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2011-04-05 17:56:33 UTC (rev 4685)
@@ -537,6 +537,9 @@
return super(DashboardCapacitySlotSummary, self).get_item_value(session, item)
+ def get_item_unit(self, session, item):
+ return item.unit
+
def render_formatted_value(self, session, item, value):
if item is self.PERCENT_COLUMN:
return "%0.02f%%" % value
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2011-04-05 17:36:52 UTC (rev 4684)
+++ trunk/cumin/python/cumin/stat.py 2011-04-05 17:56:33 UTC (rev 4685)
@@ -55,6 +55,10 @@
value = self.get_item_value(session, item)
return self.render_formatted_value(session, item, value)
+ def get_item_unit(self, session, item):
+ stat, _ = item
+ return stat.unit
+
def get_item_value(self, session, item):
_, value = item
return value
@@ -70,7 +74,7 @@
return value is not None and fmt_bytes(value * 1024 * 1024) or None
try:
- format = item.unit
+ format = self.get_item_unit(session, item)
if format:
if format == "MiB":
return fmt_mb(value)
Show replies by date