Author: eallen
Date: 2009-04-27 16:09:20 -0400 (Mon, 27 Apr 2009)
New Revision: 3334
Modified:
mgmt/trunk/cumin/python/cumin/grid/pool.py
mgmt/trunk/cumin/python/cumin/grid/pool.strings
Log:
Added stats and charts for Grid
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-04-27 20:08:56 UTC (rev 3333)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.py 2009-04-27 20:09:20 UTC (rev 3334)
@@ -288,15 +288,68 @@
def __init__(self, app, name):
super(PoolStats, self).__init__(app, name)
- stats = PoolStatSet(app, "general", "general")
+ stats = PoolStatSet(app, "slot_stats", "general")
self.add_child(stats)
- self.slot_map = self.PoolSlotMap(app, "pool_slot_map")
- self.add_child(self.slot_map)
+ stats = self.GridStats(app, "grid_stats")
+ self.add_child(stats)
+ slot_map = self.PoolSlotMap(app, "pool_slot_map")
+ self.add_child(slot_map)
+
def render_title(self, session):
- return "Statistics"
+ return "Overview"
+ def render_pool_name(self, session):
+ pool = self.frame.get_args(session)[0]
+ return pool.name
+
+ class GridStats(Widget):
+ def __init__(self, app, name):
+ super(PoolStats.GridStats, self).__init__(app, name)
+
+ stats = self.GridStatSet(app, "stats", "general")
+ self.add_child(stats)
+
+ chart = self.GridJobChart(app, "jobs_chart")
+ chart.stats = ("NumJobs", "RunningJobs",
"IdleJobs")
+ self.add_child(chart)
+
+ chart = self.GridSubmitChart(app, "submit_chart")
+ chart.stats = ("SubmitsAllowed", "SubmitsQueued",
"SubmitsInProgress")
+ self.add_child(chart)
+
+ def get_grid_args(self, session):
+ pool = self.frame.get_args(session)[0]
+ return Grid.select("pool='%s'" % pool.id)
+
+ def render_grid_name(self, session):
+ grid = self.get_grid_args(session)[0]
+ return grid.Name
+
+ def render(self, session):
+ grid = self.get_grid_args(session)
+ if grid.count() > 0:
+ return super(PoolStats.GridStats, self).render(session)
+
+ class GridJobChart(StatValueChart):
+ def render_title(self, session, object):
+ return "Grid Jobs"
+
+ def get_args(self, session):
+ return self.parent.get_grid_args(session)
+
+ class GridSubmitChart(StatValueChart):
+ def render_title(self, session, object):
+ return "Grid Submits"
+
+ def get_args(self, session):
+ return self.parent.get_grid_args(session)
+
+ class GridStatSet(StatSet):
+ def get_args(self, session):
+ return self.parent.get_grid_args(session)
+
class PoolSlotMap(SlotMap):
def get_title_name(self, session, pool):
return pool.name
@@ -305,7 +358,7 @@
return 400
class PoolStatSet(StatSet):
- def render_rate_text(self, session, args):
+ def render_rate_text(self, session, *args):
return "Percentage"
def do_get_items(self, session, pool):
Modified: mgmt/trunk/cumin/python/cumin/grid/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-04-27 20:08:56 UTC (rev 3333)
+++ mgmt/trunk/cumin/python/cumin/grid/pool.strings 2009-04-27 20:09:20 UTC (rev 3334)
@@ -45,14 +45,32 @@
<span>{idle}</span> of <span>{total}</span> slots idle
</div>
+[PoolStats.css]
+div#poolStats div.col1, div#poolStats div.col2 {
+ float: left;
+ width: 47%;
+}
+div#poolStats div.col1 {
+ padding-right: 2em;
+}
+
[PoolStats.html]
-<div style="width: 40%; float: left;">
- <h2>General</h2>
- <div>
- {general}
- </div>
+<div id="poolStats">
+<div class="col1">
+ <h2>Stats for Pool {pool_name}</h2>
+ {slot_stats}
+ {grid_stats}
</div>
-<div style="float: left; margin-left: 4em;">
+<div class="col2">
{pool_slot_map}
</div>
+</div>
<div style="clear:left;"><!-- --></div>
+
+[GridStats.html]
+ <h2>Stats for Grid {grid_name}</h2>
+ {stats}
+ <blockquote>
+ {jobs_chart}
+ {submit_chart}
+ </blockquote>
\ No newline at end of file