Author: eallen
Date: 2008-10-13 14:03:42 -0400 (Mon, 13 Oct 2008)
New Revision: 2630
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
Log:
Added Idle state radio button.
Use sql in JobGroupSet to determine job count instead of executing an sql select per
group.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-13 18:03:40 UTC (rev 2629)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-13 18:03:42 UTC (rev 2630)
@@ -958,11 +958,6 @@
def render_title(self, session, data):
return "Jobs"
-#TODO: Fix the sql to return the correct count instead of making a call per group here
- def render_content(self, session, data):
- where = "custom_group = '%s'" %
data["job_group"]
- return Job.select(where).count()
-
class JobsAndGroupsTab(Widget):
def __init__(self, app, name):
super(JobsAndGroupsTab, self).__init__(app, name)
@@ -1227,6 +1222,7 @@
self.add_state("a", "All")
self.add_state("r", "Running")
+ self.add_state("i", "Idle")
self.add_state("h", "Held")
self.add_state("d", "Removed")
@@ -1242,6 +1238,9 @@
elif phase == "r":
sql = "(j.job_status = %i" %
JobStatusInfo.get_status_int("Running") + \
" and %s)" % alive
+ elif phase == "i":
+ sql = "(j.job_status = %i" %
JobStatusInfo.get_status_int("Idle") + \
+ " and %s)" % alive
elif phase == "h":
sql = "(j.job_status = %i" %
JobStatusInfo.get_status_int("Held") + \
" and %s)" % alive
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-13 18:03:40 UTC (rev 2629)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-13 18:03:42 UTC (rev 2630)
@@ -60,8 +60,8 @@
select distinct
j.custom_group as id,
j.custom_group as job_group,
-/* (select count(distinct j.global_job_id) from job as j ) as jobs */
- 1 as jobs
+ (select count(distinct j.global_job_id) from job as j ) as jobs
+/* 1 as jobs */
from job as j
{sql_where}
{sql_orderby}