Author: tmckay
Date: 2011-12-09 19:55:22 +0000 (Fri, 09 Dec 2011)
New Revision: 5174
Modified:
branches/stability/cumin/python/cumin/grid/scheduler.py
Log:
Merge 5118 from trunk.
BZ751779
Modified: branches/stability/cumin/python/cumin/grid/scheduler.py
===================================================================
--- branches/stability/cumin/python/cumin/grid/scheduler.py 2011-12-09 19:52:53 UTC (rev
5173)
+++ branches/stability/cumin/python/cumin/grid/scheduler.py 2011-12-09 19:55:22 UTC (rev
5174)
@@ -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