Author: croberts
Date: 2012-11-05 22:00:06 +0000 (Mon, 05 Nov 2012)
New Revision: 5539
Modified:
branches/croberts/cumin/bin/cumin-web
branches/croberts/cumin/python/cumin/config.py
branches/croberts/cumin/python/cumin/grid/dashboard.py
branches/croberts/cumin/python/cumin/grid/dashboard.strings
branches/croberts/cumin/python/cumin/model.py
branches/croberts/cumin/python/cumin/stat.py
branches/croberts/cumin/python/cumin/stat.strings
Log:
Changes to detect plumage presence (or lack thereof). The dashboard summary will display
a plumage-based chart if available.
Modified: branches/croberts/cumin/bin/cumin-web
===================================================================
--- branches/croberts/cumin/bin/cumin-web 2012-11-05 19:14:12 UTC (rev 5538)
+++ branches/croberts/cumin/bin/cumin-web 2012-11-05 22:00:06 UTC (rev 5539)
@@ -74,6 +74,10 @@
cumin.kerberos_server = values.kerberos_server
cumin.kerberos_realm = values.kerberos_realm
+def set_plumage_configs(cumin, values):
+ cumin.plumage_host = values.plumage_host
+ cumin.plumage_port = values.plumage_port
+
def check_cert_files(opts):
# If a certificate or key file has been specified,
# check to make sure that both exist and that the
@@ -219,6 +223,7 @@
set_wallaby_configs(cumin, values, broker_uris)
set_ldap_configs(cumin, values)
set_kerberos_configs(cumin, values)
+ set_plumage_configs(cumin, values)
# Not used right now
#cumin.auth_create_ondemand = values.auth_create_ondemand
Modified: branches/croberts/cumin/python/cumin/config.py
===================================================================
--- branches/croberts/cumin/python/cumin/config.py 2012-11-05 19:14:12 UTC (rev 5538)
+++ branches/croberts/cumin/python/cumin/config.py 2012-11-05 22:00:06 UTC (rev 5539)
@@ -161,6 +161,14 @@
param = ConfigParameter(self, "debug", bool)
param.default = False
+
+ param = ConfigParameter(self, "plumage_host", str)
+ param.default = "localhost"
+
+ param = ConfigParameter(self, "plumage_port", int)
+ param.default = 27017
+
+
class BrokeredConfigSection(CuminConfigSection):
def __init__(self, config, name, strict_section=False):
@@ -289,12 +297,6 @@
super(CuminReportConfigSection, self).__init__(config, name,
strict_section)
- param = ConfigParameter(self, "plumage_host", str)
- param.default = "localhost"
-
- param = ConfigParameter(self, "plumage_port", int)
- param.default = 27017
-
class CuminOptionParser(OptionParser,object):
def __init__(self):
OptionParser.__init__(self)
Modified: branches/croberts/cumin/python/cumin/grid/dashboard.py
===================================================================
--- branches/croberts/cumin/python/cumin/grid/dashboard.py 2012-11-05 19:14:12 UTC (rev
5538)
+++ branches/croberts/cumin/python/cumin/grid/dashboard.py 2012-11-05 22:00:06 UTC (rev
5539)
@@ -17,7 +17,9 @@
ObjectLinkColumn, CsvStatsExporter, ExportButton, MonitorSelfAgeColumn
from cumin.parameters import YoungestAttribute
from cumin.util import rgb_to_string, xml_escape
+from cumin.model import PlumageChecker
+
strings = StringCatalog(__file__)
log = logging.getLogger("cumin.dashboard")
@@ -94,10 +96,6 @@
def render_title(self, session):
return "Pool memory"
- class PoolCpuChart(ReportingChart):
- def render_title(self, session):
- return "Pool cpus"
-
class PoolEfficiencyChart(ReportingChart):
def render_title(self, session):
return "Pool efficiency"
@@ -117,8 +115,19 @@
job_data = DashboardOverviewJobSummary(app, "job_info")
self.add_child(job_data)
- slot_data = GridSlotsSummary(app, "host_info", collector)
- self.add_child(slot_data)
+ plumageChecker = PlumageChecker(app)
+ havePlumage = plumageChecker.isPlumageAvailable()
+
+ if havePlumage:
+ chart = self.PoolCpuChart(app, "host_info",
app.model.com_redhat_grid_plumage.OSUtil)
+ chart.stats = [ "usedcpu", "freecpu"]
+ chart.max_samples = 250
+ chart.duration.param.default = "86400"
+ chart.chart_type = "stacked"
+ self.add_child(chart)
+ else:
+ slot_data = GridSlotsSummary(app, "host_info", collector)
+ self.add_child(slot_data)
neg_through = NegotiatorJobThroughput(app, "negotiator_throughput")
self.add_child(neg_through)
@@ -135,6 +144,10 @@
def render_title(self, session):
return "Summary"
+ class PoolCpuChart(ReportingChart):
+ def render_title(self, session):
+ return "Pool cpus"
+
class DashboardPerformance(Widget):
def __init__(self, app, name):
super(DashboardPerformance, self).__init__(app, name)
Modified: branches/croberts/cumin/python/cumin/grid/dashboard.strings
===================================================================
--- branches/croberts/cumin/python/cumin/grid/dashboard.strings 2012-11-05 19:14:12 UTC
(rev 5538)
+++ branches/croberts/cumin/python/cumin/grid/dashboard.strings 2012-11-05 22:00:06 UTC
(rev 5539)
@@ -7,6 +7,11 @@
</div>
<div style="clear:both;"></div>
+[DashboardSummary.css]
+div.DashboardSummary div.ReportingStatValueChart {
+ float:left;
+}
+
[MonitorSelfStats.css]
div.MonitorSelfStats div.data {
margin-left: 2em;
Modified: branches/croberts/cumin/python/cumin/model.py
===================================================================
--- branches/croberts/cumin/python/cumin/model.py 2012-11-05 19:14:12 UTC (rev 5538)
+++ branches/croberts/cumin/python/cumin/model.py 2012-11-05 22:00:06 UTC (rev 5539)
@@ -962,3 +962,18 @@
class NegotiatorStaticGroupConfigValuesStore(NegotiatorGroupConfigValuesStore):
def __init__(self, model, negotiator, groups, config):
super(NegotiatorStaticGroupConfigValuesStore, self).__init__(model, negotiator,
groups, config)
+
+# Utility class to check for the plumage (data store)
+class PlumageChecker(object):
+ def __init__(self, app):
+ self.app = app
+
+ def isPlumageAvailable(self):
+ plumageAvail = False
+ try:
+ from pymongo import Connection
+ self.connection = Connection(self.app.plumage_host, self.app.plumage_port)
+ plumageAvail = True
+ except:
+ log.info("No plumage data store connection achieved.")
+ return plumageAvail
\ No newline at end of file
Modified: branches/croberts/cumin/python/cumin/stat.py
===================================================================
--- branches/croberts/cumin/python/cumin/stat.py 2012-11-05 19:14:12 UTC (rev 5538)
+++ branches/croberts/cumin/python/cumin/stat.py 2012-11-05 22:00:06 UTC (rev 5539)
@@ -313,6 +313,11 @@
return "leftlegend"
return ""
+ def render_legendmargin(self, session):
+ if not self.leftlegend:
+ return "legendmargin"
+ return ""
+
def render_filters(self, session):
filtertext = ""
for f in self.filters:
@@ -1277,14 +1282,14 @@
return self.app.database.get_read_connection()
class StackedAreaChart(AreaChart):
- colors = ('#FFABAB', '#ABABFF', '#ABFFAB', '#FFABFF',
'#FFFFAB', '#ABFFFF', '#ABABAB')
def __init__(self, app, name, page):
super(StackedAreaChart, self).__init__(app, name, page)
self.points = self.Points(app, "points")
self.add_attribute(self.points)
- self.alpha = 1
+ self.fillAlpha = 0.7
+ self.fillAndStroke = False
self.stackSeries = True
# removed get_vals method since the new way of rendering stacked charts
Modified: branches/croberts/cumin/python/cumin/stat.strings
===================================================================
--- branches/croberts/cumin/python/cumin/stat.strings 2012-11-05 19:14:12 UTC (rev 5538)
+++ branches/croberts/cumin/python/cumin/stat.strings 2012-11-05 22:00:06 UTC (rev 5539)
@@ -137,6 +137,30 @@
}
[StatValueChart.css]
+/* This gives us a left justified 'n' position for our legend, just have the
container div use the leftlegend class */
+div.leftlegend>table.jqplot-table-legend{
+ left:0px !important;
+}
+
+.jqplot-cursor-tooltip {
+ border: 1px solid #cccccc;
+ font-size: 0.75em;
+ white-space: nowrap;
+ background: rgba(255,255,255,0.9);
+ padding: 1px;
+ z-index:10;
+}
+
+.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
+ border: 1px solid #cccccc;
+ font-size: 0.75em;
+ white-space: nowrap;
+ background: rgba(255,255,255,0.9);
+ padding: 1px;
+ z-index:10;
+}
+
+
div.StatValueChart {
font-size: 0.9em;
margin: 0 0 1.5em 0;
@@ -349,7 +373,7 @@
<div>
<!-- don't put this data url inside the holder div, jqplot will kill it
on a zoom -->
<a rel="api" type="application/json"
href="{href}" style="display:none">Data</a>
- <div id="{id_nodots}_chart" class="jqplotgraph
{leftlegend}" style="height:{height}px;width:{width}px;">
+ <div id="{id_nodots}_chart" class="jqplotgraph {leftlegend}
{legendmargin}" style="height:{height}px;width:{width}px;">
<div class="loading"
style="display:none;"><span>Loading...</span></div>
</div>
</div>
@@ -360,7 +384,7 @@
</div>
[ReportingChart.css]
-div.ReportingStatValueChart div.jqplotgraph table.jqplot-table-legend {
+div.ReportingStatValueChart div.legendmargin table.jqplot-table-legend {
margin-left: 30px;
}