rhmessaging commits: r2702 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:30:27 -0400 (Wed, 29 Oct 2008)
New Revision: 2702
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Added methods to update slot and job grids using ajax.
Checking in Irina's changes for syscon, auth, fedid for connections.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-29 20:29:37 UTC (rev 2701)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-29 20:30:27 UTC (rev 2702)
@@ -59,6 +59,7 @@
# Systems
CuminSystem(self)
+ CuminSlot(self)
def check(self):
self.data.check()
@@ -523,6 +524,31 @@
prop.title = "Last Updated"
prop.summary = True
+class CuminSlot(RemoteClass):
+ def __init__(self, model):
+ super(CuminSlot, self).__init__(model, "slot", Slot, SlotStats)
+
+ prop = CuminProperty(self, "Name")
+ prop.title = "Name"
+
+ prop = CuminProperty(self, "Machine")
+ prop.title = "Machine"
+
+ prop = CuminProperty(self, "JobId")
+ prop.title = "Current Job Id"
+
+ stat = CuminStat(self, "Activity")
+ stat.title = "Activity"
+ stat.category = "general"
+
+ stat = CuminStat(self, "CondorLoadAvg")
+ stat.title = "Condor Load Avg"
+ stat.category = "general"
+
+ stat = CuminStat(self, "LoadAvg")
+ stat.title = "Load Avg"
+ stat.category = "general"
+
class CuminSystem(RemoteClass):
def __init__(self, model):
super(CuminSystem, self).__init__(model, "system", System, SystemStats)
@@ -546,6 +572,9 @@
prop = CuminProperty(self, "machine")
prop.title = "Architecture"
+ action = self.VisSlots(self, "slots")
+ action.navigable = False
+
#action = CuminAction(self, "ping")
#action.title = "Send Ping"
#action.summary = True
@@ -562,6 +591,44 @@
def get_object_name(self, object):
return object.nodeName
+ class VisSlots(CuminAction):
+ load_colors = {"Idle": "clear",
+ "Busy": "green",
+ "Suspended": "red",
+ "Vacating": "red",
+ "Killing": "blue",
+ "Benchmarking": "yellow" }
+ def do_invoke(self, system, *args):
+ slots = self.get_slots(system)[0]
+ writer = Writer()
+ writer.write("<slots>")
+ for slot in slots:
+ writer.write("<slot id='%i' name='%s' machine='%s' job='%s' color='%s'/>" % \
+ (slot.sourceObjectId,
+ slot.Name,
+ slot.Machine,
+ slot.JobId,
+ self.get_color(slot)))
+ writer.write("</slots>")
+ return writer.to_string()
+
+ def get_slots(self, system):
+ elems = list()
+ elems.append("machine = '%s'" % system.nodeName)
+ elems.append("rec_time > now() - interval '90 minutes'")
+ elems.append("deletion_time is null")
+ sql = " and ".join(elems)
+ return (Slot.select(sql), )
+
+ def get_color(self, slot):
+ activity = slot.statsCurr.Activity
+ if activity in self.load_colors:
+ return self.load_colors[activity]
+ return "black"
+
+ def get_colors(self):
+ return self.load_colors
+
class SystemIdProperty(CuminProperty):
def value(self, session, object):
val = super(CuminSystem.SystemIdProperty, self).value(session, object)
@@ -1159,6 +1226,15 @@
prop = CuminProperty(self, "address")
prop.title = "Address"
+ prop = CuminProperty(self, "SystemConnection")
+ prop.title = "System Connection?"
+
+ prop = CuminProperty(self, "authIdentity")
+ prop.title = "Auth Identity?"
+
+ prop = CuminProperty(self, "federationLink")
+ prop.title = "Federation Link"
+
stat = CuminStat(self, "closing")
stat.title = "Closing Down"
stat.category = "general"
@@ -1716,6 +1792,9 @@
stat = CuminStat(self, "Jobs")
stat.title = "Total Jobs"
+ action = self.VisJobs(self, "jobs")
+ action.navigable = False
+
def init(self):
self.frame = self.model.frame.pool
@@ -1730,6 +1809,48 @@
return title
+ class VisJobs(CuminAction):
+ def do_invoke(self, pool, *args):
+ pool = self.model.get_main_pool()
+ jobs = self.get_jobs(pool)[0]
+ writer = Writer()
+ writer.write("<jobs>")
+ for job in jobs:
+ status = self.get_status(job)
+ writer.write("<job id='%i' name='%s' submitter='%s' status='%s' color='%s'/>" % \
+ (job.sourceObjectId,
+ job.CustomId,
+ job.submitter.Name,
+ JobStatusInfo.get_status_string(status),
+ self.get_color(job)))
+ writer.write("</jobs>")
+ return writer.to_string()
+
+ def get_jobs(self, pool):
+ elems = list()
+ elems.append("job.rec_time > now() - interval '90 minutes'")
+ #elems.append("job.deletion_time is null and job_status != %i" % JobStatusInfo.get_status_int("Removed"))
+ elems.append("s.pool = '%s'" % pool.id)
+ sql = " and ".join(elems)
+ jn = "inner join scheduler as s on s.id = scheduler_id"
+ return (Job.select(sql, join=jn).orderBy("custom_id"), )
+
+ def get_status(self, job):
+ status = job.JobStatus
+ if status != JobStatusInfo.get_status_int("Completed") and job.deletionTime:
+ status = JobStatusInfo.get_status_int("Removed")
+ return status
+
+ def get_color(self, job):
+ status = self.get_status(job)
+ color = JobStatusInfo.get_status_color(status)
+ if "Idle" == JobStatusInfo.get_status_string(status):
+ color = "clear"
+ return color
+
+ def get_colors(self):
+ return JobStatusInfo.get_zipped_colors()
+
class CuminLimit(CuminClass):
def __init__(self, model):
super(CuminLimit, self).__init__ \
@@ -2507,7 +2628,7 @@
self.__args = Parameter(app, "xargs")
self.add_parameter(self.__args)
-
+
def get_content_type(self, session):
return Page.xml_content_type
16 years, 2 months
rhmessaging commits: r2701 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:29:37 -0400 (Wed, 29 Oct 2008)
New Revision: 2701
Modified:
mgmt/trunk/cumin/python/cumin/client.py
mgmt/trunk/cumin/python/cumin/client.strings
Log:
Checking in Irina's changes for syscon, auth, fedid for connections.
Modified: mgmt/trunk/cumin/python/cumin/client.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.py 2008-10-29 20:28:32 UTC (rev 2700)
+++ mgmt/trunk/cumin/python/cumin/client.py 2008-10-29 20:29:37 UTC (rev 2701)
@@ -23,6 +23,15 @@
self.set_default_column(col)
+ col = self.SystemConnectionColumn(app, "sysconn")
+ self.add_column(col)
+
+ col = self.AuthIdentityColumn(app, "authid")
+ self.add_column(col)
+
+ col = self.FedLinkColumn(app, "fedlink")
+ self.add_column(col)
+
col = self.SentColumn(app, "sent")
col.alignment = "right"
self.add_column(col)
@@ -81,6 +90,30 @@
href = self.frame.connection.get_href(session, conn)
return fmt_link(href, fmt_shorten(data["addr"]))
+ class SystemConnectionColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Connect Type"
+
+ def render_content(self, session, data):
+ if data['sysconn']:
+ return "System"
+ else:
+ return "Client"
+
+ class AuthIdentityColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Auth Id"
+
+ class FedLinkColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Fed Link"
+
+ def render_content(self, session, data):
+ if data['fedlink']:
+ return "Yes"
+ else:
+ return "No"
+
class SentColumn(NullSortColumn, FreshDataOnlyColumn):
def render_title(self, session, data):
return "%s Sent" % self.parent.get_unit_plural(session)
Modified: mgmt/trunk/cumin/python/cumin/client.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.strings 2008-10-29 20:28:32 UTC (rev 2700)
+++ mgmt/trunk/cumin/python/cumin/client.strings 2008-10-29 20:29:37 UTC (rev 2701)
@@ -1,6 +1,9 @@
[ConnectionSet.sql]
select
l.id,
+ l.system_connection as sysconn,
+ l.auth_identity as authid,
+ l.federation_link as fedlink,
l.address as addr,
(c.bytes_from_client - p.bytes_from_client)
/ (extract(epoch from (c.rec_time - p.rec_time)) + 0.0001) as bs,
16 years, 2 months
rhmessaging commits: r2700 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:28:32 -0400 (Wed, 29 Oct 2008)
New Revision: 2700
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Changed some status colors
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-29 20:24:51 UTC (rev 2699)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-29 20:28:32 UTC (rev 2700)
@@ -1256,7 +1256,7 @@
class JobStatusInfo(object):
stat_strings = ["Unexpanded", "Idle", "Running", "Removed", "Completed", "Held", "Submission Error"]
- stat_colors = ["red", "green", "green", "green", "green", "yellow", "red"]
+ stat_colors = ["red", "clear", "green", "black", "blue", "yellow", "red"]
@classmethod
def get_status_string(cls, stat):
try:
@@ -1277,4 +1277,10 @@
return cls.stat_strings.index(stat)
except:
return -1
-
+
+ @classmethod
+ def get_zipped_colors(cls):
+ colors = dict()
+ for stat in cls.stat_strings:
+ colors[stat] = cls.stat_colors[cls.stat_strings.index(stat)]
+ return colors
\ No newline at end of file
16 years, 2 months
rhmessaging commits: r2699 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:24:51 -0400 (Wed, 29 Oct 2008)
New Revision: 2699
Modified:
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/pool.strings
Log:
Added job status grid on pool statistics page
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-29 20:24:01 UTC (rev 2698)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-10-29 20:24:51 UTC (rev 2699)
@@ -252,9 +252,59 @@
stats = PoolStatSet(app, "general", "general")
self.add_child(stats)
+ self.grid = self.JobUtilizationGrid(app, "job_grid")
+ self.add_child(self.grid)
+
def render_title(self, session):
return "Statistics"
+ class JobUtilizationGrid(StatUtilizationGrid):
+ def get_args(self, session):
+ pool = self.frame.get_args(session)[0]
+ action = self.app.model.pool.jobs
+ return action.get_jobs(pool)
+
+ def render_title(self, session, jobs):
+ return ""
+
+ def get_object_count(self, session, jobs):
+ return jobs.count()
+
+ def render_override_style(self, session, jobs):
+ count = self.get_object_count(session, jobs)
+ if count > 100:
+ return "style=\"width: 15em; height: 15em;\""
+
+ def get_colors(self, session):
+ action = self.app.model.pool.jobs
+ return action.get_colors()
+
+ def render_color(self, session, count, job):
+ action = self.app.model.pool.jobs
+ return action.get_color(job)
+
+ def render_contents(self, session, count, job):
+ return ""
+
+ def render_cell_id(self, session, count, job):
+ return "%i" % job.sourceObjectId
+
+ def get_url(self, session):
+ pool = self.parent.frame.get_args(session)[0]
+ return "call.xml?class=pool;method=jobs"
+
+ def get_fn(self, session):
+ return self.parent.grid.name
+
+ def got_fn(self, session):
+ return self.parent.grid.name
+
+ def elem_id(self, session):
+ return self.parent.grid.name
+
+ def do_get_sticky_info(self, session):
+ return [("name", "ID"), ("submitter", "Submitter"), ("status", "Status")]
+
class PoolStatSet(StatSet):
def __init__(self, app, name, category):
super(PoolStatSet, self).__init__(app, name, category)
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-29 20:24:01 UTC (rev 2698)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-29 20:24:51 UTC (rev 2699)
@@ -22,7 +22,40 @@
</div>
[PoolStats.html]
+<div style="width: 50%; float: left;">
<h2>General</h2>
- <div style="width:50%;">
+ <div>
{general}
</div>
+</div>
+<div style="width: 25%; float: left; margin-left: 4em;">
+ <h2>Job Activity</h2>
+ {job_grid}
+</div>
+<div style="clear:left;"><!-- --></div>
+
+
+[JobUtilizationGrid.javascript]
+function got_job_grid(obj, id) {
+ for (var cell in obj.jobs.job) {
+ var job = obj.jobs.job[cell]
+ var ojob_Button = document.getElementById("button_"+cell);
+ if (ojob_Button) {
+ ojob_Button.className = "btn "+job.color;
+ }
+ var ojob_Name = document.getElementById("cell_name_"+cell);
+ if (ojob_Name) {
+ ojob_Name.innerHTML = job.name;
+ }
+ var ojob_Machine = document.getElementById("cell_submitter_"+cell);
+ if (ojob_Machine) {
+ ojob_Machine.innerHTML = job.submitter;
+ }
+ var ojob_Job = document.getElementById("cell_status_"+cell);
+ if (ojob_Job) {
+ ojob_Job.innerHTML = job.status;
+ }
+ }
+ setTimeout("get_job_grid()", 1000);
+}
+
16 years, 2 months
rhmessaging commits: r2698 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:24:01 -0400 (Wed, 29 Oct 2008)
New Revision: 2698
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Add a new stat type: grid. Used to display a grid of child objects and their state/status
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-10-29 20:22:50 UTC (rev 2697)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-10-29 20:24:01 UTC (rev 2698)
@@ -140,6 +140,134 @@
def render_stat_name(self, session, stat, object):
return stat.name
+class StatUtilizationGrid(Widget):
+ def __init__(self, app, name):
+ super(StatUtilizationGrid, self).__init__(app, name)
+
+ self.stats_tmpl = Template(self, "cell_html")
+ self.sticky_names_tmpl = Template(self, "sticky_name_html")
+ self.sticky_values_tmpl = Template(self, "sticky_value_html")
+ self.legend_tmpl = Template(self, "legend_html")
+
+ self.ajax = self.Updater(app, "grid_updater")
+ self.add_child(self.ajax)
+
+ def get_args(self, session):
+ """ must return a sequence """
+ return list()
+
+ def render_title(self, session, objects):
+ return "Utilization"
+
+ def render_grid(self, session, objects):
+ writer = Writer()
+
+ count = self.get_object_count(session, objects)
+ for object in objects:
+ self.stats_tmpl.render(writer, session, count, object)
+ return writer.to_string()
+
+ def get_object_count(self, objects):
+ return len(objects)
+
+ def render_override_style(self, session, objects):
+ pass
+
+ def render_legends(self, session, slots):
+ colors = self.get_colors(session)
+ writer = Writer()
+
+ sorted_keys = sorted(colors.keys())
+ for key in sorted_keys:
+ self.legend_tmpl.render(writer, session, colors, key)
+ return writer.to_string()
+
+ def render_legend_color(self, session, colors, key):
+ return colors[key]
+
+ def render_legend_text(self, session, colors, key):
+ return key
+
+ def render_cell_width(self, session, count, object):
+ sq = sqrt(count)
+ isq = int(sq)
+ if sq > isq:
+ isq = isq + 1
+
+ if count > 0:
+ return int(100 / isq)
+ else:
+ return 100
+
+ def render_color(self, session, count, object):
+ return "clear"
+
+ def render_contents(self, session, count, object):
+ return ""
+
+ def render_cell_id(self, session, count, object):
+ return 1
+
+ def get_url(self, session):
+ """ returns something like
+ "call.xml?class=system;id=%i;method=slots" % system.id
+ """
+ pass
+
+ def get_fn(self, session):
+ return self.ajax.name
+
+ def got_fn(self, session):
+ return self.ajax.name
+
+ def elem_id(self, session):
+ return self.ajax.name
+
+ def render_sticky_names(self, session, count, object):
+ names = self.do_get_sticky_info(session)
+ writer = Writer()
+
+ for name, desc in names:
+ self.sticky_names_tmpl.render(writer, session, desc)
+ return writer.to_string()
+
+ def render_sticky_title(self, session, desc):
+ return desc
+
+ def render_sticky_values(self, session, count, object):
+ names = self.do_get_sticky_info(session)
+ writer = Writer()
+
+ for name, desc in names:
+ self.sticky_values_tmpl.render(writer, session, name, object)
+ return writer.to_string()
+
+ def render_sticky_name(self, session, name, object):
+ return name
+
+ def render_sticky_object_id(self, session, name, object):
+ return self.render_cell_id(session, 1, object)
+
+ def do_get_sticky_info(self, session):
+ return [("Name", "Display Title")]
+
+ class Updater(AjaxField):
+ def do_render(self, session):
+ return self.render_script(session)
+
+ def get_url(self, session):
+ return self.parent.get_url(session)
+
+ def get_fn(self, session):
+ return self.parent.get_fn(session)
+
+ def got_fn(self, session):
+ return self.parent.got_fn(session)
+
+ def elem_id(self, session):
+ return self.parent.elem_id(session)
+
+
class StatChartPage(Page):
def __init__(self, app, name):
super(StatChartPage, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-10-29 20:22:50 UTC (rev 2697)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-10-29 20:24:01 UTC (rev 2698)
@@ -164,3 +164,113 @@
<span class="swatch" style="background-color: {stat_color}"> </span>
<span class="ph" statname="{stat_name}" statmode="{mode}">{stat_value}</span>
</li>
+
+[StatUtilizationGrid.css]
+div.StatGrid{
+ width: 10em;
+ height: 10em;
+}
+div.grid_cell {
+ float:left;
+ position: relative;
+}
+div.grid_cell button {
+ width:95%;
+ height:95%;
+}
+.btn.yellow { background: #ffc; }
+.btn.green { background: #cfc; }
+.btn.blue { background: #ccf; }
+.btn.red { background: #fcc; }
+.btn.black { background: #444; }
+.btn.clear { background: white; }
+.btn:hover { border: 1px solid #a00; }
+.btn:active { background-color: #444; }
+.btn[class] { background-image: url(resource?name=shade1.png); background-position: bottom; }
+
+div.visualization {
+ padding-right: 2em;
+}
+
+div.StatUtilizationGrid {
+ margin-top: 1em;
+ margin-left: 1em;
+}
+
+div.grid_cell div.sticky_note {
+ display: none;
+ position: absolute;
+ top: 60%;
+ left: 100%;
+ width: 24em;
+ padding: 1em;
+ background-color: #ffffaa;
+ background-image: url(resource?name=shade.png);
+ background-position: bottom right;
+ background-repeat: repeat-x;
+ border: 1px solid #cccc99;
+ z-index: 1;
+}
+div.sticky_names {
+ float: left;
+ font-weight: bold;
+ line-height: 1em;
+ margin-right: 1em;
+}
+div.sticky_values {
+ float: left;
+ line-height: 1em;
+}
+div#cell_legend {
+ margin: 1em;
+ font-size: 0.8em;
+ color: #000;
+}
+div#cell_legend button {
+ position: relative;
+ top: -2px;
+}
+
+[StatUtilizationGrid.html]
+<div class="StatUtilizationGrid" id="{id}">
+ <div class="visualization">
+ <h2>{title}</h2>
+ <div class="StatGrid" {override_style}>
+ {grid}
+ </div>
+ <div style="clear:left;"><!-- --></div>
+ </div>
+</div>
+<div id="cell_legend">
+ {legends}
+</div>
+{grid_updater}
+
+[StatUtilizationGrid.legend_html]
+<div class="legend">
+ <button class="btn {legend_color}" style="background-image: none; width:1em; height:1em;"/> {legend_text}
+</div>
+
+[StatUtilizationGrid.cell_html]
+ <div class="grid_cell" style="width:{cell_width}%; height:{cell_width}%;"
+ onmouseover="document.getElementById('note_{cell_id}').style.display='block';"
+ onmouseout="document.getElementById('note_{cell_id}').style.display='none';">
+ <a href="#"><button id="button_{cell_id}" class="btn {color}" >{contents}</button></a>
+ <div id="note_{cell_id}" class="sticky_note">
+ <div class="sticky_names">
+ {sticky_names}
+ </div>
+ <div class="sticky_values">
+ {sticky_values}
+ </div>
+ <div style="clear:left;"><!-- --></div>
+ </div>
+ </div>
+
+[StatUtilizationGrid.sticky_name_html]
+ <div>{sticky_title}:</div>
+
+[StatUtilizationGrid.sticky_value_html]
+ <div id="cell_{sticky_name}_{sticky_object_id}"></div>
+
+
\ No newline at end of file
16 years, 2 months
rhmessaging commits: r2697 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:22:50 -0400 (Wed, 29 Oct 2008)
New Revision: 2697
Modified:
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/system.strings
Log:
Added slot visualization grid
Don't show orphaned slots (not updated in last 10 minutes)
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-29 20:20:00 UTC (rev 2696)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-29 20:22:50 UTC (rev 2697)
@@ -2,6 +2,7 @@
from wooly import *
from wooly.widgets import *
+from stat import *
from widgets import *
from parameters import *
from formats import *
@@ -47,6 +48,58 @@
class SystemStatus(CuminStatus):
pass
+class SystemStats(Widget):
+ def __init__(self, app, name):
+ super(SystemStats, self).__init__(app, name)
+
+ self.grid = self.SlotUtilizationGrid(app, "slot_grid")
+ self.add_child(self.grid)
+
+ def render_title(self, session):
+ return "Statistics"
+
+ class SlotUtilizationGrid(StatUtilizationGrid):
+ def get_args(self, session):
+ system = self.frame.get_args(session)[0]
+ action = self.app.model.system.slots
+ return action.get_slots(system)
+
+ def render_title(self, session, slots):
+ return "Slot Utilization"
+
+ def get_object_count(self, session, slots):
+ return slots.count()
+
+ def get_colors(self, session):
+ action = self.app.model.system.slots
+ return action.get_colors()
+
+ def render_color(self, session, count, slot):
+ action = self.app.model.system.slots
+ return action.get_color(slot)
+
+ def render_contents(self, session, count, slot):
+ return ""
+
+ def render_cell_id(self, session, count, slot):
+ return "%i" % slot.sourceObjectId
+
+ def get_url(self, session):
+ system = self.parent.frame.get_args(session)[0]
+ return "call.xml?class=system;id=%i;method=slots" % system.id
+
+ def get_fn(self, session):
+ return self.parent.grid.name
+
+ def got_fn(self, session):
+ return self.parent.grid.name
+
+ def elem_id(self, session):
+ return self.parent.grid.name
+
+ def do_get_sticky_info(self, session):
+ return [("name", "Name"), ("machine", "Machine"), ("job", "Job")]
+
class SystemView(CuminView):
def __init__(self, app, name):
super(SystemView, self).__init__(app, name)
@@ -60,6 +113,7 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
+ self.__tabs.add_tab(SystemStats(app, "stats"))
self.__tabs.add_tab(SystemJobSet(app, "jobs"))
self.__tabs.add_tab(SystemSlotSet(app, "slots"))
self.__tabs.add_tab(CuminDetails(app, "details"))
@@ -81,14 +135,17 @@
class SystemSlotSet(SlotSet):
def get_args(self, session):
return self.frame.get_args(session)
-
+
def render_title(self, session, system):
- sql = "machine = '%s'" % system.nodeName
- return "Grid Slots %s" % fmt_count(Slot.select(sql).count())
+ return "Grid Slots %s" % fmt_count(self.get_item_count(session, system))
def render_sql_where(self, session, system):
- return "where s.machine = %(system_name)s"
+ elems = list()
+ elems.append("machine = %(nodeName)s")
+ elems.append("s.rec_time > now() - interval '90 minutes'")
+ elems.append("deletion_time is null")
+ return "where %s" % " and ".join(elems)
def get_sql_values(self, session, system):
- return {"system_name": system.nodeName}
+ return {"nodeName": system.nodeName}
Modified: mgmt/trunk/cumin/python/cumin/system.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.strings 2008-10-29 20:20:00 UTC (rev 2696)
+++ mgmt/trunk/cumin/python/cumin/system.strings 2008-10-29 20:22:50 UTC (rev 2697)
@@ -23,3 +23,28 @@
</table>
<div>{hidden_inputs}</div>
</form>
+
+[SlotUtilizationGrid.javascript]
+function got_slot_grid(obj, id) {
+ for (var cell in obj.slots.slot) {
+ var slot = obj.slots.slot[cell]
+ var oslot_Button = document.getElementById("button_"+cell);
+ if (oslot_Button) {
+ oslot_Button.className = "btn "+slot.color;
+ }
+ var oslot_Name = document.getElementById("cell_name_"+cell);
+ if (oslot_Name) {
+ oslot_Name.innerHTML = slot.name;
+ }
+ var oslot_Machine = document.getElementById("cell_machine_"+cell);
+ if (oslot_Machine) {
+ oslot_Machine.innerHTML = slot.machine;
+ }
+ var oslot_Job = document.getElementById("cell_job_"+cell);
+ if (oslot_Job) {
+ oslot_Job.innerHTML = slot.job;
+ }
+ }
+ setTimeout("get_slot_grid()", 1000);
+}
+
16 years, 2 months
rhmessaging commits: r2696 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:20:00 -0400 (Wed, 29 Oct 2008)
New Revision: 2696
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Avoid possible exception
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-29 20:19:07 UTC (rev 2695)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-29 20:20:00 UTC (rev 2696)
@@ -114,9 +114,9 @@
obj = self.get_object(session)
cls = self.app.model.get_class_by_object(obj)
+ if cls:
+ return fmt_shorten(cls.get_object_title(session, obj), 16, 4)
- return fmt_shorten(cls.get_object_title(session, obj), 16, 4)
-
class CuminView(Widget):
def __init__(self, app, name):
super(CuminView, self).__init__(app, name)
16 years, 2 months
rhmessaging commits: r2695 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-29 16:19:07 -0400 (Wed, 29 Oct 2008)
New Revision: 2695
Added:
mgmt/trunk/cumin/resources/shade1.png
Log:
Background image for slot visualizations
Added: mgmt/trunk/cumin/resources/shade1.png
===================================================================
(Binary files differ)
Property changes on: mgmt/trunk/cumin/resources/shade1.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
16 years, 2 months
rhmessaging commits: r2694 - store/trunk/cpp/rhel4-support.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-29 13:50:05 -0400 (Wed, 29 Oct 2008)
New Revision: 2694
Modified:
store/trunk/cpp/rhel4-support/rhel4.patch
Log:
Update to rhel4 patch to get changes in previous BDB auto-restore fix back in sync with patch file
Modified: store/trunk/cpp/rhel4-support/rhel4.patch
===================================================================
--- store/trunk/cpp/rhel4-support/rhel4.patch 2008-10-29 17:33:09 UTC (rev 2693)
+++ store/trunk/cpp/rhel4-support/rhel4.patch 2008-10-29 17:50:05 UTC (rev 2694)
@@ -253,11 +253,11 @@
AC_SUBST([WARNING_CFLAGS], [$COMPILER_FLAGS])
Index: lib/MessageStoreImpl.cpp
===================================================================
---- lib/MessageStoreImpl.cpp (revision 2259)
+--- lib/MessageStoreImpl.cpp (revision 2693)
+++ lib/MessageStoreImpl.cpp (working copy)
-@@ -233,10 +233,6 @@
- try {
- env.open(getBdbBaseDir().c_str(), DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON, 0);
+@@ -282,10 +282,6 @@
+ env.set_lg_regionmax(256000); // default = 65000
+ env.open(getBdbBaseDir().c_str(), DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON | DB_RECOVER, 0);
} catch (const DbException& e) {
- if (e.get_errno() == DB_VERSION_MISMATCH)
- THROW_STORE_EXCEPTION_2("Database environment mismatch: This version of bd4 does not match that which created the store database. "
@@ -265,7 +265,7 @@
- "db_upgrade or using db_recover - but the db4-utils package must also be installed to use these utilities.)", e);
THROW_STORE_EXCEPTION_2("Error opening environment", e);
}
-
+
Index: Makefile.am
===================================================================
--- Makefile.am (revision 2259)
16 years, 2 months
rhmessaging commits: r2693 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-29 13:33:09 -0400 (Wed, 29 Oct 2008)
New Revision: 2693
Modified:
store/trunk/cpp/lib/Cursor.h
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
Log:
Fix for BZ462046 - "Automate bdb \'recover\' routine on retsrating crashed broker".
Modified: store/trunk/cpp/lib/Cursor.h
===================================================================
--- store/trunk/cpp/lib/Cursor.h 2008-10-28 16:16:20 UTC (rev 2692)
+++ store/trunk/cpp/lib/Cursor.h 2008-10-29 17:33:09 UTC (rev 2693)
@@ -24,6 +24,7 @@
#ifndef _Cursor_
#define _Cursor_
+#include <boost/shared_ptr.hpp>
#include "db-inc.h"
namespace mrg{
@@ -33,9 +34,12 @@
{
Dbc* cursor;
public:
+ typedef boost::shared_ptr<Db> db_ptr;
+
Cursor() : cursor(0) {}
virtual ~Cursor() { if(cursor) cursor->close(); }
- void open(Db& db, DbTxn* txn, u_int32_t flags = 0) { db.cursor(txn, &cursor, flags); }
+
+ void open(db_ptr db, DbTxn* txn, u_int32_t flags = 0) { db->cursor(txn, &cursor, flags); }
void close() { if(cursor) cursor->close(); cursor = 0; }
Dbc* get() { return cursor; }
Dbc* operator->() { return cursor; }
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-10-28 16:16:20 UTC (rev 2692)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-10-29 17:33:09 UTC (rev 2693)
@@ -63,13 +63,6 @@
MessageStoreImpl::MessageStoreImpl(const char* envpath) :
env(0),
- queueDb(&env, 0),
- configDb(&env, 0),
- exchangeDb(&env, 0),
- messageDb(&env, 0),
- mappingDb(&env, 0),
- bindingDb(&env, 0),
- generalDb(&env, 0),
numJrnlFiles(0),
autoJrnlExpand(false),
autoJrnlExpandMaxFiles(0),
@@ -186,14 +179,16 @@
// num-jfiles at max; disable auto-expand
autoJrnlExpand = false;
autoJrnlExpandMaxFiles = 0;
- QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") must be higher than parameter " << numJrnlFilesParamName << " (" << numJrnlFiles << ") which is at the maximum allowable value; disabling auto-expand.");
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") must be higher than parameter "
+ << numJrnlFilesParamName << " (" << numJrnlFiles << ") which is at the maximum allowable value; disabling auto-expand.");
return;
}
if (p > JRNL_MAX_NUM_FILES) {
// auto-expand-max-jfiles higher than max allowable, adjust
autoJrnlExpand = true;
autoJrnlExpandMaxFiles = JRNL_MAX_NUM_FILES;
- QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") is above allowable maximum (" << JRNL_MAX_NUM_FILES << "); changing this parameter to maximum value.");
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") is above allowable maximum ("
+ << JRNL_MAX_NUM_FILES << "); changing this parameter to maximum value.");
return;
}
if (p <= numJrnlFiles) {
@@ -201,7 +196,9 @@
u_int16_t incr = JRNL_MAX_NUM_FILES - numJrnlFiles > 1 ? 2 : 1;
autoJrnlExpand = true;
autoJrnlExpandMaxFiles = numJrnlFiles + incr;
- QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") is not above that of parameter " << numJrnlFilesParamName << " (" << numJrnlFiles << "); changing this parameter to value of parameter " << numJrnlFilesParamName << " plus " << incr << " (" << autoJrnlExpandMaxFiles << ").");
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName << " (" << p << ") is not above that of parameter "
+ << numJrnlFilesParamName << " (" << numJrnlFiles << "); changing this parameter to value of parameter " << numJrnlFilesParamName
+ << " plus " << incr << " (" << autoJrnlExpandMaxFiles << ").");
return;
}
// No adjustments req'd, set values
@@ -281,7 +278,9 @@
journal::jdir::create_dir(getBdbBaseDir());
try {
- env.open(getBdbBaseDir().c_str(), DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON, 0);
+ env.set_errpfx("msgstore");
+ env.set_lg_regionmax(256000); // default = 65000
+ env.open(getBdbBaseDir().c_str(), DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON | DB_RECOVER, 0);
} catch (const DbException& e) {
if (e.get_errno() == DB_VERSION_MISMATCH)
THROW_STORE_EXCEPTION_2("Database environment mismatch: This version of bd4 does not match that which created the store database. "
@@ -292,6 +291,17 @@
TxnCtxt txn;
try {
+ // Databases are constructed here instead of the constructor so that the DB_RECOVER flag can be used
+ // against the database enviroment. Recover can only be performed if no databases have been created
+ // against the environmnet at the time of recovery, as recovery invalidates the environment.
+ queueDb.reset(new Db(&env, 0));
+ configDb.reset(new Db(&env, 0));
+ exchangeDb.reset(new Db(&env, 0));
+ messageDb.reset(new Db(&env, 0));
+ mappingDb.reset(new Db(&env, 0));
+ bindingDb.reset(new Db(&env, 0));
+ generalDb.reset(new Db(&env, 0));
+
txn.begin(env, false);
open(queueDb, txn.get(), "queues.db", false);
open(configDb, txn.get(), "config.db", false);
@@ -340,20 +350,20 @@
}
}
-void MessageStoreImpl::open(Db& db,
+void MessageStoreImpl::open(db_ptr db,
DbTxn* txn,
const char* file,
bool dupKey)
{
- if(dupKey) db.set_flags(DB_DUPSORT);
- db.open(txn, file, 0, DB_BTREE, DB_CREATE | DB_THREAD, 0);
- dbs.push_back(&db);
+ if(dupKey) db->set_flags(DB_DUPSORT);
+ db->open(txn, file, 0, DB_BTREE, DB_CREATE | DB_THREAD, 0);
+ dbs.push_back(db);
}
MessageStoreImpl::~MessageStoreImpl()
{
try {
- for (std::list<Db*>::iterator i = dbs.begin(); i != dbs.end(); i++) {
+ for (std::list<db_ptr >::iterator i = dbs.begin(); i != dbs.end(); i++) {
(*i)->close(0);
}
if (tplStorePtr->is_ready()) tplStorePtr->stop(true);
@@ -377,7 +387,7 @@
env.txn_begin(0, &txn, 0);
u_int32_t count;
- for (std::list<Db*>::iterator i = dbs.begin(); i != dbs.end(); i++) {
+ for (std::list<db_ptr >::iterator i = dbs.begin(); i != dbs.end(); i++) {
(*i)->truncate(txn, &count, 0);
}
@@ -481,7 +491,7 @@
destroy(exchangeDb, exchange);
//need to also delete bindings
IdDbt key(exchange.getPersistenceId());
- bindingDb.del(0, &key, DB_AUTO_COMMIT);
+ bindingDb->del(0, &key, DB_AUTO_COMMIT);
}
void MessageStoreImpl::create(const PersistableConfig& general)
@@ -505,7 +515,7 @@
destroy(generalDb, general);
}
-bool MessageStoreImpl::create(Db& db,
+bool MessageStoreImpl::create(db_ptr db,
IdSequence& seq,
const Persistable& p)
{
@@ -517,7 +527,7 @@
TxnCtxt txn;
txn.begin(env, true);
try {
- status = db.put(txn.get(), &key, &value, DB_NOOVERWRITE);
+ status = db->put(txn.get(), &key, &value, DB_NOOVERWRITE);
txn.commit();
} catch (...) {
txn.abort();
@@ -531,10 +541,10 @@
}
}
-void MessageStoreImpl::destroy(Db& db, const Persistable& p)
+void MessageStoreImpl::destroy(db_ptr db, const Persistable& p)
{
IdDbt key(p.getPersistenceId());
- db.del(0, &key, DB_AUTO_COMMIT);
+ db->del(0, &key, DB_AUTO_COMMIT);
}
@@ -946,7 +956,7 @@
TxnCtxt txn;
txn.begin(env, true);
try {
- if (messageDb.get(txn.get(), &key, &value, 0) == DB_NOTFOUND) {
+ if (messageDb->get(txn.get(), &key, &value, 0) == DB_NOTFOUND) {
txn.abort();
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
}
@@ -955,7 +965,7 @@
headerSize = value.buffer.getLong();
BufferValue header(headerSize, preamble_length);
- if (messageDb.get(txn.get(), &key, &header, 0) == DB_NOTFOUND) {
+ if (messageDb->get(txn.get(), &key, &header, 0) == DB_NOTFOUND) {
txn.abort();
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
}
@@ -1156,7 +1166,7 @@
}
}
-u_int64_t MessageStoreImpl::getRecordSize(Db& db,
+u_int64_t MessageStoreImpl::getRecordSize(db_ptr db,
Dbt& key)
{
u_int64_t ret = 0;
@@ -1173,14 +1183,14 @@
}
u_int64_t MessageStoreImpl::getRecordSize(DbTxn* txn,
- Db& db,
+ db_ptr db,
Dbt& key)
{
Dbt peek;
peek.set_flags(DB_DBT_USERMEM);
peek.set_ulen(0);
try {
- int status = db.get(txn, &key, &peek, 0);
+ int status = db->get(txn, &key, &peek, 0);
if (status != DB_BUFFER_SMALL) {
THROW_STORE_EXCEPTION("Unexpected status code when determining record length: " + std::string(DbEnv::strerror(status)));
}
@@ -1213,7 +1223,7 @@
value.set_flags(DB_DBT_USERMEM | DB_DBT_PARTIAL);
value.set_doff(offset);
value.set_dlen(size);
- messageDb.put(txn.get(), &key, &value, 0);
+ messageDb->put(txn.get(), &key, &value, 0);
txn.commit();
} catch (const DbException& e) {
txn.abort();
@@ -1259,7 +1269,7 @@
value.set_ulen(length);
value.set_doff(realOffset);
value.set_dlen(length);
- int status = messageDb.get(txn.get(), &key, &value, 0);
+ int status = messageDb->get(txn.get(), &key, &value, 0);
if (status == DB_NOTFOUND) {
delete [] buffer;
THROW_STORE_EXCEPTION("Cannot load content. Message not known to store!");
@@ -1369,7 +1379,7 @@
/// cct message db
if (newId) { // only store in Bd if first time message is stored
Dbt data(buff,size);
- messageDb.put(txn->get(), &messageId, &data, DB_NOOVERWRITE);
+ messageDb->put(txn->get(), &messageId, &data, DB_NOOVERWRITE);
}
}
} catch (const journal::jexception& e) {
@@ -1454,7 +1464,7 @@
Dbt& messageId)
{
if (isUnused(cursor, messageId)) {
- messageDb.del(txn, &messageId, 0);
+ messageDb->del(txn, &messageId, 0);
return true;
} else {
return false;
@@ -1582,13 +1592,13 @@
return txn;
}
-void MessageStoreImpl::put(Db& db,
+void MessageStoreImpl::put(db_ptr db,
DbTxn* txn,
Dbt& key,
Dbt& value)
{
try {
- int status = db.put(txn, &key, &value, DB_NODUPDATA);
+ int status = db->put(txn, &key, &value, DB_NODUPDATA);
if (status == DB_KEYEXIST) {
THROW_STORE_EXCEPTION("duplicate data");
} else if (status) {
@@ -1599,7 +1609,7 @@
}
}
-bool MessageStoreImpl::deleteKeyValuePair(Db& db,
+bool MessageStoreImpl::deleteKeyValuePair(db_ptr db,
DbTxn* txn,
Dbt& key,
Dbt& value)
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2008-10-28 16:16:20 UTC (rev 2692)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2008-10-29 17:33:09 UTC (rev 2693)
@@ -54,6 +54,7 @@
class MessageStoreImpl : public qpid::broker::MessageStore, public qpid::management::Manageable
{
public:
+ typedef boost::shared_ptr<Db> db_ptr;
struct StoreOptions : public qpid::Options {
StoreOptions(const std::string& name="Store Options");
std::string clusterName;
@@ -99,15 +100,15 @@
static const bool defAutoJrnlExpand = true;
static const u_int16_t defAutoJrnlExpandMaxFiles = 16;
- std::list<Db*> dbs;
+ std::list<db_ptr> dbs;
DbEnv env;
- Db queueDb;
- Db configDb;
- Db exchangeDb;
- Db messageDb;
- Db mappingDb;
- Db bindingDb;
- Db generalDb;
+ db_ptr queueDb;
+ db_ptr configDb;
+ db_ptr exchangeDb;
+ db_ptr messageDb;
+ db_ptr mappingDb;
+ db_ptr bindingDb;
+ db_ptr generalDb;
// Pointer to Transaction Prepared List (TPL) journal instance
boost::shared_ptr<TplJournalImpl> tplStorePtr;
@@ -204,14 +205,14 @@
Dbt& messageId);
bool isUnused(Cursor& cursor,
Dbt& messageId);
- void destroy(Db& db,
+ void destroy(db_ptr db,
const qpid::broker::Persistable& p);
- bool create(Db& db,
+ bool create(db_ptr db,
IdSequence& seq,
const qpid::broker::Persistable& p);
void completed(TxnCtxt& txn,
bool commit);
- void record2pcOp(Db& db,
+ void record2pcOp(db_ptr db,
TPCTxnCtxt& txn,
u_int64_t messageId,
u_int64_t queueId);
@@ -220,20 +221,20 @@
const qpid::broker::PersistableQueue& queue,
const std::string& key);
- u_int64_t getRecordSize(Db& db,
+ u_int64_t getRecordSize(db_ptr db,
Dbt& key);
u_int64_t getRecordSize(DbTxn* txn,
- Db& db,
+ db_ptr db,
Dbt& key);
- void put(Db& db,
+ void put(db_ptr db,
DbTxn* txn,
Dbt& key,
Dbt& value);
- bool deleteKeyValuePair(Db& db,
+ bool deleteKeyValuePair(db_ptr db,
DbTxn* txn,
Dbt& key,
Dbt& value);
- void open(Db& db,
+ void open(db_ptr db,
DbTxn* txn,
const char* file,
bool dupKey);
16 years, 2 months