[rhmessaging-commits] rhmessaging commits: r3344 - in mgmt/trunk/cumin/python/cumin: grid and 1 other directories.

rhmessaging-commits at lists.jboss.org rhmessaging-commits at lists.jboss.org
Wed Apr 29 12:36:15 EDT 2009


Author: eallen
Date: 2009-04-29 12:36:15 -0400 (Wed, 29 Apr 2009)
New Revision: 3344

Modified:
   mgmt/trunk/cumin/python/cumin/grid/pool.py
   mgmt/trunk/cumin/python/cumin/grid/slot.py
   mgmt/trunk/cumin/python/cumin/grid/slot.strings
   mgmt/trunk/cumin/python/cumin/inventory/system.py
   mgmt/trunk/cumin/python/cumin/model.py
   mgmt/trunk/cumin/python/cumin/parameters.py
Log:
Adding Slot view page

Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py	2009-04-29 16:36:15 UTC (rev 3344)
@@ -17,7 +17,7 @@
 from collector import CollectorSet, CollectorFrame, CollectorStart, CollectorStop
 from negotiator import NegotiatorSet, NegotiatorFrame, NegStart, NegStop
 from limit import LimitsSet, LimitsFrame
-from slot import SlotSet, SlotStatSet
+from slot import SlotSet, SlotStatSet, SlotFrame
 
 strings = StringCatalog(__file__)
 
@@ -89,6 +89,9 @@
         self.submitter = SubmitterFrame(app, "sub")
         self.add_mode(self.submitter)
 
+        self.slot = SlotFrame(app, "slot")
+        self.add_mode(self.slot)
+
         self.collector = CollectorFrame(app, "coll")
         self.add_mode(self.collector)
 

Modified: mgmt/trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.py	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.py	2009-04-29 16:36:15 UTC (rev 3344)
@@ -6,6 +6,7 @@
 from wooly.resources import *
 from wooly.tables import *
 
+from cumin.stat import *
 from cumin.widgets import *
 
 strings = StringCatalog(__file__)
@@ -28,13 +29,18 @@
     def __init__(self, app, name):
         super(SlotSet, self).__init__(app, name)
 
-        col = self.Name(app, "name")
+        col = self.NameColumn(app, "name")
         self.add_column(col)
 
-    class Name(SqlTableColumn):
+    class NameColumn(SqlTableColumn):
         def render_title(self, session, data):
             return "Name"
 
+        def render_content(self, session, data):
+            slot = Identifiable(data["id"])
+            href = self.frame.slot.get_href(session, slot)
+            return fmt_link(href, data["name"])
+
     def render_items(self, session, *args):
         """ overridden because a slotset query is expensive.
             the rows are cached """
@@ -49,3 +55,56 @@
 
 class SlotStatSet(UniqueSlot):
     pass
+
+class SlotFrame(CuminFrame):
+    def __init__(self, app, name):
+        super(SlotFrame, self).__init__(app, name)
+
+        self.object = SlotParameter(app, "id")
+        self.add_parameter(self.object)
+
+        self.view = SlotView(app, "view")
+        self.add_mode(self.view)
+
+class SlotView(CuminView):
+    def __init__(self, app, name):
+        super(SlotView, self).__init__(app, name)
+
+        status = self.SlotStatus(app, "status")
+        self.add_child(status)
+
+        self.__tabs = TabbedModeSet(app, "tabs")
+        self.add_child(self.__tabs)
+
+        stats = SlotStats(app, "stats")
+        self.__tabs.add_tab(stats)
+
+        details = CuminDetails(app, "details")
+        self.__tabs.add_tab(details)
+
+    class SlotStatus(CuminStatus):
+        def render_title(self, session, *args):
+            return "Slot Status"
+
+class SlotStats(Widget):
+    def __init__(self, app, name):
+        super(SlotStats, self).__init__(app, name)
+
+        stats = StatSet(app, "general", "load")
+        self.add_child(stats)
+
+        chart = self.LoadChart(app, "chart")
+        chart.duration.param.default = "3600"
+        self.add_child(chart)
+
+    def render_title(self, session):
+        return "Statistics"
+
+    class LoadChart(StatValueChart):
+        def __init__(self, app, name):
+            super(SlotStats.LoadChart, self).__init__(app, name)
+
+            self.stats = ("LoadAvg", "CondorLoadAvg")
+
+        def render_title(self, session, sched):
+            return "Load"

