Author: eallen
Date: 2010-10-27 17:38:10 -0400 (Wed, 27 Oct 2010)
New Revision: 4403
Modified:
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/submission.py
Log:
BZ 647195: Added Scheduler column to Grid->Submission table
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2010-10-25 15:20:44 UTC (rev 4402)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2010-10-27 21:38:10 UTC (rev 4403)
@@ -81,7 +81,7 @@
overview = PoolOverview(app, "overview", self.object)
self.view.add_tab(overview)
- submissions = PoolSubmissionSelector(app, "submissions", self.object)
+ submissions = PoolSubmissionSchedulerSelector(app, "submissions",
self.object)
self.view.add_tab(submissions)
slots = SlotSelector(app, "slots", self.object)
Modified: mgmt/trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/submission.py 2010-10-25 15:20:44 UTC (rev 4402)
+++ mgmt/trunk/cumin/python/cumin/grid/submission.py 2010-10-27 21:38:10 UTC (rev 4403)
@@ -103,6 +103,56 @@
pool = self.parent.pool.get(session)
self.form.pool_name.set(form_session, pool.Pool)
+class PoolSubmissionSchedulerSelector(PoolSubmissionSelector):
+ def __init__(self, app, name, pool):
+ super(PoolSubmissionSchedulerSelector, self).__init__(app, name, pool)
+
+ scheduler = app.model.com_redhat_grid.Scheduler
+ self.SchedulerJoin(app, self.adapter.query, self.cls.sql_table,
+ self.cls.jobserverRef.sql_column, "jid")
+
+ frame = "main.grid.pool.scheduler"
+ col = self.SchedulerColumn(app, "Scheduler", scheduler.Name,
scheduler._id, frame)
+ self.insert_column(3, col)
+
+ class SchedulerColumn(ObjectLinkColumn):
+ def render_header_content(self, session):
+ return self.name
+
+ class SchedulerJoin(SqlInnerJoin):
+ """ Connects
Submission->jobserverRef->schedulerRef->Scheduler """
+
+ def __init__(self, app, query, table, this, that):
+ super(PoolSubmissionSchedulerSelector.SchedulerJoin, self).__init__(query,
table, this, that)
+
+ self.adapter = self.SchedulerData(app)
+
+ def emit(self):
+ scheduler_select = self.adapter.query.emit(self.adapter.columns)
+
+ args = (scheduler_select, self.this, self.that)
+
+ return "inner join (%s) as \"Scheduler\" on %s = %s" %
args
+
+ class SchedulerData(ObjectSqlAdapter):
+ def __init__(self, app):
+ jobserver = app.model.com_redhat_grid.JobServer
+ scheduler = app.model.com_redhat_grid.Scheduler
+
+ super(PoolSubmissionSchedulerSelector.SchedulerJoin.SchedulerData,
self).__init__(app, jobserver)
+
+ self.add_join(scheduler, jobserver.schedulerRef, scheduler._id)
+
+ self.columns = list()
+
+ # avoid conflict with scheduler._id
+ job_server_id = jobserver._id.sql_column.identifier
+ self.columns.append("%s as jid" % job_server_id)
+
+ self.columns.append(jobserver.schedulerRef.sql_column)
+ self.columns.append(scheduler._id.sql_column)
+ self.columns.append(scheduler.Name.sql_column)
+
class JobDescriptionField(StringField):
def __init__(self, app, name):
super(JobDescriptionField, self).__init__(app, name)