[rhmessaging-commits] rhmessaging commits: r4304 - mgmt/newdata/cumin/python/cumin/grid.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Fri Sep 17 11:00:22 EDT 2010
Author: eallen
Date: 2010-09-17 11:00:22 -0400 (Fri, 17 Sep 2010)
New Revision: 4304
Modified:
mgmt/newdata/cumin/python/cumin/grid/scheduler.py
Log:
Fix for BZ 633948: Correct the linkage from submission to scheduler by using Submission->JobServer->Scheduler.
Modified: mgmt/newdata/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-09-17 14:35:35 UTC (rev 4303)
+++ mgmt/newdata/cumin/python/cumin/grid/scheduler.py 2010-09-17 15:00:22 UTC (rev 4304)
@@ -33,10 +33,12 @@
overview = SchedulerOverview(app, "overview", self.object)
self.view.add_tab(overview)
- submissions = PoolSubmissionSelector(app, "submissions", pool)
+ submissions = SchedulerPoolSubmissionSelector(app, "submissions", pool)
self.view.add_tab(submissions)
cls = submissions.cls
+ # We are referencing the jobserverRef, but passing in the scheduler id.
+ # This gets fixed up in SchedulerPoolSubmissionSelectorget_data_value
submissions.add_reference_filter(self.object, cls.jobserverRef)
submitters = SubmitterSelector(app, "submitters", self.object)
@@ -45,6 +47,26 @@
self.start = DaemonStart(app, self, "SCHEDD")
self.stop = DaemonStop(app, self, "SCHEDD")
+class SchedulerPoolSubmissionSelector(PoolSubmissionSelector):
+ def get_data_values(self, session):
+ values = super(SchedulerPoolSubmissionSelector, self).get_data_values(session)
+
+ jobserver_key = self.cls.jobserverRef.name
+
+ # could also use self.frame.id.get(session)
+ scheduler_id = values[jobserver_key]
+
+ #we need to find the _id of the jobServer whose _schedulerRef_id matches our scheduler
+ cls = self.app.model.com_redhat_grid.JobServer
+ job_server = cls.get_object(session.cursor, _schedulerRef_id=scheduler_id)
+
+ # Awkward: if there is no jobserver for this scheduler, don't select any records.
+ # An alternative is to create our own adapter and override the get_data method
+ jobserver_id = job_server and job_server._id or -1
+
+ values[jobserver_key] = jobserver_id
+ return values
+
class SchedulerSelector(ObjectSelector):
def __init__(self, app, name, pool):
cls = app.model.com_redhat_grid.Scheduler
More information about the rhmessaging-commits
mailing list