rhmessaging commits: r1541 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-08 12:04:53 -0500 (Tue, 08 Jan 2008)
New Revision: 1541
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/wooly/tables.py
mgmt/notes/justin-todo.txt
Log:
Adds a PhaseSwitch widget for controlling for filtering views down to
active, inactive, or deleted objects.
Employs phaseswitch in the queue, exchange, client, and client session
views.
Removes TableHeader and TableColumn, since they are no longer used and
superceded by ItemTable and SqlTable.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/client.py 2008-01-08 17:04:53 UTC (rev 1541)
@@ -16,7 +16,6 @@
super(ClientSet, self).__init__(app, name)
self.table_sql = "client as l"
- self.where_sql = "where l.vhost_id = %(id)r"
self.add_sql_join("client_stats as c", "c.id", "l.stats_curr_id")
self.add_sql_join("client_stats as p", "p.id", "l.stats_prev_id")
@@ -58,15 +57,31 @@
self.unit.add_state("f", "Frames")
self.add_child(self.unit)
+ self.phase = PhaseSwitch(app, "phase")
+ self.add_child(self.phase)
+
def get_title(self, session, vhost):
- return "Clients %s" % fmt_count(self.get_item_count(session, vhost))
+ return "Clients %s" % fmt_count(vhost.clients.count())
def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Frames"
- def get_item_count(self, session, vhost):
- return vhost.clients.count()
+ def get_where_sql(self, session):
+ elems = list()
+ elems.append("l.vhost_id = %(id)r")
+ phase = self.phase.get(session)
+
+ if phase == "a":
+ elems.append("c.rec_time > now() - interval '10 minutes'")
+ elif phase == "i":
+ elems.append("(c.rec_time <= now() - interval '10 minutes'" +
+ " and l.deletion_time is null)")
+ else:
+ elems.append("l.deletion_time is not null")
+
+ return "where %s" % " and ".join(elems)
+
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
@@ -258,7 +273,6 @@
super(ClientSessionSet, self).__init__(app, name)
self.table_sql = "session as s"
- self.where_sql = "where s.client_id = %(id)r"
self.add_sql_join("session_stats as c", "c.id", "s.stats_curr_id")
self.add_sql_join("session_stats as p", "p.id", "s.stats_curr_id")
@@ -276,15 +290,31 @@
col = self.StatusColumn(app, "status")
self.add_column(col)
+ self.phase = PhaseSwitch(app, "phase")
+ self.add_child(self.phase)
+
def get_title(self, session, client):
- return "Sessions %s" % fmt_count(self.get_item_count(session, client))
+ return "Sessions %s" % fmt_count(client.sessions.count())
+ def get_where_sql(self, session):
+ elems = list()
+ elems.append("s.client_id = %(id)r")
+
+ phase = self.phase.get(session)
+
+ if phase == "a":
+ elems.append("c.rec_time > now() - interval '10 minutes'")
+ elif phase == "i":
+ elems.append("(c.rec_time <= now() - interval '10 minutes'" +
+ " and s.deletion_time is null)")
+ else:
+ elems.append("s.deletion_time is not null")
+
+ return "where %s" % " and ".join(elems)
+
def get_sql_values(self, session, client):
return {"id": client.id}
- def get_item_count(self, session, client):
- return client.sessions.count()
-
class NameColumn(SqlTableColumn):
def get_title(self, session, object):
return "Name"
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/client.strings 2008-01-08 17:04:53 UTC (rev 1541)
@@ -1,5 +1,7 @@
[ClientSet.html]
<form>
+ <div class="rfloat">{phase}</div>
+
{unit}
<div class="sactions">
@@ -130,23 +132,29 @@
<div class="iblock chart">{received}</div>
[ClientSessionSet.html]
-<div class="sactions">
- <h2>Act on Selected Sessions:</h2>
- <button>Solicit Ack</button>
- <button>Reset Lifespan</button>
- <button>Detach</button>
- <button>Close</button>
-</div>
+<form>
+ <div class="rfloat">{phase}</div>
-<table class="mobjects">
- <thead>
- <tr>
- <th class="setnav" colspan="0">
- <div class="rfloat">{page}</div>
- {count}
- </th>
- </tr>
- <tr>{headers}</tr>
- </thead>
- <tbody>{items}</tbody>
-</table>
+ <ul class="radiotabs"><li> </li></ul>
+
+ <div class="sactions">
+ <h2>Act on Selected Sessions:</h2>
+ <button>Solicit Ack</button>
+ <button>Reset Lifespan</button>
+ <button>Detach</button>
+ <button>Close</button>
+ </div>
+
+ <table class="mobjects">
+ <thead>
+ <tr>
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
+ </table>
+</form>
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/exchange.py 2008-01-08 17:04:53 UTC (rev 1541)
@@ -37,7 +37,6 @@
super(ExchangeSet, self).__init__(app, name)
self.table_sql = "exchange as e"
- self.where_sql = "where e.vhost_id = %(id)r"
self.add_sql_join("exchange_stats as c", "c.id", "e.stats_curr_id")
self.add_sql_join("exchange_stats as p", "p.id", "e.stats_prev_id")
@@ -82,15 +81,28 @@
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
+ self.phase = PhaseSwitch(app, "phase")
+ self.add_child(self.phase)
+
def get_title(self, session, vhost):
- return "Exchanges %s" % fmt_count(self.get_item_count(session, vhost))
+ return "Exchanges %s" % fmt_count(vhost.exchanges.count())
- def get_unit_plural(self, session):
- return self.unit.get(session) == "b" and "Bytes" or "Msgs."
+ def get_where_sql(self, session):
+ elems = list()
+ elems.append("e.vhost_id = %(id)r")
- def get_item_count(self, session, vhost):
- return vhost.exchanges.count()
+ phase = self.phase.get(session)
+ if phase == "a":
+ elems.append("c.rec_time > now() - interval '10 minutes'")
+ elif phase == "i":
+ elems.append("(c.rec_time <= now() - interval '10 minutes'" +
+ " and e.deletion_time is null)")
+ else:
+ elems.append("e.deletion_time is not null")
+
+ return "where %s" % " and ".join(elems)
+
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
@@ -129,7 +141,7 @@
class ReceivedColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Received" % self.parent.get_unit_plural(session)
+ return "%s Received" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
@@ -140,7 +152,7 @@
class RoutedColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Routed" % self.parent.get_unit_plural(session)
+ return "%s Routed" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
@@ -151,7 +163,7 @@
class DroppedColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Dropped" % self.parent.get_unit_plural(session)
+ return "%s Dropped" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-01-08 17:04:53 UTC (rev 1541)
@@ -12,6 +12,8 @@
}
[ExchangeSet.html]
+<div class="rfloat">{phase}</div>
+
{unit}
<table class="mobjects">
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-08 17:04:53 UTC (rev 1541)
@@ -21,7 +21,6 @@
super(QueueSet, self).__init__(app, name)
self.table_sql = "queue as q"
- self.where_sql = "where q.vhost_id = %(id)r"
self.add_sql_join("queue_stats as c", "c.id", "q.stats_curr_id")
self.add_sql_join("queue_stats as p", "p.id", "q.stats_prev_id")
@@ -73,17 +72,27 @@
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
+ self.phase = PhaseSwitch(app, "phase")
+ self.add_child(self.phase)
+
def get_title(self, session, vhost):
- return "Queues %s" % fmt_count(self.get_item_count(session, vhost))
+ return "Queues %s" % fmt_count(vhost.queues.count())
- def get_unit_singular(self, session):
- return self.unit.get(session) == "b" and "Byte" or "Msg."
+ def get_where_sql(self, session):
+ elems = list()
+ elems.append("q.vhost_id = %(id)r")
- def get_unit_plural(self, session):
- return self.unit.get(session) == "b" and "Bytes" or "Msgs."
+ phase = self.phase.get(session)
- def get_item_count(self, session, vhost):
- return vhost.queues.count()
+ if phase == "a":
+ elems.append("c.rec_time > now() - interval '10 minutes'")
+ elif phase == "i":
+ elems.append("(c.rec_time <= now() - interval '10 minutes'" +
+ " and q.deletion_time is null)")
+ else:
+ elems.append("q.deletion_time is not null")
+
+ return "where %s" % " and ".join(elems)
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
@@ -122,7 +131,7 @@
class EnqueuedColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Enqueued" % self.parent.get_unit_plural(session)
+ return "%s Enqueued" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
@@ -133,7 +142,7 @@
class DequeuedColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Dequeued" % self.parent.get_unit_plural(session)
+ return "%s Dequeued" % self.parent.unit.get_brief_plural(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
@@ -144,7 +153,7 @@
class DepthColumn(SqlTableColumn):
def get_title(self, session, object):
- return "%s Depth" % self.parent.get_unit_singular(session)
+ return "%s Depth" % self.parent.unit.get_brief_singular(session)
def get_column_key(self, session):
unit = self.parent.unit.get(session)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/queue.strings 2008-01-08 17:04:53 UTC (rev 1541)
@@ -1,5 +1,6 @@
[QueueSet.html]
<form>
+ <div class="rfloat">{phase}</div>
{unit}
<div class="sactions">
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-08 17:04:53 UTC (rev 1541)
@@ -233,6 +233,23 @@
self.add_state("m", "Messages")
self.add_state("b", "Bytes")
+ self.brief_sing = {"m": "Msg.", "b": "Byte"}
+ self.brief_plur = {"m": "Msgs.", "b": "Bytes"}
+
+ def get_brief_singular(self, session):
+ return self.brief_sing[self.get(session)]
+
+ def get_brief_plural(self, session):
+ return self.brief_plur[self.get(session)]
+
+class PhaseSwitch(StateSwitch):
+ def __init__(self, app, name):
+ super(PhaseSwitch, self).__init__(app, name)
+
+ self.add_state("a", "Active")
+ self.add_state("i", "Inactive")
+ self.add_state("d", "Deleted")
+
class Paginator(ItemSet):
def __init__(self, app, name):
super(Paginator, self).__init__(app, name)
@@ -275,88 +292,6 @@
def render_item_content(self, session, page):
return page + 1
-class TableHeader(ItemSet):
- def __init__(self, app, name):
- super(TableHeader, self).__init__(app, name)
-
- self.columns = list() # of TableColumns
-
- self.column = Parameter(app, "col")
- self.add_parameter(self.column)
-
- self.reversed = BooleanParameter(app, "rev")
- self.reversed.set_default(False)
- self.add_parameter(self.reversed)
-
- def add_column(self, column):
- self.columns.append(column)
- column.header = self
-
- if not self.column.default:
- self.column.set_default(column.name)
-
- def get_selected_column(self, session):
- name = self.column.get(session)
- for column in self.columns:
- if column.name == name:
- return column
-
- def is_reversed(self, session):
- return self.reversed.get(session)
-
- def get_items(self, session, object):
- return self.columns
-
- def render_item_class(self, session, column):
- return column.get_class(session)
-
- def render_item_content(self, session, column):
- return column.get_title(session)
-
- def render_item_href(self, session, column):
- branch = session.branch()
-
- if column.name == self.column.get(session):
- self.reversed.set(branch, not self.reversed.get(session))
-
- self.column.set(branch, column.name)
-
- return branch.marshal()
-
-# XXX for now, not a Widget
-class TableColumn(object):
- def __init__(self, name, data_name=None, title=None, class_=None):
- self.name = name
- self.data_name = data_name
- self.title = title
- self.class_ = class_
-
- self.header = None
-
- def get_data_name(self, session):
- return self.data_name
-
- def get_title(self, session):
- return self.title
-
- def get_class(self, session):
- column = self.header.get_selected_column(session)
- classes = self.class_
-
- if self is column:
- classes = (classes or "") + " selected"
-
- return classes
-
- def get_sorted_items(self, session, items):
- name = self.get_data_name(session)
-
- if name:
- # XXX sqlobject specific
- items = items.orderBy(self.get_data_name(session))
-
- return items
-
class CuminTable(SqlTable):
def __init__(self, app, name):
super(CuminTable, self).__init__(app, name)
Modified: mgmt/cumin/python/wooly/tables.py
===================================================================
--- mgmt/cumin/python/wooly/tables.py 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/cumin/python/wooly/tables.py 2008-01-08 17:04:53 UTC (rev 1541)
@@ -171,6 +171,16 @@
self.get_orderby_sql(session),
self.get_limit_sql(session))
+ return self.build_sql(elems)
+
+ def get_count_sql(self, session):
+ elems = ("select count(*)",
+ self.get_from_sql(session),
+ self.get_where_sql(session))
+
+ return self.build_sql(elems)
+
+ def build_sql(self, elems):
writer = Writer()
for elem in elems:
@@ -178,16 +188,27 @@
writer.write(elem)
writer.write("\n")
- sql = writer.to_string()
+ return writer.to_string()
- return sql
-
def get_sql_values(self, session, object):
return None
def get_connection(self, session):
pass
+ def get_item_count(self, session, object):
+ conn = self.get_connection(session)
+
+ if conn:
+ cursor = conn.cursor()
+ sql = self.get_count_sql(session)
+ sql_values = self.get_sql_values(session, object)
+
+ cursor.execute(sql, sql_values)
+ data = cursor.fetchone()
+
+ return data[0]
+
# XXX shouldn't this be do_get_items?
def get_items(self, session, object):
conn = self.get_connection(session)
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-08 05:19:48 UTC (rev 1540)
+++ mgmt/notes/justin-todo.txt 2008-01-08 17:04:53 UTC (rev 1541)
@@ -24,14 +24,16 @@
* Tables
- - Indicate selected (sorted-by) column
-
- Add sort direction icon
- Deal with large numbers of pages in paginators
- Change first-click sort to desc for number fields
+ - Handle no pages in paginator
+
+ - Column justification
+
* Div by zero error in queues view
Deferred
18 years, 3 months
rhmessaging commits: r1540 - in mgmt: cumin/python/wooly and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-08 00:19:48 -0500 (Tue, 08 Jan 2008)
New Revision: 1540
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/tables.py
mgmt/cumin/python/wooly/tables.strings
mgmt/notes/justin-todo.txt
Log:
Big change to tables. Migrates to custom-query mapped tables for
queues, exchanges, clients, and client sessions.
Apart from a problem with null rates, corrects the sorting of rate
columns.
Fixes a pagination problem.
Changes the visual position of the paginator in table views and adds a
view summary.
Updates todos.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/client.py 2008-01-08 05:19:48 UTC (rev 1540)
@@ -1,5 +1,7 @@
from wooly import *
from wooly.widgets import *
+from wooly.tables import *
+from datetime import datetime
from stat import *
from widgets import *
@@ -13,11 +15,6 @@
def __init__(self, app, name):
super(ClientSet, self).__init__(app, name)
- self.unit = StateSwitch(app, "unit")
- self.unit.add_state("f", "Frames")
- self.unit.add_state("b", "Bytes")
- self.add_child(self.unit)
-
self.table_sql = "client as l"
self.where_sql = "where l.vhost_id = %(id)r"
@@ -26,29 +23,41 @@
self.add_sql_column("id", "l.id")
self.add_sql_column("addr", "l.address")
- self.add_sql_column("cbsent", "c.bytes_from_client")
- self.add_sql_column("cfsent", "c.frames_from_client")
- self.add_sql_column("cbrecv", "c.bytes_to_client")
- self.add_sql_column("cfrecv", "c.frames_to_client")
- self.add_sql_column("ctime", "c.rec_time")
- self.add_sql_column("pbsent", "p.bytes_from_client")
- self.add_sql_column("pfsent", "p.frames_from_client")
- self.add_sql_column("pbrecv", "p.bytes_to_client")
- self.add_sql_column("pfrecv", "p.frames_to_client")
- self.add_sql_column("ptime", "p.rec_time")
+ self.add_sql_column("bs",
+ "(c.bytes_from_client - p.bytes_from_client)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("fs",
+ "(c.frames_from_client - p.frames_from_client)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("br",
+ "(c.bytes_to_client - p.bytes_to_client)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("fr",
+ "(c.frames_to_client - p.frames_to_client)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ col = CheckboxColumn(app, "id")
+ self.add_column(col)
+
col = self.AddressColumn(app, "addr")
self.add_column(col)
+ self.set_selected_column(col)
+
#col = self.SessionsColumn(app, "sess")
#self.add_column(col)
col = self.SentColumn(app, "sent")
self.add_column(col)
- col = self.ReceivedColumn(app, "recv")
+ col = self.ReceivedColumn(app, "received")
self.add_column(col)
+ self.unit = StateSwitch(app, "unit")
+ self.unit.add_state("b", "Bytes")
+ self.unit.add_state("f", "Frames")
+ self.add_child(self.unit)
+
def get_title(self, session, vhost):
return "Clients %s" % fmt_count(self.get_item_count(session, vhost))
@@ -61,65 +70,51 @@
def get_sql_values(self, session, vhost):
return {"id": vhost.id}
- class AddressColumn(ItemTableColumn):
+ class AddressColumn(SqlTableColumn):
def get_title(self, session, vhost):
return "Address"
- def do_render(self, session, data):
+ def render_content(self, session, data):
client = Identifiable(data["id"])
branch = session.branch()
self.frame().show_client(branch, client).show_view(branch)
- content = fmt_olink(branch, client, name=data["addr"])
- return "<td>%s</td>" % content
+ return fmt_olink(branch, client, name=data["addr"])
- class SessionsColumn(ItemTableColumn):
+ class SessionsColumn(SqlTableColumn):
def get_title(self, session, vhost):
return "Sessions"
- def do_render(self, session, data):
+ def render_content(self, session, data):
client = Identifiable(data["id"])
branch = session.branch()
frame = self.frame().show_client(branch, client)
frame.show_view(branch).show_sessions(branch)
- content = fmt_link(branch.marshal(), client.sessions.count())
- return "<td>%s</td>" % content
+ # XXX client.sessions won't work
+ #return fmt_link(branch.marshal(), client.sessions.count())
+ return "XXX"
- class SentColumn(ItemTableColumn):
+ class SentColumn(SqlTableColumn):
def get_title(self, session, vhost):
return "%s Sent" % self.parent.get_unit_plural(session)
- def do_render(self, session, data):
+ def get_column_key(self, session):
unit = self.parent.unit.get(session)
+ return unit == "b" and "bs" or "fs"
- csecs = secs(data["ctime"])
- psecs = secs(data["ptime"])
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
- if unit == "b":
- value = calc_rate(data["cbsent"], data["pbsent"], csecs, psecs)
- else:
- value = calc_rate(data["cfsent"], data["pfsent"], csecs, psecs)
-
- content = fmt_rate(value, unit == "b" and "byte" or "frame", "sec")
- return "<td>%s</td>" % content
-
- class ReceivedColumn(ItemTableColumn):
+ class ReceivedColumn(SqlTableColumn):
def get_title(self, session, vhost):
return "%s Received" % self.parent.get_unit_plural(session)
- def do_render(self, session, data):
+ def get_column_key(self, session):
unit = self.parent.unit.get(session)
+ return unit == "b" and "br" or "fr"
- csecs = secs(data["ctime"])
- psecs = secs(data["ptime"])
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
- if unit == "b":
- value = calc_rate(data["cbrecv"], data["pbrecv"], csecs, psecs)
- else:
- value = calc_rate(data["cfrecv"], data["pfrecv"], csecs, psecs)
-
- content = fmt_rate(value, unit == "b" and "byte" or "frame", "sec")
- return "<td>%s</td>" % content
-
class ClientFrame(CuminFrame):
def __init__(self, app, name):
super(ClientFrame, self).__init__(app, name)
@@ -290,18 +285,18 @@
def get_item_count(self, session, client):
return client.sessions.count()
- class NameColumn(ItemTableColumn):
+ class NameColumn(SqlTableColumn):
def get_title(self, session, object):
return "Name"
- class ExpiresColumn(ItemTableColumn):
+ class ExpiresColumn(SqlTableColumn):
def get_title(self, session, object):
return "Expires"
- def do_render(self, session, data):
- return "<td>%s</td>" % data[self.name]
+ def render_value(self, session, value):
+ return fmt_datetime(datetime.fromtimestamp(value / 1000000000))
- class StatusColumn(ItemTableColumn):
+ class StatusColumn(SqlTableColumn):
def get_title(self, session, object):
return "Status"
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/client.strings 2008-01-08 05:19:48 UTC (rev 1540)
@@ -1,7 +1,5 @@
[ClientSet.html]
<form>
- <div class="rfloat">{page}</div>
-
{unit}
<div class="sactions">
@@ -13,20 +11,17 @@
<table class="mobjects">
<thead>
<tr>
- <th></th>
- {headers}
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
</tr>
+ <tr>{headers}</tr>
</thead>
<tbody>{items}</tbody>
</table>
</form>
-[ClientSet.item_html]
-<tr>
- <td><input type="checkbox"/></td>
- {cells}
-</tr>
-
[ClientStatus.javascript]
function updateClientStatus(id, client) {
updateStatus(id, client);
@@ -135,8 +130,6 @@
<div class="iblock chart">{received}</div>
[ClientSessionSet.html]
-<div class="rfloat">{page}</div>
-
<div class="sactions">
<h2>Act on Selected Sessions:</h2>
<button>Solicit Ack</button>
@@ -148,16 +141,12 @@
<table class="mobjects">
<thead>
<tr>
- <th><input type="checkbox"/></th>
- {headers}
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
</tr>
+ <tr>{headers}</tr>
</thead>
-
<tbody>{items}</tbody>
</table>
-
-[ClientSessionSet.item_html]
-<tr>
- <td><input type="checkbox"/></td>
- {cells}
-</tr>
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/exchange.py 2008-01-08 05:19:48 UTC (rev 1540)
@@ -32,73 +32,131 @@
def render_item_checked_attr(self, session, exchange):
return exchange is self.param.get(session) and "checked=\"checked\""
-class ExchangeSet(ItemSet):
+class ExchangeSet(CuminTable):
def __init__(self, app, name):
super(ExchangeSet, self).__init__(app, name)
+ self.table_sql = "exchange as e"
+ self.where_sql = "where e.vhost_id = %(id)r"
+
+ self.add_sql_join("exchange_stats as c", "c.id", "e.stats_curr_id")
+ self.add_sql_join("exchange_stats as p", "p.id", "e.stats_prev_id")
+
+ self.add_sql_column("id", "e.id")
+ self.add_sql_column("name", "e.name")
+ self.add_sql_column("producers", "c.producers")
+ self.add_sql_column("bindings", "c.bindings")
+ self.add_sql_column("mreceived",
+ "(c.msg_receives - p.msg_receives)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("breceived",
+ "(c.byte_receives - p.byte_receives)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("mrouted",
+ "(c.msg_routes - p.msg_routes)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("brouted",
+ "(c.byte_routes - p.byte_routes)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("mdropped", "c.msg_drops");
+ self.add_sql_column("bdropped", "c.byte_drops");
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+
+ col = self.ProducersColumn(app, "name")
+ self.add_column(col)
+
+ col = self.BindingsColumn(app, "bindings")
+ self.add_column(col)
+
+ col = self.ReceivedColumn(app, "received")
+ self.add_column(col)
+
+ col = self.RoutedColumn(app, "routed")
+ self.add_column(col)
+
+ col = self.DroppedColumn(app, "dropped")
+ self.add_column(col)
+
self.unit = UnitSwitch(app, "unit")
self.add_child(self.unit)
-
- self.paginator = Paginator(app, "page")
- self.add_child(self.paginator)
def get_title(self, session, vhost):
return "Exchanges %s" % fmt_count(self.get_item_count(session, vhost))
- def do_process(self, session, vhost):
- self.paginator.set_count(session, self.get_item_count(session, vhost))
-
- def render_unit_plural(self, session, vhost):
+ def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Msgs."
def get_item_count(self, session, vhost):
return vhost.exchanges.count()
- def do_get_items(self, session, vhost):
- if vhost:
- start, end = self.paginator.get_bounds(session)
- return vhost.exchanges.orderBy("name")[start:end]
+ def get_sql_values(self, session, vhost):
+ return {"id": vhost.id}
- def render_item_link(self, session, exchange):
- branch = session.branch()
- self.page().show_exchange(branch, exchange).show_view(branch)
- name = exchange.name or "<em>Default</em>"
- return fmt_olink(branch, exchange, name=name)
+ class NameColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Name"
- def render_item_producers(self, session, exchange):
- branch = session.branch()
- frame = self.page().show_exchange(branch, exchange)
- frame.show_view(branch).show_producers(branch)
- stat = self.app.model.exchange.get_stat("producers")
- return fmt_link(branch.marshal(), stat.value(exchange))
+ def render_content(self, session, data):
+ exchange = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame().show_exchange(branch, exchange).show_view(branch)
+ name = data["name"] or "<em>Default</em>"
+ return fmt_olink(branch, exchange, name=name)
- def render_item_bindings(self, session, exchange):
- branch = session.branch()
- frame = self.page().show_exchange(branch, exchange)
- frame.show_view(branch).show_bindings(branch)
- stat = self.app.model.exchange.get_stat("bindings")
- return fmt_link(branch.marshal(), stat.value(exchange))
+ class ProducersColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Producers"
- def render_item_received(self, session, exchange):
- unit = self.unit.get(session)
- key = unit == "b" and "byteReceives" or "msgReceives"
- value = self.app.model.exchange.get_stat(key).rate(exchange)
- return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
+ def render_content(self, session, data):
+ exchange = Identifiable(data["id"])
+ branch = session.branch()
+ frame = self.frame().show_exchange(branch, exchange)
+ frame.show_view(branch).show_producers(branch)
+ return fmt_link(branch.marshal(), data["producers"])
- def render_item_routed(self, session, exchange):
- unit = self.unit.get(session)
- key = unit == "b" and "byteRoutes" or "msgRoutes"
- value = self.app.model.exchange.get_stat(key).rate(exchange)
- return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
+ class BindingsColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Bindings"
- def render_item_dropped(self, session, exchange):
- unit = self.unit.get(session)
- key = unit == "b" and "byteDrops" or "msgDrops"
- return self.app.model.exchange.get_stat(key).value(exchange)
+ def render_content(self, session, data):
+ exchange = Identifiable(data["id"])
+ branch = session.branch()
+ frame = self.frame().show_exchange(branch, exchange)
+ frame.show_view(branch).show_bindings(branch)
+ return fmt_link(branch.marshal(), data["bindings"])
- def render_item_status(self, session, exchange):
- return fmt_ostatus(exchange)
+ class ReceivedColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Received" % self.parent.get_unit_plural(session)
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "breceived" or "mreceived"
+
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
+
+ class RoutedColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Routed" % self.parent.get_unit_plural(session)
+
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "brouted" or "mrouted"
+
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
+
+ class DroppedColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Dropped" % self.parent.get_unit_plural(session)
+
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "bdropped" or "mdropped"
+
def show_producers(page, session, exchange):
frame = page.show_exchange(session, exchange).show_view(session)
return frame.show_producers(session)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-01-08 05:19:48 UTC (rev 1540)
@@ -12,33 +12,23 @@
}
[ExchangeSet.html]
-<div class="rfloat">{page}</div>
{unit}
<table class="mobjects">
- <tr>
- <th>Name</th>
- <th class="ralign">Producers</th>
- <th class="ralign">Queue Bindings</th>
- <th class="ralign">{unit_plural} Received</th>
- <th class="ralign">{unit_plural} Routed</th>
- <th class="ralign">{unit_plural} Dropped</th>
- <th>Status</th>
- </tr>
-
- {items}
+ <thead>
+ <tr>
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
</table>
[ExchangeSet.item_html]
-<tr>
- <td>{item_link}</a></td>
- <td class="ralign">{item_producers}</td>
- <td class="ralign">{item_bindings}</td>
- <td class="ralign">{item_received}</td>
- <td class="ralign">{item_routed}</td>
- <td class="ralign">{item_dropped}</td>
- <td>{item_status}</td>
-</tr>
+<tr>{cells}</tr>
[ExchangeForm.html]
<form id="{id}" class="ExchangeForm mform" method="post" action="?">
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-08 05:19:48 UTC (rev 1540)
@@ -3,6 +3,7 @@
from wooly.widgets import *
from wooly.forms import *
from wooly.resources import *
+from wooly.tables import *
from datetime import datetime
from sqlobject.sqlbuilder import LEFTJOINOn
@@ -15,45 +16,63 @@
strings = StringCatalog(__file__)
-class QueueSet(PaginatedItemSet):
+class QueueSet(CuminTable):
def __init__(self, app, name):
super(QueueSet, self).__init__(app, name)
- self.unit = UnitSwitch(app, "unit")
- self.add_child(self.unit)
+ self.table_sql = "queue as q"
+ self.where_sql = "where q.vhost_id = %(id)r"
- self.header = TableHeader(app, "header")
- self.add_child(self.header)
+ self.add_sql_join("queue_stats as c", "c.id", "q.stats_curr_id")
+ self.add_sql_join("queue_stats as p", "p.id", "q.stats_prev_id")
- col = TableColumn(None)
- self.header.add_column(col)
+ self.add_sql_column("id", "q.id")
+ self.add_sql_column("name", "q.name")
+ self.add_sql_column("consumers", "c.consumers")
+ self.add_sql_column("bindings", "c.bindings")
+ self.add_sql_column("menqueued",
+ "(c.msg_total_enqueues - p.msg_total_enqueues)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("benqueued",
+ "(c.byte_total_enqueues - p.byte_total_enqueues)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("mdequeued",
+ "(c.msg_total_dequeues - p.msg_total_dequeues)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("bdequeued",
+ "(c.byte_total_dequeues - p.byte_total_dequeues)" +
+ " / extract(epoch from (c.rec_time - p.rec_time))");
+ self.add_sql_column("mdepth", "c.msg_depth")
+ self.add_sql_column("bdepth", "c.byte_depth")
+ self.add_sql_column("mdepthaccel", "1")
+ self.add_sql_column("bdepthaccel", "1")
- col = TableColumn("name", Queue.q.name, "Name")
- self.header.add_column(col)
+ col = CheckboxColumn(app, "id")
+ self.add_column(col)
- col = TableColumn("consumers", QueueStats.q.consumers,
- "Consumers", "ralign")
- self.header.add_column(col)
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
- col = TableColumn("bindings", QueueStats.q.bindings,
- "Exchange Bindings", "ralign")
- self.header.add_column(col)
-
- col = self.EnqueuedColumn("enqueued", None, None, "ralign")
- self.header.add_column(col)
+ self.set_selected_column(col)
- col = self.DequeuedColumn("dequeued", None, None, "ralign")
- self.header.add_column(col)
+ col = self.ConsumersColumn(app, "consumers")
+ self.add_column(col)
- col = self.DepthColumn("depth", None, None, "ralign")
- self.header.add_column(col)
+ col = self.BindingsColumn(app, "bindings")
+ self.add_column(col)
- col = TableColumn("accel", None, "Depth Accel.", "ralign")
- self.header.add_column(col)
+ col = self.EnqueuedColumn(app, "enqueued")
+ self.add_column(col)
- col = TableColumn("status", None, "Status")
- self.header.add_column(col)
+ col = self.DequeuedColumn(app, "dequeued")
+ self.add_column(col)
+ col = self.DepthColumn(app, "depth")
+ self.add_column(col)
+
+ self.unit = UnitSwitch(app, "unit")
+ self.add_child(self.unit)
+
def get_title(self, session, vhost):
return "Queues %s" % fmt_count(self.get_item_count(session, vhost))
@@ -63,104 +82,74 @@
def get_unit_plural(self, session):
return self.unit.get(session) == "b" and "Bytes" or "Msgs."
- class EnqueuedColumn(TableColumn):
- def get_title(self, session):
- return "%s Enqueued" % self.header.parent.get_unit_plural \
- (session)
-
- def get_data_name(self, session):
- if self.header.parent.unit.get(session) == "b":
- return QueueStats.q.byteTotalEnqueues
- else:
- return QueueStats.q.msgTotalEnqueues
-
- class DequeuedColumn(TableColumn):
- def get_title(self, session):
- return "%s Dequeued" % self.header.parent.get_unit_plural \
- (session)
-
- def get_data_name(self, session):
- if self.header.parent.unit.get(session) == "b":
- return QueueStats.q.byteTotalDequeues
- else:
- return QueueStats.q.msgTotalDequeues
-
- class DepthColumn(TableColumn):
- def get_title(self, session):
- return "%s Depth" % self.header.parent.get_unit_singular(session)
-
- def get_data_name(self, session):
- if self.header.parent.unit.get(session) == "b":
- return QueueStats.q.byteDepth
- else:
- return QueueStats.q.msgDepth
-
def get_item_count(self, session, vhost):
return vhost.queues.count()
- def do_get_items(self, session, vhost):
- if vhost:
- queues = vhost.queues
- queues = queues.filter(Queue.q.statsCurrID == QueueStats.q.id)
+ def get_sql_values(self, session, vhost):
+ return {"id": vhost.id}
- column = self.header.get_selected_column(session)
- queues = column.get_sorted_items(session, queues)
+ class NameColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Name"
- start, end = self.get_bounds(session)
- queues = queues[start:end]
+ def render_content(self, session, data):
+ queue = Identifiable(data["id"])
+ branch = session.branch()
+ self.frame().show_queue(branch, queue).show_view(branch)
+ return fmt_olink(branch, queue, name=data["name"])
- if self.header.is_reversed(session):
- queues = queues.reversed()
+ class ConsumersColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Consumers"
- return queues
+ def render_content(self, session, data):
+ queue = Identifiable(data["id"])
+ branch = session.branch()
+ frame = self.frame().show_queue(branch, queue)
+ frame.show_view(branch).show_consumers(branch)
+ return fmt_link(branch.marshal(), data["consumers"])
- def render_item_link(self, session, queue):
- branch = session.branch()
- self.page().show_queue(branch, queue).show_view(branch)
- return fmt_olink(branch, queue)
+ class BindingsColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "Bindings"
- def render_item_name(self, session, queue):
- return queue.name
+ def render_content(self, session, data):
+ queue = Identifiable(data["id"])
+ branch = session.branch()
+ frame = self.frame().show_queue(branch, queue)
+ frame.show_view(branch).show_bindings(branch)
+ return fmt_link(branch.marshal(), data["bindings"])
- def render_item_consumers(self, session, queue):
- branch = session.branch()
- frame = self.page().show_queue(branch, queue)
- frame.show_view(branch).show_consumers(branch)
- stat = self.app.model.queue.get_stat("consumers")
- return fmt_link(branch.marshal(), stat.value(queue))
+ class EnqueuedColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Enqueued" % self.parent.get_unit_plural(session)
- def render_item_bindings(self, session, queue):
- branch = session.branch()
- frame = self.page().show_queue(branch, queue)
- frame.show_view(branch).show_bindings(branch)
- stat = self.app.model.queue.get_stat("bindings")
- return fmt_link(branch.marshal(), stat.value(queue))
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "benqueued" or "menqueued"
- def render_item_enqueued(self, session, queue):
- unit = self.unit.get(session)
- key = unit == "b" and "byteTotalEnqueues" or "msgTotalEnqueues"
- value = self.app.model.queue.get_stat(key).rate(queue)
- return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
- def render_item_dequeued(self, session, queue):
- unit = self.unit.get(session)
- key = unit == "b" and "byteTotalDequeues" or "msgTotalDequeues"
- value = self.app.model.queue.get_stat(key).rate(queue)
- return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
+ class DequeuedColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Dequeued" % self.parent.get_unit_plural(session)
- def render_item_depth(self, session, queue):
- key = self.unit.get(session) == "b" and "byteDepth" or "msgDepth"
- return self.app.model.queue.get_stat(key).value(queue)
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "bdequeued" or "mdequeued"
- def render_item_depth_accel(self, session, queue):
- unit = self.unit.get(session)
- key = unit == "b" and "byteDepth" or "msgDepth"
- value = self.app.model.queue.get_stat(key).rate(queue)
- return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
- def render_item_status(self, session, queue):
- return fmt_ostatus(queue)
+ class DepthColumn(SqlTableColumn):
+ def get_title(self, session, object):
+ return "%s Depth" % self.parent.get_unit_singular(session)
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "bdepth" or "mdepth"
+
def show_consumers(page, session, queue):
frame = page.show_queue(session, queue).show_view(session)
return frame.show_consumers(session)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/queue.strings 2008-01-08 05:19:48 UTC (rev 1540)
@@ -1,13 +1,5 @@
-[QueueSet.css]
-ul.QueueSet li:before {
- content: url(resource?name=queue-20.png);
- vertical-align: -30%;
- padding: 0 0.25em;
-}
-
[QueueSet.html]
-<!-- <form action="{href}" method="get"> -->
- <div class="rfloat">{page}</div>
+<form>
{unit}
<div class="sactions">
@@ -16,24 +8,19 @@
</div>
<table class="mobjects">
- {header}
- {items}
+ <thead>
+ <tr>
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
</table>
-<!-- </form> -->
+</form>
-[QueueSet.item_html]
-<tr>
- <td><input type="checkbox"/></td>
- <td>{item_link}</a></td>
- <td class="ralign">{item_consumers}</td>
- <td class="ralign">{item_bindings}</td>
- <td class="ralign">{item_enqueued}</td>
- <td class="ralign">{item_dequeued}</td>
- <td class="ralign">{item_depth}</td>
- <td class="ralign">{item_depth_accel}</td>
- <td>{item_status}</td>
-</tr>
-
[QueueForm.html]
<form id="{id}" class="mform" method="post" action="?">
<div class="head">
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-08 05:19:48 UTC (rev 1540)
@@ -374,7 +374,7 @@
def get_limit_sql(self, session):
start, end = self.paginator.get_bounds(session)
- return "limit %i offset %i" % (end, start)
+ return "limit %i offset %i" % (end - start, start)
class PaginatedItemSet(ItemSet):
def __init__(self, app, name):
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/cumin/widgets.strings 2008-01-08 05:19:48 UTC (rev 1540)
@@ -88,10 +88,6 @@
<li>{item_link}</li>
[Paginator.css]
-div.Paginator {
- margin: 0 0 0.5em 0;
-}
-
div.Paginator ul {
display: inline;
}
@@ -108,6 +104,20 @@
[Paginator.item_html]
<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
+[CuminTable.html]
+<table class="mobjects">
+ <thead>
+ <tr>
+ <th class="setnav" colspan="0">
+ <div class="rfloat">{page}</div>
+ {count}
+ </th>
+ </tr>
+ <tr>{headers}</tr>
+ </thead>
+ <tbody>{items}</tbody>
+</table>
+
[TableHeader.css]
th.selected a {
color: black;
Modified: mgmt/cumin/python/wooly/tables.py
===================================================================
--- mgmt/cumin/python/wooly/tables.py 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/wooly/tables.py 2008-01-08 05:19:48 UTC (rev 1540)
@@ -17,7 +17,7 @@
self.add_parameter(self.scolumn)
self.reversed = BooleanParameter(app, "rev")
- self.reversed.set_default(False)
+ self.reversed.default = False
self.add_parameter(self.reversed)
def add_column(self, column):
@@ -33,6 +33,9 @@
if column.name == name:
return column
+ def set_selected_column(self, column):
+ self.scolumn.default = column.name
+
def is_reversed(self, session):
return self.reversed.get(session)
@@ -41,6 +44,10 @@
return None
+ def render_count(self, session, object):
+ count = self.get_item_count(session, object)
+ return "%i %s" % (count, count == 1 and "item" or "items")
+
def render_headers(self, session, object):
writer = Writer()
@@ -89,9 +96,19 @@
def __init__(self, app, name):
super(ItemTableColumn, self).__init__(app, name)
+ def get_column_key(self, session):
+ return self.name
+
def do_render(self, session, data):
- return "<td>%s</td>" % str(data[self.name])
+ return "<td>%s</td>" % self.render_content(session, data)
+ def render_content(self, session, data):
+ key = self.get_column_key(session)
+ return self.render_value(session, data[key])
+
+ def render_value(self, session, value):
+ return str(value)
+
class SqlTable(ItemTable):
def __init__(self, app, name):
super(SqlTable, self).__init__(app, name)
@@ -141,15 +158,9 @@
def get_orderby_sql(self, session):
scol = self.get_selected_column(session)
- sqlcol = self.get_sql_column(scol.name)
- if sqlcol:
- column_sql = sqlcol.get_sql(session)
- dir = self.is_reversed(session) and "desc" or "asc"
- sql = "order by %s %s" % (column_sql, dir)
+ return scol.get_orderby_sql(session)
- return sql
-
def get_limit_sql(self, session):
return None
@@ -169,8 +180,6 @@
sql = writer.to_string()
- #print sql
-
return sql
def get_sql_values(self, session, object):
@@ -179,6 +188,7 @@
def get_connection(self, session):
pass
+ # XXX shouldn't this be do_get_items?
def get_items(self, session, object):
conn = self.get_connection(session)
@@ -187,23 +197,17 @@
sql = self.get_sql(session)
sql_values = self.get_sql_values(session, object)
+ #print "SQL TEXT", sql
+ #print "SQL VALS", sql_values
+
cursor.execute(sql, sql_values)
return cursor
- def do_render(self, session, object):
+ def render_items(self, session, object):
+ writer = Writer()
cursor = self.get_items(session, object)
- if cursor:
- html = super(ItemSet, self).do_render(session, cursor)
- else:
- html = self.render_none(session, object)
-
- return html
-
- def render_items(self, session, cursor):
- writer = Writer()
-
for row in cursor:
self.item_tmpl.render(session, row, writer)
@@ -229,7 +233,7 @@
self.sql = sql
def get_sql(self, session):
- return self.sql
+ return "%s as %s" % (self.sql, self.name)
class SqlJoin(object):
def __init__(self, table,
@@ -259,3 +263,16 @@
"=", self.get_fk_column_sql(session))
return " ".join(elems)
+
+class SqlTableColumn(ItemTableColumn):
+ def get_orderby_sql(self, session):
+ key = self.get_column_key(session)
+
+ if key:
+ dir = self.parent.is_reversed(session) and "desc" or "asc"
+ return "order by %s %s" % (key, dir)
+
+class CheckboxColumn(ItemTableColumn):
+ def do_render(self, session, data):
+ return "<td><input type=\"checkbox\" name=\"%s\"/></td>" % \
+ data[self.name]
Modified: mgmt/cumin/python/wooly/tables.strings
===================================================================
--- mgmt/cumin/python/wooly/tables.strings 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/cumin/python/wooly/tables.strings 2008-01-08 05:19:48 UTC (rev 1540)
@@ -1,6 +1,6 @@
[ItemTable.html]
<table>
- <thead>{headers}</thead>
+ <thead><tr>{headers}</tr></thead>
<tbody>{items}</tbody>
</table>
@@ -8,6 +8,4 @@
<th class="{header_class}"><a href="{header_href}">{header_content}</a></th>
[ItemTable.item_html]
-<tr>
- {cells}
-</tr>
+<tr>{cells}</tr>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-07 21:37:50 UTC (rev 1539)
+++ mgmt/notes/justin-todo.txt 2008-01-08 05:19:48 UTC (rev 1540)
@@ -12,16 +12,8 @@
- Display current values on right-side and according to color
- - Add y-axis ticks and values for reference
-
- Add a "rate" mode to charts
- * Sortify brokers
-
- * Sortify clients
-
- * Sortify sessions
-
* Mgmtd-broker interaction
- Deal with problem of calling method on broker that is not there
@@ -30,13 +22,26 @@
- Handle other exception conditions on broker connect more gracefully
- * Add "slowest views" tracking to --bench
+ * Tables
+ - Indicate selected (sorted-by) column
+
+ - Add sort direction icon
+
+ - Deal with large numbers of pages in paginators
+
+ - Change first-click sort to desc for number fields
+
+ * Div by zero error in queues view
+
Deferred
- * Prevent browsers from caching the chart pngs and then running out
- of memory
+ * Add "slowest views" tracking to --bench
+ * Get rid of SQLObjectItemSet
+
+ * Sortify brokers
+
* Only perform js updates if there's new data
* Avoid dirtying js namespace with updateFoo methods
@@ -46,12 +51,6 @@
* Directly set attr.default for static defaults; eliminate
attr.set_default
- * Add sort direction icon
-
- * Deal with large numbers of pages in paginators
-
- * Change first-click sort to desc for number fields
-
* Rename BrokerAdd on CuminPage to BrokerSetAdd
* So that list params can embed an item param, find a way to avoid
@@ -61,8 +60,6 @@
* Sortify broker groups
- * Sortify exchanges
-
* Broker groups
- Group form submit has different behaviors between hitting enter
@@ -70,12 +67,8 @@
* Add [None] to groups field in broker view
- * Go back to Widget.parent as an attr, not a function
-
* Indicate how old stats are
- * Need way to control connectToBroker timeout
-
* Add broker reg name unique constraint and validation
* Whereever it makes sense, add a switch to display living, dead, or
@@ -92,8 +85,6 @@
* Paginate consumers
- * Paginate sessions
-
* Email amqp-list, Jonathan, and Lana with doc requirements for mgmt
* Ask tross to take some prints out of ManagedBroker.start
@@ -165,5 +156,3 @@
* Add a sanity check traversal to the widget tree and to the
registered sets of widgets and parameters
-
- * Add a frame() accessor to Widget
18 years, 3 months
rhmessaging commits: r1539 - store/trunk/cpp.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-01-07 16:37:50 -0500 (Mon, 07 Jan 2008)
New Revision: 1539
Modified:
store/trunk/cpp/rhm.spec.in
Log:
add missing dependencies on libaio, cppunit, qpidc-devel
Modified: store/trunk/cpp/rhm.spec.in
===================================================================
--- store/trunk/cpp/rhm.spec.in 2008-01-07 15:48:52 UTC (rev 1538)
+++ store/trunk/cpp/rhm.spec.in 2008-01-07 21:37:50 UTC (rev 1539)
@@ -3,7 +3,7 @@
#
Name: rhm
Version: @VERSION@
-Release: 6%{?dist}
+Release: 11%{?dist}
Summary: Red Hat extensions to the Qpid messaging system
Group: System Environment/Libraries
License: LGPL
@@ -11,14 +11,20 @@
Source0: http://rhm.et.redhat.com/download/%{name}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+ExclusiveArch: i386 x86_64
+
+BuildRequires: qpidc-devel
BuildRequires: qpidd-devel
BuildRequires: db4-devel
# TODO: Workaround missing dependency in qpidd-devel. Remove this
# when qpid-devel is updated.
BuildRequires: e2fsprogs-devel
+BuildRequires: libaio-devel
+BuildRequires: cppunit-devel
Requires: qpidd
Requires: db4
+Requires: libaio
Requires(preun):/sbin/service
Requires(postun):/sbin/service
@@ -80,6 +86,12 @@
%changelog
+* Thu Jan 03 2008 Nuno Santos <nsantos(a)redhat.com> - 0.2-11
+- add missing dependencies on libaio, cppunit, qpidc-devel
+
+* Thu Jan 03 2008 Nuno Santos <nsantos(a)redhat.com> - 0.2-6
+- limit builds to i386 and x86_64 archs
+
* Tue Dec 18 2007 Nuno Santos <nsantos(a)redhat.com> - 0.2-5
- Include several fixes, mainly from Kim Van Der Riet (BZ 401071: Add journal
file geometry parameters to broker, 401091: Handle journal full condition in
18 years, 3 months
rhmessaging commits: r1538 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-07 10:48:52 -0500 (Mon, 07 Jan 2008)
New Revision: 1538
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/wooly/__init__.py
mgmt/cumin/python/wooly/server.py
Log:
Adds a no-cache directive to the chart png page.
Formats y-axis values, shortens them.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/cumin/charts.py 2008-01-07 15:48:52 UTC (rev 1538)
@@ -82,9 +82,15 @@
cr.line_to(self.width + 2, y)
if i % 2 == 0:
- value = self.y_max - (self.y_max * y / float(self.height))
- cr.show_text(str(value))
+ value = int(self.y_max - (self.y_max * y / float(self.height)))
+ if value > 10000:
+ svalue = "%ik" % (value / 1000)
+ else:
+ svalue = str(value)
+
+ cr.show_text(svalue)
+
i += 1
self.stroke(cr)
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-07 15:48:52 UTC (rev 1538)
@@ -113,6 +113,9 @@
def get_content_type(self, session):
return "image/png"
+ def get_cache_control(self, session):
+ return "no-cache"
+
def do_render(self, session, object):
chart = LineChart(480, 120)
Modified: mgmt/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/cumin/python/wooly/__init__.py 2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/wooly/__init__.py 2008-01-07 15:48:52 UTC (rev 1538)
@@ -343,6 +343,9 @@
def get_content_type(self, session):
return "text/html"
+ def get_cache_control(self, session):
+ return None
+
def save_session(self, session):
pass
Modified: mgmt/cumin/python/wooly/server.py
===================================================================
--- mgmt/cumin/python/wooly/server.py 2008-01-06 05:02:43 UTC (rev 1537)
+++ mgmt/cumin/python/wooly/server.py 2008-01-07 15:48:52 UTC (rev 1538)
@@ -6,6 +6,7 @@
from wooly import *
from devel import DevelPage
+
class WebServer(object):
def __init__(self, app, port=8080):
self.app = app
@@ -86,15 +87,20 @@
self.send_response(200)
+ if modified:
+ ts = modified.strftime("%a, %d %b %Y %H:%M:%S GMT")
+ self.send_header("Last-Modified", ts)
+
type = page.get_content_type(session)
if type:
self.send_header("Content-Type", type)
- if modified:
- ts = modified.strftime("%a, %d %b %Y %H:%M:%S GMT")
- self.send_header("Last-Modified", ts)
+ cache = page.get_cache_control(session)
+ if cache:
+ self.send_header("Cache-Control", cache)
+
self.end_headers()
self.wfile.write(response)
18 years, 3 months
rhmessaging commits: r1537 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-06 00:02:43 -0500 (Sun, 06 Jan 2008)
New Revision: 1537
Modified:
mgmt/cumin/python/cumin/charts.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
mgmt/notes/justin-todo.txt
Log:
Working toward better charts.
Adds reference values in the y dimension. Adds neatly divisible
rounding.
Makes the drawing logic resilient to varying x max values, so we can
introduce variable time ranges in charts.
Modified: mgmt/cumin/python/cumin/charts.py
===================================================================
--- mgmt/cumin/python/cumin/charts.py 2008-01-04 21:25:32 UTC (rev 1536)
+++ mgmt/cumin/python/cumin/charts.py 2008-01-06 05:02:43 UTC (rev 1537)
@@ -10,21 +10,22 @@
self.width = width
self.height = height
self.surface = ImageSurface(FORMAT_ARGB32, width + 60, height + 20)
- self.max_value = 1
- self.value_interval = 5
+ self.surface.set_device_offset(0.5, 8.5)
+ self.x_max = 1
+ self.y_max = 1
- def set_max_value(self, value):
- self.max_value = value
+ def set_x_max(self, value):
+ self.x_max = value
- def set_value_interval(self, interval):
- self.value_interval = interval
+ def set_y_max(self, value):
+ self.y_max = value
def plot_values(self, samples, color=(0, 0, 0)):
cr = Context(self.surface)
cr.set_line_width(2)
cr.set_source_rgb(*color)
- tzero = time()
+ tnow = time()
for dt, value in samples:
if value is None:
@@ -32,49 +33,63 @@
value = 0
t = secs(dt)
- x = self.width + (t - tzero)
- y = self.height - (value / float(self.max_value)) * self.height
+
+ x = self.width - ((tnow - t) / float(self.x_max)) * self.width
+ y = self.height - (value / float(self.y_max)) * self.height
cr.line_to(x, y)
- cr.stroke()
+ self.stroke(cr)
def plot_frame(self, color=(0.8, 0.8, 0.8)):
cr = Context(self.surface)
cr.set_line_width(1)
cr.set_source_rgb(*color)
-
- cr.rectangle(0.5, 0.5, self.width, self.height)
- cr.stroke()
+ cr.move_to(self.width, 0)
+ cr.line_to(self.width, self.height)
+ cr.line_to(0, self.height)
- def plot_x_axis(self, interval=60):
+ self.stroke(cr)
+
+ def plot_x_axis(self, interval):
cr = Context(self.surface)
cr.set_line_width(0.2)
- cr.set_source_rgb(0.8, 0.8, 0.8)
+ cr.set_source_rgb(0.6, 0.6, 0.6)
- xs = range(self.width, 0 - interval, -interval)
+ i = 0
- for x, i in zip(xs, range(0, 120)):
+ for x in range(self.width, 0 - interval, -interval):
cr.move_to(x, 0)
cr.line_to(x, self.height + 10)
if i % 2 == 0:
- value = self.width - x
+ value = self.x_max - (self.x_max * x / float(self.width))
cr.show_text(fmt_duration_brief(value))
- cr.stroke()
+ i += 1
- def plot_y_axis(self):
+ self.stroke(cr)
+
+ def plot_y_axis(self, interval):
cr = Context(self.surface)
+ cr.set_line_width(0.2)
+ cr.set_source_rgb(0.6, 0.6, 0.6)
- x = self.width + 2
+ i = 0
- cr.move_to(x, 9)
- cr.show_text(str(self.max_value))
+ for y in range(self.height, 0 - interval, -interval):
+ cr.move_to(0, y)
+ cr.line_to(self.width + 2, y)
- cr.move_to(x, self.height)
- cr.show_text("0")
+ if i % 2 == 0:
+ value = self.y_max - (self.y_max * y / float(self.height))
+ cr.show_text(str(value))
+ i += 1
+
+ self.stroke(cr)
+
+ def stroke(self, cr):
cr.stroke()
def write(self, writer):
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-01-04 21:25:32 UTC (rev 1536)
+++ mgmt/cumin/python/cumin/model.py 2008-01-06 05:02:43 UTC (rev 1537)
@@ -89,12 +89,12 @@
self.cumin_class.add_stat(self)
- def samples(self, object, secs=600):
+ def samples(self, object, secs):
stats = object.stats
col = self.cumin_class.mint_stats_class.q.recTime
dt = datetime.now() - timedelta(seconds=secs)
- stats = stats.filter(col > dt)
+ stats = stats.filter(col >= dt)
stats = stats.orderBy("-recTime")
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-04 21:25:32 UTC (rev 1536)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-06 05:02:43 UTC (rev 1537)
@@ -1,6 +1,7 @@
from wooly import *
from wooly.widgets import *
from mint import *
+from math import sqrt
from widgets import *
from parameters import *
@@ -113,7 +114,7 @@
return "image/png"
def do_render(self, session, object):
- chart = LineChart(600, 120)
+ chart = LineChart(480, 120)
cls = self.class_.get(session)
stats = [cls.get_stat(x) for x in self.stats.get(session)]
@@ -123,7 +124,7 @@
values = dict()
for stat in stats:
- samples[stat] = stat.samples(object)
+ samples[stat] = stat.samples(object, 600)
values[stat] = [x[1] for x in samples[stat]]
max_value = 0
@@ -133,13 +134,25 @@
if vals:
max_value = max(max(vals), max_value)
- max_value = max_value * 1.1
- max_value = max_value + (10 - max_value % 10)
- chart.set_max_value(int(max_value))
+ max_value = int(max_value * 1.1)
- chart.plot_x_axis()
- chart.plot_y_axis()
+ if max_value < 10:
+ round = 6
+ elif max_value < 100:
+ round = 60
+ elif max_value < 10000:
+ round = 600
+ else:
+ round = 6000
+ max_value = max_value + (round - max_value % round)
+
+ chart.set_x_max(600)
+ chart.set_y_max(max_value)
+
+ chart.plot_x_axis(48)
+ chart.plot_y_axis(20)
+
colors = ((1,0,0), (0,0,1), (0,1,0))
for stat, color in zip(stats, colors):
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-04 21:25:32 UTC (rev 1536)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-06 05:02:43 UTC (rev 1537)
@@ -80,7 +80,7 @@
}
[StatValueChart.html]
-<img id="{id}" src="{href}" height="140" width="660"/>
+<img id="{id}" src="{href}" height="140" width="540"/>
<script>
cumin.listeners["{id}"] = updateChartImage
</script>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-04 21:25:32 UTC (rev 1536)
+++ mgmt/notes/justin-todo.txt 2008-01-06 05:02:43 UTC (rev 1537)
@@ -6,8 +6,6 @@
- "purge messages from queues"
- - "unregister brokers"
-
* Improve charts
- Add legends to charts
@@ -36,6 +34,9 @@
Deferred
+ * Prevent browsers from caching the chart pngs and then running out
+ of memory
+
* Only perform js updates if there's new data
* Avoid dirtying js namespace with updateFoo methods
@@ -97,8 +98,6 @@
* Ask tross to take some prints out of ManagedBroker.start
- * Get rid of CuminClass.mint_stats_class
-
* Add a do_get_item_count, and cache result for use by get_item_count
* Add a ~3 second (or use broker update interval, if we can get that)
18 years, 3 months
rhmessaging commits: r1536 - in store/trunk/cpp: tests/jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-01-04 16:25:32 -0500 (Fri, 04 Jan 2008)
New Revision: 1536
Modified:
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/tests/jrnl/
store/trunk/cpp/tests/jrnl/Makefile.am
Log:
Minor updates and fixes
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-01-04 21:25:32 UTC (rev 1536)
@@ -97,6 +97,10 @@
jcntl::initialize(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb,
std::deque<data_tok*>* wdtoklp, const aio_cb wr_cb)
{
+ _init_flag = false;
+ _stop_flag = false;
+ _readonly_flag = false;
+
// Prepare journal dir, journal files and file handles
_jdir.clear_dir();
_emap.clear();
@@ -139,6 +143,10 @@
jcntl::recover(std::deque<data_tok*>* rdtoklp, const aio_cb rd_cb, std::deque<data_tok*>* wdtoklp,
const aio_cb wr_cb, const std::vector<std::string>& prep_txn_list, u_int64_t& highest_rid)
{
+ _init_flag = false;
+ _stop_flag = false;
+ _readonly_flag = false;
+
// Verify journal dir and journal files
_jdir.verify_dir();
_rcvdat.reset();
@@ -354,7 +362,7 @@
}
void
-jcntl::stop(bool block_till_aio_cmpl)
+jcntl::stop(const bool block_till_aio_cmpl)
{
if (_readonly_flag)
check_rstatus("stop");
@@ -362,24 +370,24 @@
check_wstatus("stop");
_stop_flag = true;
if (!_readonly_flag)
- {
- flush();
- if (block_till_aio_cmpl)
- aio_cmpl_wait();
- }
+ flush(block_till_aio_cmpl);
}
const iores
-jcntl::flush()
+jcntl::flush(const bool block_till_aio_cmpl)
{
if (!_init_flag)
return RHM_IORES_SUCCESS;
if (_readonly_flag)
throw jexception(jerrno::JERR_JCNTL_READONLY, "jcntl", "flush");
+ iores res;
{
slock s(&_wr_mutex);
- return _wmgr.flush();
+ res = _wmgr.flush();
}
+ if (block_till_aio_cmpl)
+ aio_cmpl_wait();
+ return res;
}
// Private functions
@@ -430,7 +438,7 @@
_wmgr.get_events(pmgr::UNUSED);
if (cnt++ > MAX_AIO_CMPL_SLEEPS)
throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "aio_cmpl_wait");
- usleep(AIO_CMPL_SLEEP);
+ ::usleep(AIO_CMPL_SLEEP);
}
}
@@ -445,7 +453,7 @@
{
if (cnt++ > MAX_AIO_CMPL_SLEEPS)
throw jexception(jerrno::JERR_JCNTL_AIOCMPLWAIT, "jcntl", "aio_cmpl_wait");
- usleep(AIO_CMPL_SLEEP);
+ ::usleep(AIO_CMPL_SLEEP);
}
return true;
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-01-04 21:25:32 UTC (rev 1536)
@@ -510,12 +510,12 @@
* \param block_till_aio_cmpl If true, will block the thread while waiting for all
* outstanding AIO operations to complete.
*/
- void stop(bool block_till_aio_cmpl = false);
+ void stop(const bool block_till_aio_cmpl = false);
/**
* \brief Force a flush of the write page cache, creating a single AIO write operation.
*/
- const iores flush();
+ const iores flush(const bool block_till_aio_cmpl = false);
inline const u_int32_t get_enq_cnt() const { return _emap.size(); }
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-01-04 21:25:32 UTC (rev 1536)
@@ -94,6 +94,10 @@
wmgr::initialize(std::deque<data_tok*>* dtoklp, const aio_cb wr_cb, const u_int32_t max_dtokpp,
const u_int32_t max_iowait_us, size_t eo)
{
+ _enq_busy = false;
+ _deq_busy = false;
+ _abort_busy = false;
+ _commit_busy = false;
_dtoklp = dtoklp;
_max_dtokpp = max_dtokpp;
_max_io_wait_us = max_iowait_us;
Property changes on: store/trunk/cpp/tests/jrnl
___________________________________________________________________
Name: svn:ignore
- .deps
.libs
Makefile
Makefile.in
jtest
unit_test_enq_map
unit_test_jerrno
unit_test_jexception
unit_test_jdir
unit_test_rec_hdr
unit_test_jinf
unit_test_txn_map
+ .deps
.libs
Makefile
Makefile.in
jtest
unit_test_enq_map
unit_test_jdir
unit_test_jerrno
unit_test_jexception
unit_test_jinf
unit_test_rec_hdr
unit_test_txn_map
Modified: store/trunk/cpp/tests/jrnl/Makefile.am
===================================================================
--- store/trunk/cpp/tests/jrnl/Makefile.am 2008-01-04 16:44:14 UTC (rev 1535)
+++ store/trunk/cpp/tests/jrnl/Makefile.am 2008-01-04 21:25:32 UTC (rev 1536)
@@ -48,8 +48,8 @@
unit_test_enq_map \
unit_test_txn_map
-UNIT_TEST_SRCS=../unit_test.cpp
-UNIT_TEST_LDADD= -lboost_unit_test_framework -lbdbstore -L../../lib/.libs
+UNIT_TEST_SRCS = ../unit_test.cpp
+UNIT_TEST_LDADD = -lboost_unit_test_framework -lbdbstore -L../../lib/.libs
unit_test_jexception_SOURCES = unit_test_jexception.cpp $(UNIT_TEST_SRCS)
unit_test_jexception_LDFLAGS = $(UNIT_TEST_LDADD)
18 years, 3 months
rhmessaging commits: r1535 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-04 11:44:14 -0500 (Fri, 04 Jan 2008)
New Revision: 1535
Modified:
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/widgets.py
mgmt/notes/justin-todo.txt
Log:
Gets rid of a duplicate method name.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-01-04 16:38:31 UTC (rev 1534)
+++ mgmt/cumin/python/cumin/model.py 2008-01-04 16:44:14 UTC (rev 1535)
@@ -21,10 +21,6 @@
def add_class(self, cls):
self.classes.append(cls)
- # XXX get rid of this
- def get_class(self, mint_object):
- return self.get_class_by_object(mint_object)
-
def get_class_by_object(self, mint_object):
for cls in self.classes:
if cls.mint_class is mint_object.__class__:
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-04 16:38:31 UTC (rev 1534)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-04 16:44:14 UTC (rev 1535)
@@ -24,7 +24,7 @@
def do_get_items(self, session, object):
stats = list()
- cls = self.app.model.get_class(object)
+ cls = self.app.model.get_class_by_object(object)
for stat in cls.stats:
if self.category in stat.categories:
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-04 16:38:31 UTC (rev 1534)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-04 16:44:14 UTC (rev 1535)
@@ -184,7 +184,7 @@
writer.write("<objects>");
for object in objects:
- cls = self.app.model.get_class(object)
+ cls = self.app.model.get_class_by_object(object)
cls.write_xml(object, writer)
writer.write("</objects>");
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-04 16:38:31 UTC (rev 1534)
+++ mgmt/notes/justin-todo.txt 2008-01-04 16:44:14 UTC (rev 1535)
@@ -36,6 +36,8 @@
Deferred
+ * Only perform js updates if there's new data
+
* Avoid dirtying js namespace with updateFoo methods
* Add a widget for the html client side of chart images
18 years, 3 months
rhmessaging commits: r1534 - mgmt/notes.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-04 11:38:31 -0500 (Fri, 04 Jan 2008)
New Revision: 1534
Modified:
mgmt/notes/justin-todo.txt
Log:
Todo updates
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2008-01-04 15:50:25 UTC (rev 1533)
+++ mgmt/notes/justin-todo.txt 2008-01-04 16:38:31 UTC (rev 1534)
@@ -18,12 +18,6 @@
- Add a "rate" mode to charts
- - Limit samples query by time
-
- - Return samples data in column-oriented structure
-
- - Unbreak the query behind stats
-
* Sortify brokers
* Sortify clients
@@ -38,14 +32,12 @@
- Handle other exception conditions on broker connect more gracefully
- * Remove sqlobject workaround in CuminStat.samples
-
- * Default exchange name in queue and exchange bindings is still ""
-
* Add "slowest views" tracking to --bench
Deferred
+ * Avoid dirtying js namespace with updateFoo methods
+
* Add a widget for the html client side of chart images
* Directly set attr.default for static defaults; eliminate
18 years, 3 months
rhmessaging commits: r1533 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-04 10:50:25 -0500 (Fri, 04 Jan 2008)
New Revision: 1533
Modified:
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
mgmt/cumin/python/cumin/widgets.py
Log:
A step toward better charts. Changes the page and widget
infrastructure for charts. Adds more configuration capabilities to
the chart png target.
Simplifies listeners for live updates (charts and otherwise).
Introduces a CuminClassParameter for generic object ids.
Where possible moves stats js code into the reusable widgets
themselves rather than in the caller.
Adds cumin class lookup by name.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/__init__.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -13,9 +13,10 @@
from model import CuminModel
from demo import DemoData
from page import CuminPage
-from queue import QueueXmlPage, QueueChartPage
-from exchange import ExchangeXmlPage, ExchangeChartPage
-from client import ClientXmlPage, ClientChartPage
+from queue import QueueXmlPage
+from exchange import ExchangeXmlPage
+from client import ClientXmlPage
+from stat import StatChartPage
class Cumin(Application):
def __init__(self):
@@ -41,11 +42,9 @@
self.add_page(ResourcePage(self, "resource"))
self.add_page(DevelPage(self, "devel.html"))
self.add_page(QueueXmlPage(self, "queue.xml"))
- self.add_page(QueueChartPage(self, "queue.png"))
self.add_page(ExchangeXmlPage(self, "exchange.xml"))
- self.add_page(ExchangeChartPage(self, "exchange.png"))
self.add_page(ClientXmlPage(self, "client.xml"))
- self.add_page(ClientChartPage(self, "client.png"))
+ self.add_page(StatChartPage(self, "stats.png"))
class CuminServer(WebServer):
def __init__(self, port=9090):
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/client.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -244,17 +244,20 @@
return "Current"
class StatisticsHistory(Widget):
- def get_title(self, session, client):
- return "History"
+ def __init__(self, app, name):
+ super(ClientStatistics.StatisticsHistory, self).__init__(app, name)
- def render_sent_chart_url(self, session, client):
- return "client.png?id=%i;s=framesFromClient;s=bytesFromClient" \
- % client.id
+ chart = StatValueChart(app, "sent")
+ chart.stats = ("framesFromClient", "bytesFromClient")
+ self.add_child(chart)
- def render_received_chart_url(self, session, client):
- return "client.png?id=%i;s=framesToClient;s=bytesToClient" \
- % client.id
+ chart = StatValueChart(app, "received")
+ chart.stats = ("framesToClient", "bytesToClient")
+ self.add_child(chart)
+ def get_title(self, session, client):
+ return "History"
+
class ClientSessionSet(CuminTable):
def __init__(self, app, name):
super(ClientSessionSet, self).__init__(app, name)
@@ -313,11 +316,3 @@
self.add_parameter(self.clients)
self.set_list_parameter(self.clients)
-
-class ClientChartPage(CuminChartPage):
- def __init__(self, app, name):
- super(ClientChartPage, self).__init__(app, name)
-
- self.client = ClientParameter(app, "id")
- self.add_parameter(self.client)
- self.set_object_parameter(self.client)
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/client.strings 2008-01-04 15:50:25 UTC (rev 1533)
@@ -70,7 +70,7 @@
</table>
</div>
<script>
- cumin.client.listeners["{id}"] = updateClientStatus, 3000;
+ cumin.listeners["{id}"] = updateClientStatus, 3000;
</script>
[ClientView.javascript]
@@ -83,8 +83,8 @@
break;
}
- for (var id in cumin.client.listeners) {
- cumin.client.listeners[id](id, client);
+ for (var id in cumin.listeners) {
+ cumin.listeners[id](id, client);
}
}
@@ -126,26 +126,14 @@
</td>
</tr>
</table>
-<script>
- cumin.client.listeners["{id}.general"] = updateStats;
-</script>
[StatisticsHistory.html]
<h2>Sent</h2>
-<div class="iblock chart">
- <img id="{id}.sent" src="{sent_chart_url}"/>
-</div>
+<div class="iblock chart">{sent}</div>
<h2>Received</h2>
-<div class="iblock chart">
- <img id="{id}.received" src="{received_chart_url}"/>
-</div>
+<div class="iblock chart">{received}</div>
-<script>
- cumin.client.listeners["{id}.sent"] = updateImage
- cumin.client.listeners["{id}.received"] = updateImage
-</script>
-
[ClientSessionSet.html]
<div class="rfloat">{page}</div>
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/exchange.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -347,7 +347,8 @@
class StatisticsCurrent(Widget):
def __init__(self, app, name):
- super(ExchangeStatistics.StatisticsCurrent, self).__init__(app, name)
+ super(ExchangeStatistics.StatisticsCurrent, self).__init__ \
+ (app, name)
self.add_child(StatSet(app, "general", "general"))
@@ -355,19 +356,25 @@
return "Current"
class StatisticsHistory(Widget):
- def get_title(self, session, queue):
- return "History"
+ def __init__(self, app, name):
+ super(ExchangeStatistics.StatisticsHistory, self).__init__ \
+ (app, name)
- def render_received_chart_url(self, session, queue):
- return "exchange.png?id=%i;s=msgReceives;s=byteReceives" % queue.id
+ chart = StatValueChart(app, "received")
+ chart.stats = ("msgReceives", "byteReceives")
+ self.add_child(chart)
- def render_dropped_chart_url(self, session, queue):
- return "exchange.png?id=%i;s=msgDrops;s=byteDrops" % queue.id
+ chart = StatValueChart(app, "routed")
+ chart.stats = ("msgRoutes", "byteRoutes")
+ self.add_child(chart)
- def render_routed_chart_url(self, session, queue):
- return "exchange.png?id=%i;s=msgRoutes;s=byteRoutes" \
- % queue.id
+ chart = StatValueChart(app, "dropped")
+ chart.stats = ("msgDrops", "byteDrops")
+ self.add_child(chart)
+ def get_title(self, session, queue):
+ return "History"
+
class ExchangeProducerSet(ItemSet):
def get_title(self, session, exchange):
return "Producers %s" % \
@@ -407,11 +414,3 @@
self.add_parameter(self.exchanges)
self.set_list_parameter(self.exchanges)
-
-class ExchangeChartPage(CuminChartPage):
- def __init__(self, app, name):
- super(ExchangeChartPage, self).__init__(app, name)
-
- self.param = ExchangeParameter(app, "id")
- self.add_parameter(self.param)
- self.set_object_parameter(self.param)
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/exchange.strings 2008-01-04 15:50:25 UTC (rev 1533)
@@ -133,7 +133,7 @@
</table>
</div>
<script>
- cumin.exchange.listeners["{id}"] = updateExchangeStatus
+ cumin.listeners["{id}"] = updateExchangeStatus
</script>
[ExchangeView.javascript]
@@ -143,10 +143,11 @@
for (var key in exchanges) {
exchange = exchanges[key];
+ break;
}
- for (var id in cumin.exchange.listeners) {
- cumin.exchange.listeners[id](id, exchange);
+ for (var id in cumin.listeners) {
+ cumin.listeners[id](id, exchange);
}
}
@@ -205,32 +206,17 @@
</td>
</tr>
</table>
-<script>
- cumin.exchange.listeners["{id}.general"] = updateStats;
-</script>
[StatisticsHistory.html]
<h2>Received</h2>
-<div class="iblock chart">
- <img id="{id}.received" src="{received_chart_url}"/>
-</div>
+<div class="iblock chart">{received}</div>
<h2>Routed</h2>
-<div class="iblock chart">
- <img id="{id}.routed" src="{routed_chart_url}"/>
-</div>
+<div class="iblock chart">{routed}</div>
<h2>Dropped</h2>
-<div class="iblock chart">
- <img id="{id}.dropped" src="{dropped_chart_url}"/>
-</div>
+<div class="iblock chart">{dropped}</div>
-<script>
- cumin.exchange.listeners["{id}.received"] = updateImage
- cumin.exchange.listeners["{id}.routed"] = updateImage
- cumin.exchange.listeners["{id}.dropped"] = updateImage
-</script>
-
[ExchangeProducerSet.html]
<div class="sactions">
<h2>Act on Selected Producers:</h2>
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/model.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -10,7 +10,7 @@
def __init__(self):
self.data = MintModel()
- self.classes = dict()
+ self.classes = list()
self.queue = CuminQueue(self)
self.exchange = CuminExchange(self)
@@ -19,11 +19,22 @@
self.session = CuminSession(self)
def add_class(self, cls):
- self.classes[cls.mint_class] = cls
+ self.classes.append(cls)
+ # XXX get rid of this
def get_class(self, mint_object):
- return self.classes[mint_object.__class__]
+ return self.get_class_by_object(mint_object)
+ def get_class_by_object(self, mint_object):
+ for cls in self.classes:
+ if cls.mint_class is mint_object.__class__:
+ return cls
+
+ def get_class_by_name(self, name):
+ for cls in self.classes:
+ if cls.name == name:
+ return cls
+
class CuminClass(object):
def __init__(self, model, name, mint_class):
self.model = model
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/page.strings 2008-01-04 15:50:25 UTC (rev 1533)
@@ -573,33 +573,10 @@
cumin = new Cumin();
function Cumin() {
- this.queue = new Object();
- this.queue.listeners = new Object();
-
- this.exchange = new Object();
- this.exchange.listeners = new Object();
-
- this.client = new Object();
- this.client.listeners = new Object();
+ this.listeners = new Object();
}
}())
-function updateImage(id, object) {
- var img = wooly.doc().elembyid(id);
-
- var src = img.getattr("src");
- var sep = src.lastIndexOf(";");
- var time = new Date().getTime();
-
- if (isNaN(parseInt(src.substring(sep + 1)))) {
- src = src + ";" + time;
- } else {
- src = src.substring(0, sep) + ";" + time;
- }
-
- img.setattr("src", src);
-}
-
[CuminPage.html]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/parameters.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -1,6 +1,13 @@
from wooly import *
from mint import *
+class CuminClassParameter(Parameter):
+ def do_unmarshal(self, string):
+ return self.app.model.get_class_by_name(string)
+
+ def do_marshal(self, cls):
+ return cls.name
+
class BrokerClusterParameter(Parameter):
def do_unmarshal(self, string):
return BrokerCluster.get(int(string))
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/queue.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -541,19 +541,24 @@
return "Current"
class StatisticsHistory(Widget):
- def get_title(self, session, queue):
- return "History"
+ def __init__(self, app, name):
+ super(QueueStatistics.StatisticsHistory, self).__init__(app, name)
- def render_depth_chart_url(self, session, queue):
- return "queue.png?id=%i;s=msgDepth;s=byteDepth" % queue.id
+ chart = StatValueChart(app, "depth")
+ chart.stats = ("msgDepth", "byteDepth")
+ self.add_child(chart)
- def render_consumers_chart_url(self, session, queue):
- return "queue.png?id=%i;s=consumers" % queue.id
+ chart = StatValueChart(app, "consumers")
+ chart.stats = ("consumers",)
+ self.add_child(chart)
- def render_transactions_chart_url(self, session, queue):
- return "queue.png?id=%i;s=enqueueTxnCount;s=dequeueTxnCount" \
- % queue.id
+ chart = StatValueChart(app, "transactions")
+ chart.stats = ("enqueueTxnCount", "dequeueTxnCount")
+ self.add_child(chart)
+ def get_title(self, session, queue):
+ return "History"
+
class QueueConsumerSet(PaginatedItemSet):
def get_title(self, session, queue):
return "Consumers %s" % fmt_count(self.get_item_count(session, queue))
@@ -599,11 +604,3 @@
self.add_parameter(self.queues)
self.set_list_parameter(self.queues)
-
-class QueueChartPage(CuminChartPage):
- def __init__(self, app, name):
- super(QueueChartPage, self).__init__(app, name)
-
- self.queue = QueueParameter(app, "id")
- self.add_parameter(self.queue)
- self.set_object_parameter(self.queue)
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/queue.strings 2008-01-04 15:50:25 UTC (rev 1533)
@@ -133,7 +133,7 @@
</table>
</div>
<script>
- cumin.queue.listeners["{id}"] = updateQueueStatus
+ cumin.listeners["{id}"] = updateQueueStatus
</script>
[QueueView.javascript]
@@ -146,8 +146,8 @@
break;
}
- for (var id in cumin.queue.listeners) {
- cumin.queue.listeners[id](id, queue);
+ for (var id in cumin.listeners) {
+ cumin.listeners[id](id, queue);
}
//throw new Error();
@@ -251,35 +251,17 @@
</td>
</tr>
</table>
-<script>
- cumin.queue.listeners["{id}.general"] = updateStats;
- cumin.queue.listeners["{id}.persistent"] = updateStats;
- cumin.queue.listeners["{id}.transactional"] = updateStats;
- cumin.queue.listeners["{id}.transaction"] = updateStats;
-</script>
[StatisticsHistory.html]
<h2>Depth</h2>
-<div class="iblock chart">
- <img id="{id}.depth" src="{depth_chart_url}"/>
-</div>
+<div class="iblock chart">{depth}</div>
<h2>Consumers</h2>
-<div class="iblock chart">
- <img id="{id}.consumers" src="{consumers_chart_url}"/>
-</div>
+<div class="iblock chart">{consumers}</div>
<h2>Transactions</h2>
-<div class="iblock chart">
- <img id="{id}.transactions" src="{transactions_chart_url}"/>
-</div>
+<div class="iblock chart">{transactions}</div>
-<script>
- cumin.queue.listeners["{id}.depth"] = updateImage
- cumin.queue.listeners["{id}.consumers"] = updateImage
- cumin.queue.listeners["{id}.transactions"] = updateImage
-</script>
-
[QueueConsumerSet.html]
<div class="sactions">
<h2>Act on Selected Consumers:</h2>
Modified: mgmt/cumin/python/cumin/stat.py
===================================================================
--- mgmt/cumin/python/cumin/stat.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/stat.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -65,3 +65,88 @@
def render_item_average(self, session, args):
stat, object = args
return None #XXX "%0.2f" % (sum(stat.values) / float(len(stat.values)))
+
+class StatValueChart(Widget):
+ def __init__(self, app, name):
+ super(StatValueChart, self).__init__(app, name)
+
+ self.stats = ()
+
+ def render_href(self, session, object):
+ params = list()
+
+ cls = self.app.model.get_class_by_object(object).name
+ params.append("class=%s" % cls)
+
+ params.append("id=%i" % object.id)
+
+ for stat in self.stats:
+ params.append("stat=%s" % stat)
+
+ return "stats.png?" + ";".join(params)
+
+class StatChartPage(Page):
+ def __init__(self, app, name):
+ super(StatChartPage, self).__init__(app, name)
+
+ self.class_ = CuminClassParameter(app, "class")
+ self.add_parameter(self.class_)
+
+ self.id = IntegerParameter(app, "id")
+ self.add_parameter(self.id)
+
+ param = Parameter(app, "param")
+ self.add_parameter(param)
+
+ self.stats = ListParameter(app, "stat", param)
+ self.add_parameter(self.stats)
+
+ self.mode = Parameter(app, "mode")
+ self.add_parameter(self.mode)
+
+ def get_object(self, session, object):
+ cls = self.class_.get(session).mint_class
+ id = self.id.get(session)
+ return cls.get(id)
+
+ def get_content_type(self, session):
+ return "image/png"
+
+ def do_render(self, session, object):
+ chart = LineChart(600, 120)
+
+ cls = self.class_.get(session)
+ stats = [cls.get_stat(x) for x in self.stats.get(session)]
+
+ samples = dict()
+ times = dict()
+ values = dict()
+
+ for stat in stats:
+ samples[stat] = stat.samples(object)
+ values[stat] = [x[1] for x in samples[stat]]
+
+ max_value = 0
+
+ for stat in stats:
+ vals = values[stat]
+ if vals:
+ max_value = max(max(vals), max_value)
+
+ max_value = max_value * 1.1
+ max_value = max_value + (10 - max_value % 10)
+ chart.set_max_value(int(max_value))
+
+ chart.plot_x_axis()
+ chart.plot_y_axis()
+
+ colors = ((1,0,0), (0,0,1), (0,1,0))
+
+ for stat, color in zip(stats, colors):
+ chart.plot_values(samples[stat], color=color)
+
+ chart.plot_frame()
+
+ writer = Writer()
+ chart.write(writer)
+ return writer.to_string()
Modified: mgmt/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/cumin/python/cumin/stat.strings 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/stat.strings 2008-01-04 15:50:25 UTC (rev 1533)
@@ -51,6 +51,9 @@
{items}
</table>
+<script>
+ cumin.listeners["{id}"] = updateStats;
+</script>
[StatSet.item_html]
<tr stat="{item_name}">
@@ -58,3 +61,26 @@
<td class="ralign"> {item_value}</td>
<td class="ralign"> {item_extra}</td>
</tr>
+
+[StatValueChart.javascript]
+function updateChartImage(id, object) {
+ var img = wooly.doc().elembyid(id);
+
+ var src = img.getattr("src");
+ var sep = src.lastIndexOf(";");
+ var time = new Date().getTime();
+
+ if (isNaN(parseInt(src.substring(sep + 1)))) {
+ src = src + ";" + time;
+ } else {
+ src = src.substring(0, sep) + ";" + time;
+ }
+
+ img.setattr("src", src);
+}
+
+[StatValueChart.html]
+<img id="{id}" src="{href}" height="140" width="660"/>
+<script>
+ cumin.listeners["{id}"] = updateChartImage
+</script>
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-03 17:46:34 UTC (rev 1532)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-04 15:50:25 UTC (rev 1533)
@@ -162,69 +162,6 @@
(error_count, ess(error_count),
warning_count, ess(warning_count))
-class CuminChartPage(Page):
- def __init__(self, app, name):
- super(CuminChartPage, self).__init__(app, name)
-
- self.__param = None
-
- param = Parameter(app, "param")
- self.add_parameter(param)
-
- self.stats = ListParameter(app, "s", param)
- self.add_parameter(self.stats)
-
- self.mode = Parameter(app, "m")
- self.add_parameter(self.mode)
-
- def set_object_parameter(self, param):
- self.__param = param
-
- def get_object(self, session, object):
- return self.__param.get(session)
-
- def get_content_type(self, session):
- return "image/png"
-
- def do_render(self, session, object):
- chart = LineChart(600, 120)
-
- cls = self.app.model.get_class(object)
- stats = [cls.get_stat(x) for x in self.stats.get(session)]
-
- samples = dict()
- times = dict()
- values = dict()
-
- for stat in stats:
- samples[stat] = stat.samples(object)
- values[stat] = [x[1] for x in samples[stat]]
-
- max_value = 0
-
- for stat in stats:
- vals = values[stat]
- if vals:
- max_value = max(max(vals), max_value)
-
- max_value = max_value * 1.1
- max_value = max_value + (10 - max_value % 10)
- chart.set_max_value(int(max_value))
-
- chart.plot_x_axis()
- chart.plot_y_axis()
-
- colors = ((1,0,0), (0,0,1), (0,1,0))
-
- for stat, color in zip(stats, colors):
- chart.plot_values(samples[stat], color=color)
-
- chart.plot_frame()
-
- writer = Writer()
- chart.write(writer)
- return writer.to_string()
-
class CuminXmlPage(Page):
def __init__(self, app, name):
super(CuminXmlPage, self).__init__(app, name)
18 years, 3 months
rhmessaging commits: r1532 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-01-03 12:46:34 -0500 (Thu, 03 Jan 2008)
New Revision: 1532
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
Fixes chart upper bound calculation.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2008-01-03 13:32:29 UTC (rev 1531)
+++ mgmt/cumin/python/cumin/widgets.py 2008-01-03 17:46:34 UTC (rev 1532)
@@ -208,7 +208,7 @@
max_value = max(max(vals), max_value)
max_value = max_value * 1.1
- max_value = max_value + (10 - max_value % 100)
+ max_value = max_value + (10 - max_value % 10)
chart.set_max_value(int(max_value))
chart.plot_x_axis()
18 years, 4 months