Author: justi9
Date: 2010-03-22 14:06:01 -0400 (Mon, 22 Mar 2010)
New Revision: 3874
Modified:
mgmt/newdata/cumin/python/cumin/grid/job.py
mgmt/newdata/cumin/python/cumin/inventory/main.py
mgmt/newdata/cumin/python/cumin/inventory/system.py
Log:
Add new table and frame for systems
Modified: mgmt/newdata/cumin/python/cumin/grid/job.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/job.py 2010-03-22 17:45:10 UTC (rev 3873)
+++ mgmt/newdata/cumin/python/cumin/grid/job.py 2010-03-22 18:06:01 UTC (rev 3874)
@@ -213,7 +213,7 @@
def render_content(self, session):
return "Go"
-from cumin.inventory.system import SystemFrame, SystemSet
+from cumin.inventory.system import SystemFrame
class JobGroupFrame(CuminFrame):
def __init__(self, app, name, pool):
@@ -237,7 +237,7 @@
self.tabs.add_tab(JobGroupStats(app, "stats"))
self.tabs.add_tab(JobGroupJobSet(app, "jobs", pool))
- self.tabs.add_tab(JobGroupSystemSet(app, "systems"))
+ #self.tabs.add_tab(JobGroupSystemSet(app, "systems"))
#self.tabs.add_tab(CuminDetails(app, "details"))
class JobGroupStats(Widget):
@@ -321,20 +321,20 @@
str = super(JobGroupJobSet, self).render_count(session)
return "%s in Job Group '%s'" % (str, group.get_id())
-class JobGroupSystemSet(SystemSet):
- def render_sql_where(self, session):
- subquery = """
- select 1
- from slot as l
- join job as j on j.custom_id = l.job_id
- where j.custom_group = %(id)s and l.system = s.node_name
- """
+# class JobGroupSystemSet(SystemSet):
+# def render_sql_where(self, session):
+# subquery = """
+# select 1
+# from slot as l
+# join job as j on j.custom_id = l.job_id
+# where j.custom_group = %(id)s and l.system = s.node_name
+# """
- return "where exists (%s)" % subquery
+# return "where exists (%s)" % subquery
- def get_sql_values(self, session):
- group = self.frame.object.get(session)
- return {"id": group.id}
+# def get_sql_values(self, session):
+# group = self.frame.object.get(session)
+# return {"id": group.id}
class JobFrame(CuminFrame):
def __init__(self, app, name):
@@ -380,23 +380,23 @@
#self.tabs.add_tab(JobSystemSet(app, "systems", job))
#self.tabs.add_tab(CuminDetails(app, "details", job))
-class JobSystemSet(SystemSet):
- def __init__(self, app, name, job):
- super(JobSystemSet, self).__init__(app, name)
+# class JobSystemSet(SystemSet):
+# def __init__(self, app, name, job):
+# super(JobSystemSet, self).__init__(app, name)
- self.job = job
+# self.job = job
- def render_sql_where(self, session):
- return """
- where exists
- (select 1
- from slot
- where system = s.node_name and job_id = %(id)s)
- """
+# def render_sql_where(self, session):
+# return """
+# where exists
+# (select 1
+# from slot
+# where system = s.node_name and job_id = %(id)s)
+# """
- def get_sql_values(self, session):
- job = self.job.get(session)
- return {"id": "%i.%i" % (job.ClusterId, job.ProcId)}
+# def get_sql_values(self, session):
+# job = self.job.get(session)
+# return {"id": "%i.%i" % (job.ClusterId, job.ProcId)}
class JobAdsSet(PropertySet):
types = {0: "expression",
Modified: mgmt/newdata/cumin/python/cumin/inventory/main.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/inventory/main.py 2010-03-22 17:45:10 UTC (rev 3873)
+++ mgmt/newdata/cumin/python/cumin/inventory/main.py 2010-03-22 18:06:01 UTC (rev 3874)
@@ -42,7 +42,7 @@
self.tabs = TabbedModeSet(app, "tabs")
self.add_child(self.tabs)
- self.tabs.add_tab(SystemSet(app, "systems"))
+ self.tabs.add_tab(SystemSelector(app, "systems"))
class Heading(CuminHeading):
def render_title(self, session):
Modified: mgmt/newdata/cumin/python/cumin/inventory/system.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-03-22 17:45:10 UTC (rev
3873)
+++ mgmt/newdata/cumin/python/cumin/inventory/system.py 2010-03-22 18:06:01 UTC (rev
3874)
@@ -1,6 +1,8 @@
from mint import *
from wooly import *
from wooly.widgets import *
+from cumin.objectframe import *
+from cumin.objectselector import *
from cumin.stat import *
from cumin.widgets import *
from cumin.parameters import *
@@ -13,75 +15,27 @@
strings = StringCatalog(__file__)
-class SystemSet(CuminTable, Form):
+class SystemSelector(ObjectSelector):
def __init__(self, app, name):
- super(SystemSet, self).__init__(app, name)
+ cls = app.rosemary.com_redhat_sesame.Sysimage
- self.ids = CheckboxIdColumn(app, "id")
- self.add_column(self.ids)
+ super(SystemSelector, self).__init__(app, name, cls)
- col = self.NameColumn(app, "name")
+ frame = "main.inventory.system"
+ col = ObjectLinkColumn(app, "name", cls.nodeName, cls._id, frame)
self.add_column(col)
- self.set_default_column(col)
- col = self.KernelColumn(app, "kernel")
- self.add_column(col)
+ self.add_attribute_column(cls.osName)
+ self.add_attribute_column(cls.machine)
+ self.add_attribute_column(cls.memFree)
+ self.add_attribute_column(cls.loadAverage1Min)
- col = self.ArchColumn(app, "arch")
- self.add_column(col)
+class SystemFrame(ObjectFrame):
+ def __init__(self, app, name):
+ cls = app.rosemary.com_redhat_sesame.Sysimage
- col = self.FreeMemoryColumn(app, "mem_free")
- col.align = "right"
- self.add_column(col)
+ super(SystemFrame, self).__init__(app, name, cls)
- col = self.LoadColumn(app, "load")
- col.align = "right"
- self.add_column(col)
-
- def render_title(self, session, *args):
- return "Systems %s" % fmt_count(self.get_item_count(session, *args))
-
- class NameColumn(SqlTableColumn):
- def render_title(self, session):
- return "Name"
-
- def render_content(self, session, data):
- system = Identifiable(data["id"])
- href = self.page.main.inventory.system.get_href(session, system)
- return fmt_link(href, fmt_shorten(data["name"]))
-
- class KernelColumn(SqlTableColumn):
- def render_title(self, session):
- return "Kernel"
-
- class ArchColumn(SqlTableColumn):
- def render_title(self, session):
- return "Arch"
-
- class FreeMemoryColumn(SqlTableColumn):
- def render_title(self, session):
- return "Free Memory"
-
- def render_content(self, session, data):
- mem_free = data["mem_free"]
-
- if mem_free:
- return "%i KB" % mem_free
- else:
- return fmt_none_brief()
-
- class LoadColumn(SqlTableColumn):
- def render_title(self, session):
- return "Load Average"
-
- def render_content(self, session, data):
- load = data["load"]
-
- if load:
- return "%0.3f" % load
- else:
- return fmt_none_brief()
-
class TopSystemSet(TopTable):
def __init__(self, app, name):
super(TopSystemSet, self).__init__(app, name)
@@ -113,19 +67,6 @@
def render_content(self, session, data):
return "%0.3f" % data["load_avg"]
-class SystemFrame(CuminFrame):
- def __init__(self, app, name):
- super(SystemFrame, self).__init__(app, name)
-
- self.object = SystemParameter(app, "id")
- self.add_parameter(self.object)
-
- self.view = SystemView(app, "view", self.object)
- self.add_mode(self.view)
-
- self.slot = SlotFrame(app, "slot")
- self.add_mode(self.slot)
-
class SystemStats(Widget):
def __init__(self, app, name, system):
super(SystemStats, self).__init__(app, name)
@@ -203,9 +144,9 @@
def render_slot_chart_height(self, session):
return 200
-class SystemView(CuminView):
+class OldSystemView(CuminView):
def __init__(self, app, name, system):
- super(SystemView, self).__init__(app, name, system)
+ super(OldSystemView, self).__init__(app, name, system)
self.tabs = TabbedModeSet(app, "tabs")
self.add_child(self.tabs)