Author: justi9
Date: 2009-09-01 14:28:36 -0400 (Tue, 01 Sep 2009)
New Revision: 3610
Modified:
mgmt/trunk/cumin/python/cumin/grid/main.py
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/pool.strings
Log:
Revamp the pool set query in light of the one-collector-per-pool rule, and add pool stat
columns; remove some unused classes
Modified: mgmt/trunk/cumin/python/cumin/grid/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/main.py 2009-09-01 17:50:19 UTC (rev 3609)
+++ mgmt/trunk/cumin/python/cumin/grid/main.py 2009-09-01 18:28:36 UTC (rev 3610)
@@ -88,9 +88,12 @@
heading = self.Heading(app, "heading")
self.add_child(heading)
- pools = PoolSet(app, "pools")
- self.add_child(pools)
+ self.tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.tabs)
+ self.pools = PoolSet(app, "pools")
+ self.tabs.add_tab(self.pools)
+
class Heading(CuminHeading):
def render_title(self, session):
return "Grid"
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-09-01 17:50:19 UTC (rev 3609)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-09-01 18:28:36 UTC (rev 3610)
@@ -36,14 +36,15 @@
col = self.NameColumn(app, "name")
self.add_column(col)
- self.set_default_column(col)
-
- col = self.JobsColumn(app, "jobs")
+ col = self.JobsRunningColumn(app, "running_jobs")
self.add_column(col)
- col = self.StatusColumn(app, "status")
+ col = self.JobsIdleColumn(app, "idle_jobs")
self.add_column(col)
+ col = self.SlotsColumn(app, "slots")
+ self.add_column(col)
+
def render_title(self, session):
count = self.get_item_count(session)
return "Pools %s" % fmt_count(count)
@@ -59,20 +60,18 @@
return fmt_link(href, data["name"])
- class JobsColumn(SqlTableColumn):
+ class JobsRunningColumn(SqlTableColumn):
def render_title(self, session, data):
- return "Jobs"
+ return "Running Jobs"
- def render_content(self, session, data):
- return data["jobs"]
+ class JobsIdleColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Idle Jobs"
- class StatusColumn(SqlTableColumn):
+ class SlotsColumn(SqlTableColumn):
def render_title(self, session, data):
- return "Status"
+ return "Slots"
- def render_content(self, session, data):
- return "Active"
-
class PoolFrame(CuminFrame):
def __init__(self, app, name):
super(PoolFrame, self).__init__(app, name)
@@ -89,10 +88,6 @@
self.job = JobFrame(app, "job")
self.add_mode(self.job)
- # XXX
- #self.job_group = JobGroupFrame(app, "jobgroup", self.object)
- #self.add_mode(self.job_group)
-
self.slot = SlotFrame(app, "slot")
self.add_mode(self.slot)
@@ -345,16 +340,6 @@
if grid:
return super(GridStats.GridStatSet, self).do_render(session)
-class PoolJobStats(CuminTable):
- def render_sql_where(self, session, pool):
- elems = list()
- elems.append("s.pool = %(pool)s")
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session, pool):
- values = {"pool": pool.id}
- return values
-
class PoolSlotMap(SlotMap):
def __init__(self, app, name, pool):
super(PoolSlotMap, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-09-01 17:50:19 UTC (rev 3609)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-09-01 18:28:36 UTC (rev 3610)
@@ -1,38 +1,19 @@
[PoolSet.sql]
-select p.pool as id, p.name, j.jobs
-from
- (select pool, name
- from collector
- group by pool, name) as p
-left outer join
- (select s.pool, count(*) as jobs
- from job j
- left outer join scheduler as s on j.scheduler_id = s.id
- group by s.pool) as j
- on j.pool = p.pool
+select
+ p.pool as id,
+ p.name,
+ c.running_jobs,
+ c.idle_jobs,
+ c.hosts_total as slots
+from collector as p
+left outer join collector_stats as c on c.id = p.stats_curr_id
+{sql_where}
[PoolSet.count_sql]
select count(*)
-from
- (select 1 from collector group by pool) as l
-
-[PoolJobStats.sql]
-select
- sum(case when job_status=2 then 1 else 0 end) as running,
- sum(case when job_status=4 then 1 else 0 end) as completed,
- sum(case when job_status=5 then 1 else 0 end) as held,
- sum(case when job_status=1 and j.qmf_delete_time is null then 1 else 0 end) as idle,
- sum(case when job_status=3 or (job_status=1 and j.qmf_delete_time is not null) then 1
else 0 end) as removed,
- sum(1) as total,
- s.pool
-from job as j
-left outer join scheduler as s on s.id = j.scheduler_id
+from collector as p
{sql_where}
-group by s.pool
-[PoolJobStats.count_sql]
-1
-
[PoolOverview.css]
div#PoolOverview div.col1, div#PoolOverview div.col2 {
float: left;