Modified: mgmt/trunk/cumin/python/cumin/grid/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.strings	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.strings	2009-04-29 16:36:15 UTC (rev 3344)
@@ -21,16 +21,32 @@
 
 [SlotStatSet.sql]
 select
-  sum(case activity when 'Idle' then 1 else 0 end) as idl,
+  sum(case when (activity = 'Idle') and (state = 'Unclaimed') then 1 else 0 end) as available,
   sum(1) as all
 from (select
   s.name,
   s.pool,
   s.qmf_update_time,
-  c.activity
+  c.activity,
+  c.state
 from slot as s
 left outer join slot_stats as c on c.id = s.stats_curr_id) as s
 {sql_where}
 
 [SlotStatSet.count_sql]
 1
+
+[SlotStats.html]
+<table class="twocol">
+  <tbody>
+  <tr>
+    <td>
+      <h2>General</h2>
+      {general}
+    </td>
+    <td>
+      {chart}
+    </td>
+  </tr>
+  </tbody>
+</table>

Modified: mgmt/trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/inventory/system.py	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/inventory/system.py	2009-04-29 16:36:15 UTC (rev 3344)
@@ -6,6 +6,7 @@
 from cumin.parameters import *
 from cumin.formats import *
 from cumin.util import *
+from cumin.grid.slot import SlotFrame
 
 strings = StringCatalog(__file__)
 
@@ -117,6 +118,9 @@
         self.view = SystemView(app, "view")
         self.add_mode(self.view)
 
+        self.slot = SlotFrame(app, "slot")
+        self.add_mode(self.slot)
+
 class SystemStatus(CuminStatus):
     def render_mem_free(self, session, system):
         return self.app.model.system.memFree.value_html(system)

Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/model.py	2009-04-29 16:36:15 UTC (rev 3344)
@@ -355,6 +355,7 @@
         self.title = None
         self.category = "general"
         self.summary = False
+        self.format = None
 
         self.link_cb = None
         self.highlow = False
@@ -407,6 +408,8 @@
 
         if value is None:
             text = ""
+        elif self.format:
+            text = self.format % value
         elif type(value) in (int, long):
             if value == 0:
                 text = "0"
@@ -656,18 +659,52 @@
         prop = CuminProperty(self, "JobId")
         prop.title = "Current Job Id"
 
+        prop = CuminProperty(self, "AccountingGroup")
+        prop.title = "Accounting Group"
+
+        prop = CuminProperty(self, "Arch")
+        prop.title = "Architecture"
+
+        prop = CuminProperty(self, "OpSys")
+        prop.title = "Operating System"
+
+        prop = CuminProperty(self, "ConcurrencyLimits")
+        prop.title = "Concurrency Limits"
+
+        prop = CuminProperty(self, "Cpus")
+        prop.title = "CPUs"
+
+        prop = CuminProperty(self, "Disk")
+        prop.title = "Disk"
+
+        prop = CuminProperty(self, "Memory")
+        prop.title = "Memory"
+
+        prop = CuminProperty(self, "Mips")
+        prop.title = "MIPS"
+
+        prop = CuminProperty(self, "JobStart")
+        prop.title = "JobStart"
+
         stat = CuminStat(self, "Activity")
         stat.title = "Activity"
-        stat.category = "general"
 
         stat = CuminStat(self, "CondorLoadAvg")
         stat.title = "Condor Load Avg"
-        stat.category = "general"
+        stat.format = "%2.02f"
+        stat.category = "load"
 
         stat = CuminStat(self, "LoadAvg")
         stat.title = "Load Avg"
-        stat.category = "general"
+        stat.format = "%2.02f"
+        stat.category = "load"
 
+    def get_title(self, session):
+        return "Slot"
+
+    def get_object_name(self, slot):
+        return slot.Name
+
 class Visualization(CuminAction):
     def __init__(self, cls, name):
         super(Visualization, self).__init__(cls, name)

Modified: mgmt/trunk/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py	2009-04-29 14:24:38 UTC (rev 3343)
+++ mgmt/trunk/cumin/python/cumin/parameters.py	2009-04-29 16:36:15 UTC (rev 3344)
@@ -142,6 +142,13 @@
     def do_marshal(self, session):
         return str(session.id)
 
+class SlotParameter(Parameter):
+    def do_unmarshal(self, string):
+        return Slot.get(int(string))
+        
+    def do_marshal(self, slot):
+        return str(slot.id)
+
 class SubmitterParameter(Parameter):
     def do_unmarshal(self, string):
         return Submitter.get(int(string))




More information about the rhmessaging-commits mailing list