Author: eallen
Date: 2008-11-10 10:05:57 -0500 (Mon, 10 Nov 2008)
New Revision: 2778
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Really show correct job count on job tab when multiple brokers are registered.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-11-10 14:05:13 UTC (rev 2777)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-11-10 15:05:57 UTC (rev 2778)
@@ -80,20 +80,22 @@
def get_args(self, session):
return self.frame.get_args(session)
- def get_phase_sql(self, session):
- return self.phase.get_sql_constraint(session)
+ def get_phase_sql(self, session, phase=None):
+ return self.phase.get_sql_constraint(session, phase)
def get_phase_title(self, session):
state = self.phase.get(session)
return self.phase.get_title(state)
def render_sql_where(self, session, *args):
+ phase = len(args) > 1 and args[1] or None
elems = list()
- elems.append(self.get_phase_sql(session))
+ elems.append(self.get_phase_sql(session, phase))
elems.append("s.pool = %(pool)s")
return "where %s" % " and ".join(elems)
- def get_sql_values(self, session, pool):
+ def get_sql_values(self, session, *args):
+ pool = args[0]
return {"pool": pool.id}
class ArgsColumn(SqlTableColumn):
@@ -238,6 +240,11 @@
def get_find_sql_values(self, session, pool):
return {"custom_id": self.job_search.get(session), "pool":
pool.id}
+ def get_full_item_count(self, session, *args):
+ # request item count will phase=="a"
+ new_args = (args[0], "a")
+ return self.get_item_count(session, *new_args)
+
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["custom_group",
"scheduler", "submitter"])
@@ -993,7 +1000,7 @@
return self.frame.get_args(session)
def render_title(self, session, *args):
- return "Jobs %s" % fmt_count(self.job_tab.get_item_count(session,
*args))
+ return "Jobs %s" % fmt_count(self.job_tab.get_full_item_count(session,
*args))
def show_status_switch(self, session):
is_group = self.is_group.get(session)
@@ -1239,8 +1246,9 @@
self.add_state("c", "Completed")
self.add_state("d", "Removed")
- def get_sql_constraint(self, session):
- phase = self.get(session)
+ def get_sql_constraint(self, session, phase=None):
+ if not phase:
+ phase = self.get(session)
alive = "((c.rec_time is null or " + \
"c.rec_time <= now() - interval '10 minutes')" + \
Show replies by date