Author: justi9
Date: 2008-10-02 08:30:32 -0400 (Thu, 02 Oct 2008)
New Revision: 2574
Added:
mgmt/trunk/cumin/python/cumin/slot.py
mgmt/trunk/cumin/python/cumin/slot.strings
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/system.py
Log:
Add a SlotSet, and stub in system jobs and slots; the data isn't properly hooked up
yet
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 11:57:19 UTC (rev 2573)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -11,7 +11,6 @@
from parameters import *
from formats import *
from util import *
-from system import *
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.job")
@@ -233,6 +232,7 @@
def show_jobs_remove(self, session):
return self.frame.show_jobs_remove(session)
+from system import SystemFrame, SystemSet
class JobGroupFrame(CuminFrame):
def __init__(self, app, name):
@@ -1040,6 +1040,7 @@
self.is_group = GroupSwitch(app, "group")
self.add_child(self.is_group)
+ print "XXX"
self.job_tab = JobTab(app, "jobtab")
self.add_child(self.job_tab)
Added: mgmt/trunk/cumin/python/cumin/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/slot.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -0,0 +1,23 @@
+import logging
+
+from wooly import *
+from wooly.widgets import *
+from wooly.forms import *
+from wooly.resources import *
+from wooly.tables import *
+
+from widgets import *
+
+strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.job")
+
+class SlotSet(CuminTable):
+ def __init__(self, app, name):
+ super(SlotSet, self).__init__(app, name)
+
+ col = self.Name(app, "name")
+ self.add_column(col)
+
+ class Name(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
Added: mgmt/trunk/cumin/python/cumin/slot.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/slot.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/slot.strings 2008-10-02 12:30:32 UTC (rev 2574)
@@ -0,0 +1,15 @@
+[SlotSet.sql]
+select
+ s.id,
+ s.name
+from slot as s
+left outer join slot_stats as c on c.id = s.stats_curr_id
+left outer join slot_stats as p on p.id = s.stats_prev_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[SlotSet.count_sql]
+select count(*)
+from slot as s
+{sql_where}
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-02 11:57:19 UTC (rev 2573)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-02 12:30:32 UTC (rev 2574)
@@ -1,65 +1,90 @@
-from mint import *
-from wooly import *
-from wooly.widgets import *
-
-from widgets import *
-from parameters import *
-from formats import *
-from util import *
-
-strings = StringCatalog(__file__)
-
-class SystemSet(CuminTable, Form):
- def __init__(self, app, name):
- super(SystemSet, self).__init__(app, name)
-
- self.ids = CheckboxIdColumn(app, "id", self)
- self.add_column(self.ids)
- self.add_form_parameter(self.ids)
-
- col = self.NameColumn(app, "name")
- self.add_column(col)
- self.set_default_column(col)
-
- def render_title(self, session, *args):
- count = System.select().count()
- return "Systems %s" % fmt_count(count)
-
- class NameColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Name"
-
- def render_content(self, session, data):
- system = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_system(branch, system).show_view(branch)
- return fmt_olink(branch, system, name=data["name"])
-
-class SystemFrame(CuminFrame):
- def __init__(self, app, name):
- super(SystemFrame, self).__init__(app, name)
-
- self.object = SystemParameter(app, "id")
- self.add_parameter(self.object)
-
- view = SystemView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
-
-class SystemStatus(CuminStatus):
- pass
-
-class SystemView(CuminView):
- def __init__(self, app, name):
- super(SystemView, self).__init__(app, name)
-
- summary = CuminSummary(app, "summary")
- self.add_child(summary)
-
- status = SystemStatus(app, "status")
- self.add_child(status)
-
- self.__tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.__tabs)
-
- self.__tabs.add_tab(CuminDetails(app, "details"))
+from mint import *
+from wooly import *
+from wooly.widgets import *
+
+from widgets import *
+from parameters import *
+from formats import *
+from util import *
+
+strings = StringCatalog(__file__)
+
+class SystemSet(CuminTable, Form):
+ def __init__(self, app, name):
+ super(SystemSet, self).__init__(app, name)
+
+ self.ids = CheckboxIdColumn(app, "id", self)
+ self.add_column(self.ids)
+ self.add_form_parameter(self.ids)
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+ self.set_default_column(col)
+
+ def render_title(self, session, *args):
+ count = System.select().count()
+ return "Systems %s" % fmt_count(count)
+
+ class NameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
+
+ def render_content(self, session, data):
+ system = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame.show_system(branch, system).show_view(branch)
+ return fmt_olink(branch, system, name=data["name"])
+
+class SystemFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(SystemFrame, self).__init__(app, name)
+
+ self.object = SystemParameter(app, "id")
+ self.add_parameter(self.object)
+
+ view = SystemView(app, "view")
+ self.add_mode(view)
+ self.set_view_mode(view)
+
+class SystemStatus(CuminStatus):
+ pass
+
+class SystemView(CuminView):
+ def __init__(self, app, name):
+ super(SystemView, self).__init__(app, name)
+
+ summary = CuminSummary(app, "summary")
+ self.add_child(summary)
+
+ status = SystemStatus(app, "status")
+ self.add_child(status)
+
+ self.__tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.__tabs)
+
+ self.__tabs.add_tab(SystemJobSet(app, "jobs"))
+ self.__tabs.add_tab(SystemSlotSet(app, "slots"))
+ self.__tabs.add_tab(CuminDetails(app, "details"))
+
+from job import JobSet
+
+class SystemJobSet(JobSet):
+ def render_title(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "Grid Jobs %s" % fmt_count(Job.select(sql).count())
+
+ def render_sql_where(self, session, *args):
+ phase_sql = self.get_phase_sql(session)
+ sql = "1 = 1" # XXX
+ return "where %s" % " and ".join([phase_sql, sql])
+
+from slot import SlotSet
+
+class SystemSlotSet(SlotSet):
+ def render_title(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "Grid Slots %s" % fmt_count(Slot.select(sql).count())
+
+ def render_sql_where(self, session, *args):
+ sql = "1 = 1" # XXX
+ return "where %s" % sql