Author: justi9
Date: 2009-06-18 11:46:18 -0400 (Thu, 18 Jun 2009)
New Revision: 3460
Added:
mgmt/trunk/cumin/python/cumin/grid/submission.py
mgmt/trunk/cumin/python/cumin/grid/submission.strings
Modified:
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/parameters.py
Log:
Add a submissions table widget
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-06-17 21:40:36 UTC (rev 3459)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-06-18 15:46:18 UTC (rev 3460)
@@ -13,6 +13,7 @@
from job import *
from scheduler import SchedulerSet, SchedulerFrame, SchedulerStart, SchedulerStop
+from submission import SubmissionSet
from submitter import SubmitterSet, SubmitterFrame
from collector import CollectorSet, CollectorFrame, CollectorStart, CollectorStop
from negotiator import NegotiatorSet, NegotiatorFrame, NegStart, NegStop
@@ -180,6 +181,9 @@
self.jobs = JobsAndGroupsTab(app, "jobs")
self.__tabs.add_tab(self.jobs)
+ self.submissions = SubmissionSet(app, "submissions")
+ self.__tabs.add_tab(self.submissions)
+
self.scheds = PoolSchedulerSet(app, "scheds")
self.__tabs.add_tab(self.scheds)
Added: mgmt/trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.py 2009-06-18 15:46:18 UTC (rev 3460)
@@ -0,0 +1,50 @@
+import logging
+
+from cumin.widgets import *
+from cumin.util import *
+
+strings = StringCatalog(__file__)
+log = logging.getLogger("cumin.grid.submission")
+
+class SubmissionSet(CuminSelectionTable):
+ def __init__(self, app, name):
+ item = SubmissionParameter(app, "item")
+ super(SubmissionSet, self).__init__(app, name, item)
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+
+ col = self.IdleColumn(app, "idle")
+ self.add_column(col)
+
+ col = self.RunningColumn(app, "running")
+ self.add_column(col)
+
+ col = self.CompletedColumn(app, "completed")
+ self.add_column(col)
+
+ def get_submission_href(self, session, id):
+ pass
+
+ def render_title(self, session):
+ return "Submissions %s" % fmt_count(Submission.select().count())
+
+ class NameColumn(ClientTruncateColumn):
+ def render_title(self, session, data):
+ return "Name"
+
+ def render_content(self, session, data):
+ href = self.parent.get_submission_href(session, data["id"])
+ return fmt_link(href, data["name"])
+
+ class IdleColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Idle Jobs"
+
+ class RunningColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Running Jobs"
+
+ class CompletedColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Completed Jobs"
Added: mgmt/trunk/cumin/python/cumin/grid/submission.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.strings 2009-06-18 15:46:18 UTC (rev
3460)
@@ -0,0 +1,18 @@
+[SubmissionSet.sql]
+select
+ s.id,
+ s.name,
+ c.idle,
+ c.running,
+ c.completed
+from submission as s
+inner join scheduler as d on s.scheduler_id = d.id
+left outer join submission_stats as c on s.stats_curr_id = c.id
+{sql_where}
+{sql_order_by}
+{sql_limit}
+
+[SubmissionSet.count_sql]
+select count(*) from submission as s
+inner join scheduler as d on s.scheduler_id = d.id
+{sql_where}
Modified: mgmt/trunk/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py 2009-06-17 21:40:36 UTC (rev 3459)
+++ mgmt/trunk/cumin/python/cumin/parameters.py 2009-06-18 15:46:18 UTC (rev 3460)
@@ -170,6 +170,13 @@
def do_marshal(self, slot):
return str(slot.id)
+class SubmissionParameter(Parameter):
+ def do_unmarshal(self, string):
+ return Submission.get(int(string))
+
+ def do_marshal(self, sub):
+ return str(sub.id)
+
class SubmitterParameter(Parameter):
def do_unmarshal(self, string):
return Submitter.get(int(string))