Author: croberts
Date: 2011-11-07 18:47:07 +0000 (Mon, 07 Nov 2011)
New Revision: 5118
Modified:
trunk/cumin/python/cumin/grid/scheduler.py
Log:
Addressing BZ:751775 by making a customization to the SchedulerGeneralStatSet to render
MonitorSelfAge in the dd:hh:mm format.
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2011-11-04 20:00:58 UTC (rev 5117)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2011-11-07 18:47:07 UTC (rev 5118)
@@ -122,7 +122,44 @@
"MonitorSelfAge", "MonitorSelfCPUUsage",
"MonitorSelfImageSize","MonitorSelfRegisteredSocketCount",
"MonitorSelfResidentSetSize","MonitorSelfTime")
+
+ def render_formatted_value(self, session, item, value):
+ def fmt_b(value):
+ return value is not None and fmt_bytes(value) or None
+ def fmt_kb(value):
+ return value is not None and fmt_bytes(value * 1024) or None
+
+ def fmt_mb(value):
+ return value is not None and fmt_bytes(value * 1024 * 1024) or None
+
+ def fmt_timestamp_ddhhmmss(value):
+ days = value / 86400
+ hours = (value / 3600) - (days * 24)
+ minutes = (value / 60) - (days * 1440) - (hours * 60)
+ return '%02d:%02d:%02d' % (days, hours, minutes)
+
+ try:
+ format = self.get_item_unit(session, item)
+ if format:
+ if format == "MiB":
+ return fmt_mb(value)
+ elif format == "KiB":
+ return fmt_kb(value)
+ name = self.get_item_name(session, item)
+ # Since condor.xml doesn't have a unit for this, we will improvise a
bit.
+ # In a perfect world, this might use the same Rosemary code that Negotiator
uses
+ if(name in ["MonitorSelfAge"]):
+ return fmt_timestamp_ddhhmmss(value)
+ except:
+ pass
+
+ return CuminStatistic.fmt_value(value)
+
+ def get_item_name(self, session, item):
+ the_item, _ = item
+ return the_item.name
+
class SchedulerOverviewGeneral(Widget):
def __init__(self, app, name, scheduler):
super(SchedulerOverviewGeneral, self).__init__(app, name)
Show replies by date