[rhmessaging-commits] rhmessaging commits: r2706 - mgmt/trunk/cumin/python/cumin.
rhmessaging-commits at lists.jboss.org
rhmessaging-commits at lists.jboss.org
Wed Oct 29 20:23:52 EDT 2008
Author: eallen
Date: 2008-10-29 20:23:51 -0400 (Wed, 29 Oct 2008)
New Revision: 2706
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
Log:
Compensate for manually removed jobs not getting a status update.
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-30 00:22:35 UTC (rev 2705)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-10-30 00:23:51 UTC (rev 2706)
@@ -330,20 +330,38 @@
return self.jobs.get(session)
else:
state = stat.name
- value = self.get_value(state)
+ value = self.get_value(session, state)
return value
- def get_value(self, state):
- where = "job_status = %i" % JobStatusInfo.get_status_int(state)
- return Job.select(where).count()
+ def get_value(self, session, state):
+ pool = self.frame.get_object(session)
+ elems = list()
+ istate = JobStatusInfo.get_status_int(state)
+ elems.append("job_status = %i" % istate)
+ elems.append("s.pool = '%s'" % pool.id)
+ # manually removed jobs will have a state of Idle
+ # with a deletion_time
+ if state == "Idle":
+ elems.append("job.deletion_time is null")
+ where = " and ".join(elems)
+
+ # manually removed jobs will have a state of Idle
+ # with a deletion_time
+ if state == "Removed":
+ removed = "(job.deletion_time is not null and job_status = %i)" % JobStatusInfo.get_status_int("Idle")
+ where = " or ".join((where, removed))
+
+ jn = "inner join scheduler as s on s.id = scheduler_id"
+ return Job.select(where, join=jn).count()
+
def render_item_rate(self, session, stat):
jobs = self.jobs.get(session)
state = stat[0].name
if state == "Jobs":
value = jobs
else:
- value = self.get_value(state)
+ value = self.get_value(session, state)
if jobs:
percent = (value*1.0) / (jobs*1.0) * 100.0
return jobs and "%2.2f" % percent or "-"
More information about the rhmessaging-commits
mailing list