rhmessaging commits: r2990 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-12 11:19:59 -0500 (Fri, 12 Dec 2008)
New Revision: 2990
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/queue.strings
Log:
Ensure the links from the top-queues list include the broker in the context nav
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-12-12 16:03:08 UTC (rev 2989)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-12-12 16:19:59 UTC (rev 2990)
@@ -190,7 +190,7 @@
self.connections_close = ConnectionSetClose(app, "connsclose")
self.add_mode(self.connections_close)
-
+
class BrokerStatus(CuminStatus):
def __init__(self, app, name):
super(BrokerStatus, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-12-12 16:03:08 UTC (rev 2989)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-12-12 16:19:59 UTC (rev 2990)
@@ -182,10 +182,15 @@
return "Name"
def render_content(self, session, data):
+ reg = Identifiable(data["registration_id"])
queue = Identifiable(data["id"])
- href = self.page.main.broker.queue.get_href(session, queue)
- return fmt_link(href, fmt_shorten(data["name"]))
+ branch = session.branch()
+ self.page.main.broker.object.set(session, reg)
+ self.page.main.broker.queue.object.set(session, queue)
+ self.page.main.broker.queue.show(session)
+ return fmt_link(branch.marshal(), fmt_shorten(data["name"]))
+
class EnqueuesColumn(TopTableColumn):
def render_title(self, session, data):
return "Recent Enqueues"
Modified: mgmt/trunk/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.strings 2008-12-12 16:03:08 UTC (rev 2989)
+++ mgmt/trunk/cumin/python/cumin/queue.strings 2008-12-12 16:19:59 UTC (rev 2990)
@@ -67,8 +67,11 @@
select
q.id,
q.name,
+ b.registration_id,
(c.msg_total_enqueues - p.msg_total_enqueues) as enqueues
from queue as q
+join vhost as v on v.id = q.vhost_id
+join broker as b on b.id = v.broker_id
join queue_stats as c on c.id = q.stats_curr_id
join queue_stats as p on p.id = q.stats_prev_id
where p.qmf_update_time > now() - interval '60 seconds'
16 years
rhmessaging commits: r2989 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-12-12 11:03:08 -0500 (Fri, 12 Dec 2008)
New Revision: 2989
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/pool.py
Log:
Fix exception on pool statistics page when there are no job records.
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-12-11 22:54:19 UTC (rev 2988)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-12-12 16:03:08 UTC (rev 2989)
@@ -1960,26 +1960,32 @@
class StatusStat(CuminStat):
def value_text(self, record):
- state = self.name
- value = record[state]
- return str(value)
+ if record:
+ state = self.name
+ value = record[state]
+ return str(value)
+ return ""
def rate_text(self, record):
return ""
class PercentStat(CuminStat):
def value_text(self, record):
- state = self.name
- value = record[state]
- return str(value)
+ if record:
+ state = self.name
+ value = record[state]
+ return str(value)
+ return ""
def rate_text(self, record):
- state = self.name
- value = record[state]
- total = record["total"]
- if total:
- percent = float(value) / float(total) * 100.0
- return total and "%2.2f" % percent or "-"
+ if record:
+ state = self.name
+ value = record[state]
+ total = record["total"]
+ if total:
+ percent = float(value) / float(total) * 100.0
+ return total and "%2.2f" % percent or "-"
+ return ""
class PoolSlotVisualization(SlotVisualization):
def __init__(self, cls, name):
@@ -2041,7 +2047,9 @@
def get_stat_record(self, session, pool):
cursor = self.itemset.get_items(session, pool)
- return self.itemset.cursor_to_rows(cursor)[0]
+ rows = self.itemset.cursor_to_rows(cursor)
+ if len(rows):
+ return rows[0]
class PoolStatus(CuminAction):
def __init__(self, cls, name):
@@ -2051,7 +2059,9 @@
def get_stat_record(self, session, pool):
cursor = self.itemset.get_items(session, pool)
- return self.itemset.cursor_to_rows(cursor)[0]
+ rows = self.itemset.cursor_to_rows(cursor)
+ if len(rows):
+ return rows[0]
class StatusPoolSlotSet(SlotStatSet):
def render_sql_where(self, session, pool):
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-12-11 22:54:19 UTC (rev 2988)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-12-12 16:03:08 UTC (rev 2989)
@@ -499,5 +499,5 @@
action = self.app.model.pool.poolstatus
record = action.get_stat_record(session, pool)
- return "<div><span>%i</span> of <span>%i</span> slots active</div>" % \
- (record["active"], record["all"])
+ return record and "<div><span>%i</span> of <span>%i</span> slots active</div>" % \
+ (record["active"], record["all"]) or ""
16 years
rhmessaging commits: r2988 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-11 17:54:19 -0500 (Thu, 11 Dec 2008)
New Revision: 2988
Modified:
mgmt/trunk/mint/python/mint/update.py
Log:
remove extraneous commit/rollback from DBExpireUpdate
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-11 22:16:42 UTC (rev 2987)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-11 22:54:19 UTC (rev 2988)
@@ -336,6 +336,19 @@
finally:
self.model.unlock()
+class DBExpireUpdate(ModelUpdate):
+ def __init__(self, model):
+ super(DBExpireUpdate, self).__init__(model, None, None)
+
+ def process(self, conn):
+ cursor = conn.cursor()
+ rowcount = 0
+ attrs = self.model.dbExpireThread.attrs
+ for op in self.model.dbExpireThread.ops:
+ rowcount += op.execute(cursor, attrs)
+ log.debug("%d records expired" % (rowcount))
+
+
class UpdateQueue(ConcurrentQueue):
def __init__(self, maxsize=0, slotCount=1):
self.slotCount = slotCount
@@ -375,20 +388,3 @@
if len(self.slots[slot]) > 0:
return self.slots[slot].popleft()
return None
-
-class DBExpireUpdate(ModelUpdate):
- def __init__(self, model):
- super(DBExpireUpdate, self).__init__(model, None, None)
-
- def process(self, conn):
- try:
- cursor = conn.cursor()
- rowcount = 0
- attrs = self.model.dbExpireThread.attrs
- for op in self.model.dbExpireThread.ops:
- rowcount += op.execute(cursor, attrs)
- log.debug("%d records expired" % (rowcount))
- conn.commit()
- except:
- conn.rollback()
- log.exception("DB cleanup failed")
16 years
rhmessaging commits: r2987 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-12-11 17:16:42 -0500 (Thu, 11 Dec 2008)
New Revision: 2987
Modified:
mgmt/trunk/mint/python/mint/sql.py
Log:
remove 'select ... for update' from the expiration sql
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-11 21:47:23 UTC (rev 2986)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-11 22:16:42 UTC (rev 2987)
@@ -151,22 +151,16 @@
if table.endswith("_stats"):
parent_table = table[0:table.find("_stats")]
sql = """
- select * from %s
- where qmf_update_time < now() - interval '%%(threshold)s seconds'
- for update;
delete from %s
where qmf_update_time < now() - interval '%%(threshold)s seconds'
- """ % (table, table)
+ """ % (table)
if self.keepCurrStats:
sql += " and id not in (select stats_curr_id from %s)" % (parent_table)
else:
sql = """
- select * from %s
- where qmf_create_time < now() - interval '%%(threshold)s seconds'
- for update;
delete from %s
where qmf_create_time < now() - interval '%%(threshold)s seconds'
- """ % (table, table)
+ """ % (table)
return sql
class SqlGetBrokerRegistration(SqlOperation):
16 years
rhmessaging commits: r2986 - in mgmt/trunk/mint: python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 16:47:23 -0500 (Thu, 11 Dec 2008)
New Revision: 2986
Modified:
mgmt/trunk/mint/bin/mint-bench
mgmt/trunk/mint/python/mint/tools.py
Log:
Delete the brokers we add so that all threads shutdown
Modified: mgmt/trunk/mint/bin/mint-bench
===================================================================
--- mgmt/trunk/mint/bin/mint-bench 2008-12-11 21:31:27 UTC (rev 2985)
+++ mgmt/trunk/mint/bin/mint-bench 2008-12-11 21:47:23 UTC (rev 2986)
@@ -8,13 +8,6 @@
MintBenchTool("mint-bench").main()
def main():
- root = logging.getLogger("mint")
- root.setLevel(logging.WARN)
-
- h = logging.StreamHandler()
- h.setLevel(logging.WARN)
- root.addHandler(h)
-
if "--profile" in sys.argv:
sys.argv.remove("--profile")
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-12-11 21:31:27 UTC (rev 2985)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-12-11 21:47:23 UTC (rev 2986)
@@ -124,10 +124,12 @@
model.check()
model.init()
model.start()
+
+ added = list()
try:
for arg in args[1:]:
- model.addBroker(arg)
+ added.append(model.addBroker(arg))
enq_last = 0
deq_last = 0
@@ -148,4 +150,8 @@
enq_last = enq
deq_last = deq
finally:
+ for broker in added:
+ model.delBroker(broker)
+
model.stop()
+
16 years
rhmessaging commits: r2985 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 16:31:27 -0500 (Thu, 11 Dec 2008)
New Revision: 2985
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
Log:
Rename the add-broker admin command to add-qmf-server.
Improve the server listing function, to match what other list commands
do.
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2008-12-11 20:54:46 UTC (rev 2984)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2008-12-11 21:31:27 UTC (rev 2985)
@@ -96,19 +96,19 @@
opt = CommandOption(command, "force")
opt.description = "Don't complain and just do it"
- command = self.AddBroker(self, "add-broker")
+ command = self.AddQmfServer(self, "add-qmf-server")
command.arguments = ("NAME", "URL")
- command.description = "Add a new broker called NAME at URL"
+ command.description = "Add a new QMF server called NAME at URL"
- command = self.RemoveBroker(self, "remove-broker")
+ command = self.RemoveQmfServer(self, "remove-qmf-server")
command.arguments = ("URL",)
- command.description = "Remove broker called NAME; requires --force"
+ command.description = "Remove QMF server called NAME; requires --force"
opt = CommandOption(command, "force")
opt.description = "Don't complain and just do it"
- command = self.ListBrokers(self, "list-brokers")
- command.description = "List existing broker registrations"
+ command = self.ListQmfServers(self, "list-qmf-servers")
+ command.description = "List existing QMF servers"
command = self.AddUser(self, "add-user")
command.arguments = ("NAME",)
@@ -206,7 +206,7 @@
def run(self, opts, args):
self.parent.database.checkSchema()
- class AddBroker(Command):
+ class AddQmfServer(Command):
def run(self, opts, args):
try:
name, url = args[1:]
@@ -236,7 +236,7 @@
reg = BrokerRegistration(name=name, url=url)
reg.syncUpdate()
- class RemoveBroker(Command):
+ class RemoveQmfServer(Command):
def run(self, opts, args):
try:
name = args[1]
@@ -253,11 +253,20 @@
raise CommandException \
(self, "Broker '%s' is unknown", reg.name)
- class ListBrokers(Command):
+ class ListQmfServers(Command):
def run(self, opts, args):
- for reg in BrokerRegistration.select():
- print reg.name, reg.url
+ regs = BrokerRegistration.select()
+ print " ID Name URL"
+ print "---- -------------------- ---------------------------------"
+
+ for reg in regs:
+ print "%4i %-20s %-20s" % (reg.id, reg.name, reg.url)
+
+ count = regs.count()
+
+ print "(%i server%s found)" % (count, ess(count))
+
class AddUser(Command):
def run(self, opts, args):
try:
16 years
rhmessaging commits: r2984 - mgmt/trunk/cumin/etc.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 15:54:46 -0500 (Thu, 11 Dec 2008)
New Revision: 2984
Modified:
mgmt/trunk/cumin/etc/sysvinit-cumin
Log:
Add chkconfig metadata
Modified: mgmt/trunk/cumin/etc/sysvinit-cumin
===================================================================
--- mgmt/trunk/cumin/etc/sysvinit-cumin 2008-12-11 20:10:55 UTC (rev 2983)
+++ mgmt/trunk/cumin/etc/sysvinit-cumin 2008-12-11 20:54:46 UTC (rev 2984)
@@ -1,5 +1,7 @@
#!/bin/sh
#
+# chkconfig: 2345 80 30
+# description: A web management interface
# cumin: Cumin daemon
# processname: cumin
# pidfile: /var/run/cumin.pid
16 years
rhmessaging commits: r2983 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 15:10:55 -0500 (Thu, 11 Dec 2008)
New Revision: 2983
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/broker.strings
Log:
Add a simple connection status indication to the broker view
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-12-11 20:03:58 UTC (rev 2982)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-12-11 20:10:55 UTC (rev 2983)
@@ -192,8 +192,38 @@
self.add_mode(self.connections_close)
class BrokerStatus(CuminStatus):
- pass
+ def __init__(self, app, name):
+ super(BrokerStatus, self).__init__(app, name)
+ self.connected = self.ConnectedAttribute(app, "conn")
+ self.add_attribute(self.connected)
+
+ def render_status(self, session, reg):
+ if self.connected.get(session):
+ return "Connected"
+ else:
+ return "Disconnected"
+
+ def render_color(self, session, reg):
+ if self.connected.get(session):
+ return "green"
+ else:
+ return "yellow"
+
+ class ConnectedAttribute(Attribute):
+ def get_default(self, session):
+ reg = self.widget.frame.get_object(session)
+ connected = False
+
+ try:
+ mbroker = self.app.model.data.mintBrokersByUrl[reg.url]
+
+ connected = mbroker.connected
+ except KeyError:
+ pass
+
+ return connected
+
class BrokerView(CuminView):
"""
Despite the name, this is actually a view of two objects, usually
Modified: mgmt/trunk/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.strings 2008-12-11 20:03:58 UTC (rev 2982)
+++ mgmt/trunk/cumin/python/cumin/broker.strings 2008-12-11 20:10:55 UTC (rev 2983)
@@ -105,6 +105,13 @@
</tbody>
</table>
+[BrokerStatus.html]
+<div id="{id}" class="CuminStatus {color}">
+ <h2>Broker Status</h2>
+
+ {status}
+</div>
+
[BrokerStats.html]
<table class="twocol">
<tbody>
16 years
rhmessaging commits: r2982 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 15:03:58 -0500 (Thu, 11 Dec 2008)
New Revision: 2982
Modified:
mgmt/trunk/mint/python/mint/__init__.py
Log:
Don't loop really fast when we fail to connect to a broker
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-11 19:33:36 UTC (rev 2981)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-11 20:03:58 UTC (rev 2982)
@@ -4,6 +4,7 @@
import struct
import sys
import types
+import socket
from threading import Lock, RLock
from sqlobject import *
from traceback import print_exc
@@ -555,11 +556,15 @@
regUrls = set()
for reg in BrokerRegistration.select():
+ if reg.url not in self.model.mintBrokersByUrl:
+ try:
+ self.model.addBroker(reg.url)
+ except socket.error, e:
+ log.info("Can't connect to broker at %s: %s", reg.url, e)
+ pass
+
regUrls.add(reg.url)
- if reg.url not in self.model.mintBrokersByUrl:
- self.model.addBroker(reg.url)
-
for mbroker in self.model.mintBrokersByQmfBroker.values():
if mbroker.url not in regUrls:
self.model.delBroker(mbroker)
16 years
rhmessaging commits: r2981 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-12-11 14:33:36 -0500 (Thu, 11 Dec 2008)
New Revision: 2981
Modified:
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/queue.strings
Log:
Switch to a simpler method of counting recent enqueues
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-12-11 18:52:13 UTC (rev 2980)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-12-11 19:33:36 UTC (rev 2981)
@@ -190,9 +190,6 @@
def render_title(self, session, data):
return "Recent Enqueues"
- def render_content(self, session, data):
- return int(data["avg_enqueues"])
-
class QueueFrame(CuminFrame):
def __init__(self, app, name):
super(QueueFrame, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.strings 2008-12-11 18:52:13 UTC (rev 2980)
+++ mgmt/trunk/cumin/python/cumin/queue.strings 2008-12-11 19:33:36 UTC (rev 2981)
@@ -67,12 +67,12 @@
select
q.id,
q.name,
- avg(s.msg_total_enqueues) as avg_enqueues
+ (c.msg_total_enqueues - p.msg_total_enqueues) as enqueues
from queue as q
-join queue_stats as s on s.queue_id = q.id
-where s.qmf_update_time > now() - interval '10 minutes'
-group by q.id, q.name
-order by avg_enqueues desc
+join queue_stats as c on c.id = q.stats_curr_id
+join queue_stats as p on p.id = q.stats_prev_id
+where p.qmf_update_time > now() - interval '60 seconds'
+order by enqueues desc
limit 5
[TopQueueSet.count_sql]
16 years