Author: justi9
Date: 2009-06-18 13:41:14 -0400 (Thu, 18 Jun 2009)
New Revision: 3461
Added:
mgmt/trunk/cumin/python/cumin/messaging/connection.py
mgmt/trunk/cumin/python/cumin/messaging/connection.strings
Removed:
mgmt/trunk/cumin/python/cumin/messaging/client.py
mgmt/trunk/cumin/python/cumin/messaging/client.strings
Modified:
mgmt/trunk/cumin/python/cumin/messaging/broker.py
Log:
Rename client.py to connection.py
Modified: mgmt/trunk/cumin/python/cumin/messaging/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/broker.py 2009-06-18 15:46:18 UTC (rev 3460)
+++ mgmt/trunk/cumin/python/cumin/messaging/broker.py 2009-06-18 17:41:14 UTC (rev 3461)
@@ -12,7 +12,7 @@
from queue import *
from exchange import *
from brokerlink import *
-from client import *
+from connection import *
from brokerlink import LinkSet
Deleted: mgmt/trunk/cumin/python/cumin/messaging/client.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/client.py 2009-06-18 15:46:18 UTC (rev 3460)
+++ mgmt/trunk/cumin/python/cumin/messaging/client.py 2009-06-18 17:41:14 UTC (rev 3461)
@@ -1,268 +0,0 @@
-from wooly import *
-from wooly.widgets import *
-from wooly.tables import *
-from datetime import datetime
-from cumin.stat import *
-from cumin.widgets import *
-from cumin.modelwidgets import *
-from cumin.parameters import *
-from cumin.formats import *
-from cumin.util import *
-
-import main
-
-strings = StringCatalog(__file__)
-
-class ConnectionSet(CuminSelectionTable):
- def __init__(self, app, name, vhost):
- item = ConnectionParameter(app, "item")
- super(ConnectionSet, self).__init__(app, name, item)
-
- self.vhost = vhost
-
- col = self.AddressColumn(app, "addr")
- self.add_column(col)
- self.set_default_column(col)
-
- col = self.SystemConnectionColumn(app, "sysconn")
- self.add_column(col)
-
- col = self.AuthIdentityColumn(app, "authid")
- self.add_column(col)
-
- col = self.FedLinkColumn(app, "fedlink")
- self.add_column(col)
-
- col = self.SentColumn(app, "sent")
- col.alignment = "right"
- self.add_column(col)
-
- col = self.ReceivedColumn(app, "received")
- col.alignment = "right"
- self.add_column(col)
-
- self.unit = StateSwitch(app, "unit")
- self.unit.add_state("b", "Bytes")
- self.unit.add_state("f", "Frames")
- self.switches.add_child(self.unit)
-
- self.phase = PhaseSwitch(app, "phase")
- self.filters.add_child(self.phase)
-
- task = main.module.connection_set_close
- button = TaskButton(app, "close", task, self.selection)
- self.add_child(button)
-
- def get_unit_plural(self, session):
- return self.unit.get(session) == "b" and "Bytes" or
"Frames"
-
- def render_title(self, session):
- vhost = self.vhost.get(session)
- return "Connections %s" % fmt_count(vhost.clientConnections.count())
-
- def render_sql_where(self, session):
- vhost = self.vhost.get(session)
-
- constraints = list()
- constraints.append("l.vhost_id = %(id)r")
- constraints.append(self.phase.get_sql_constraint(session, vhost))
-
- return "where %s" % " and ".join(constraints)
-
- def get_sql_values(self, session):
- vhost = self.vhost.get(session)
- return {"id": vhost.id}
-
- class AddressColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Address"
-
- def render_content(self, session, data):
- conn = Identifiable(data["id"])
- href = self.frame.connection.get_href(session, conn)
- return fmt_link(href, fmt_shorten(data["addr"]))
-
- class SystemConnectionColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Connect Type"
-
- def render_content(self, session, data):
- if data['sysconn']:
- return "System"
- else:
- return "Client"
-
- class AuthIdentityColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Auth Id"
-
- class FedLinkColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Fed Link"
-
- def render_content(self, session, data):
- if data['fedlink']:
- return "Yes"
- else:
- return "No"
-
- class SentColumn(NullSortColumn, FreshDataOnlyColumn):
- def render_title(self, session, data):
- return "%s Sent" % self.parent.get_unit_plural(session)
-
- def get_column_key(self, session):
- unit = self.parent.unit.get(session)
- return unit == "b" and "bs" or "fs"
-
- def render_value(self, session, value):
- return fmt_rate(value, "", "sec")
-
- class ReceivedColumn(NullSortColumn, FreshDataOnlyColumn):
- def render_title(self, session, data):
- 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 "br" or "fr"
-
- def render_value(self, session, value):
- return fmt_rate(value, "", "sec")
-
-class ConnectionFrame(CuminFrame):
- def __init__(self, app, name):
- super(ConnectionFrame, self).__init__(app, name)
-
- self.object = ConnectionParameter(app, "id")
- self.add_parameter(self.object)
-
- self.view = ConnectionView(app, "view", self.object)
- self.add_mode(self.view)
-
- def show_object(self, session, conn):
- if hasattr(conn, "vhost"):
- self.frame.set_object(session, conn.vhost.broker)
-
- return super(ConnectionFrame, self).show_object(session, conn)
-
-class ConnectionCloseForm(CuminTaskForm):
- def __init__(self, app, name, task):
- super(ConnectionCloseForm, self).__init__(app, name, task)
-
- self.object = ConnectionParameter(app, "conn")
- self.add_parameter(self.object)
-
-class ConnectionSetCloseForm(CuminTaskForm):
- def __init__(self, app, name, task):
- super(ConnectionSetCloseForm, self).__init__(app, name, task)
-
- item = ConnectionParameter(app, "item")
-
- self.object = ListParameter(app, "conn", item)
- self.add_parameter(self.object)
-
-class ConnectionView(CuminView):
- def __init__(self, app, name, conn):
- super(ConnectionView, self).__init__(app, name)
-
- self.tabs = TabbedModeSet(app, "tabs")
- self.add_child(self.tabs)
-
- self.tabs.add_tab(ConnectionStats(app, "stats"))
-
- self.sessions = SessionSet(app, "sessions", conn)
- self.tabs.add_tab(self.sessions)
-
- self.tabs.add_tab(CuminDetails(app, "details"))
-
-class ConnectionStats(Widget):
- def __init__(self, app, name):
- super(ConnectionStats, self).__init__(app, name)
-
- self.add_child(StatSet(app, "io", "io"))
- self.add_child(StatSet(app, "general", "general"))
-
- chart = self.SendReceiveRateChart(app, "sendrecv")
- self.add_child(chart)
-
- def render_title(self, session):
- return "Statistics"
-
- class SendReceiveRateChart(StatValueChart):
- def __init__(self, app, name):
- super(ConnectionStats.SendReceiveRateChart, self).__init__(app, name)
-
- self.stats = ("bytesFromClient", "bytesToClient")
- self.mode = "rate"
-
- def render_title(self, session, conn):
- return "Bytes Sent and Received"
-
-class SessionSetTaskForm(CuminTaskForm):
- def __init__(self, app, name, task):
- super(SessionSetTaskForm, self).__init__(app, name, task)
-
- item = SessionParameter(app, "item")
-
- self.object = ListParameter(app, "session", item)
- self.add_parameter(self.object)
-
-class SessionSet(CuminSelectionTable):
- def __init__(self, app, name, conn):
- item = SessionParameter(app, "item")
- super(SessionSet, self).__init__(app, name, item)
-
- self.conn = conn
-
- col = self.NameColumn(app, "name")
- self.add_column(col)
- self.set_default_column(col)
-
- col = self.ExpiresColumn(app, "expires")
- self.add_column(col)
-
- col = self.StatusColumn(app, "status")
- self.add_column(col)
-
- self.__phase = PhaseSwitch(app, "phase")
- self.add_child(self.__phase)
-
- task = main.module.session_set_detach
- self.buttons.add_child(TaskButton(app, "detach", task,
self.selection))
-
- task = main.module.session_set_close
- self.buttons.add_child(TaskButton(app, "close", task, self.selection))
-
- def render_title(self, session):
- conn = self.conn.get(session)
- return "Sessions %s" % fmt_count(conn.sessions.count())
-
- def render_sql_where(self, session):
- conn = self.conn.get(session)
-
- elems = list()
- elems.append("s.client_connection_id = %(id)r")
- elems.append(self.__phase.get_sql_constraint(session, conn))
-
- return "where %s" % " and ".join(elems)
-
- def get_sql_values(self, session):
- conn = self.conn.get(session)
- return {"id": conn.id}
-
- class NameColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Name"
-
- class ExpiresColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Expires"
-
- def render_value(self, session, value):
- return fmt_datetime(value)
-
- class StatusColumn(SqlTableColumn):
- def render_title(self, session, data):
- return "Attached?"
-
- def render_content(self, session, data):
- return fmt_predicate(data["attached"])
Deleted: mgmt/trunk/cumin/python/cumin/messaging/client.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/client.strings 2009-06-18 15:46:18 UTC (rev
3460)
+++ mgmt/trunk/cumin/python/cumin/messaging/client.strings 2009-06-18 17:41:14 UTC (rev
3461)
@@ -1,65 +0,0 @@
-[ConnectionSet.sql]
-select
- l.id,
- l.system_connection as sysconn,
- l.auth_identity as authid,
- l.federation_link as fedlink,
- l.address as addr,
- (c.bytes_from_client - p.bytes_from_client)
- / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as bs,
- case when p.bytes_from_client is null then true else false end as bs_is_null,
- (c.frames_from_client - p.frames_from_client)
- / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as fs,
- case when p.frames_from_client is null then true else false end as fs_is_null,
- (c.bytes_to_client - p.bytes_to_client)
- / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as br,
- case when p.bytes_to_client is null then true else false end as br_is_null,
- (c.frames_to_client - p.frames_to_client)
- / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as fr,
- case when p.frames_to_client is null then true else false end as fr_is_null,
- c.qmf_update_time
-from client_connection as l
-left outer join client_connection_stats as c on c.id = l.stats_curr_id
-left outer join client_connection_stats as p on p.id = l.stats_prev_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[ConnectionSet.count_sql]
-select count(*)
-from client_connection as l
-left outer join client_connection_stats as c on c.id = l.stats_curr_id
-{sql_where}
-
-[ConnectionStats.html]
-<table class="twocol">
- <tbody>
- <tr>
- <td>
- <h2>Input/Output</h2>
- {io}
-
- <h2>General</h2>
- {general}
- </td>
- <td>
- {sendrecv}
- </td>
- </tr>
- </tbody>
-</table>
-
-[SessionSet.sql]
-select s.id, s.name, s.expire_time as expires, s.attached
-from session as s
-left outer join session_stats as c on c.id = s.stats_curr_id
-left outer join session_stats as p on p.id = s.stats_prev_id
-{sql_where}
-{sql_orderby}
-{sql_limit}
-
-[SessionSet.count_sql]
-select count(*)
-from session as s
-left outer join session_stats as c on c.id = s.stats_curr_id
-{sql_where}
Copied: mgmt/trunk/cumin/python/cumin/messaging/connection.py (from rev 3460,
mgmt/trunk/cumin/python/cumin/messaging/client.py)
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/connection.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/messaging/connection.py 2009-06-18 17:41:14 UTC (rev
3461)
@@ -0,0 +1,268 @@
+from wooly import *
+from wooly.widgets import *
+from wooly.tables import *
+from datetime import datetime
+from cumin.stat import *
+from cumin.widgets import *
+from cumin.modelwidgets import *
+from cumin.parameters import *
+from cumin.formats import *
+from cumin.util import *
+
+import main
+
+strings = StringCatalog(__file__)
+
+class ConnectionSet(CuminSelectionTable):
+ def __init__(self, app, name, vhost):
+ item = ConnectionParameter(app, "item")
+ super(ConnectionSet, self).__init__(app, name, item)
+
+ self.vhost = vhost
+
+ col = self.AddressColumn(app, "addr")
+ self.add_column(col)
+ self.set_default_column(col)
+
+ col = self.SystemConnectionColumn(app, "sysconn")
+ self.add_column(col)
+
+ col = self.AuthIdentityColumn(app, "authid")
+ self.add_column(col)
+
+ col = self.FedLinkColumn(app, "fedlink")
+ self.add_column(col)
+
+ col = self.SentColumn(app, "sent")
+ col.alignment = "right"
+ self.add_column(col)
+
+ col = self.ReceivedColumn(app, "received")
+ col.alignment = "right"
+ self.add_column(col)
+
+ self.unit = StateSwitch(app, "unit")
+ self.unit.add_state("b", "Bytes")
+ self.unit.add_state("f", "Frames")
+ self.switches.add_child(self.unit)
+
+ self.phase = PhaseSwitch(app, "phase")
+ self.filters.add_child(self.phase)
+
+ task = main.module.connection_set_close
+ button = TaskButton(app, "close", task, self.selection)
+ self.add_child(button)
+
+ def get_unit_plural(self, session):
+ return self.unit.get(session) == "b" and "Bytes" or
"Frames"
+
+ def render_title(self, session):
+ vhost = self.vhost.get(session)
+ return "Connections %s" % fmt_count(vhost.clientConnections.count())
+
+ def render_sql_where(self, session):
+ vhost = self.vhost.get(session)
+
+ constraints = list()
+ constraints.append("l.vhost_id = %(id)r")
+ constraints.append(self.phase.get_sql_constraint(session, vhost))
+
+ return "where %s" % " and ".join(constraints)
+
+ def get_sql_values(self, session):
+ vhost = self.vhost.get(session)
+ return {"id": vhost.id}
+
+ class AddressColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Address"
+
+ def render_content(self, session, data):
+ conn = Identifiable(data["id"])
+ href = self.frame.connection.get_href(session, conn)
+ return fmt_link(href, fmt_shorten(data["addr"]))
+
+ class SystemConnectionColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Connect Type"
+
+ def render_content(self, session, data):
+ if data['sysconn']:
+ return "System"
+ else:
+ return "Client"
+
+ class AuthIdentityColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Auth Id"
+
+ class FedLinkColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Fed Link"
+
+ def render_content(self, session, data):
+ if data['fedlink']:
+ return "Yes"
+ else:
+ return "No"
+
+ class SentColumn(NullSortColumn, FreshDataOnlyColumn):
+ def render_title(self, session, data):
+ return "%s Sent" % self.parent.get_unit_plural(session)
+
+ def get_column_key(self, session):
+ unit = self.parent.unit.get(session)
+ return unit == "b" and "bs" or "fs"
+
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
+
+ class ReceivedColumn(NullSortColumn, FreshDataOnlyColumn):
+ def render_title(self, session, data):
+ 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 "br" or "fr"
+
+ def render_value(self, session, value):
+ return fmt_rate(value, "", "sec")
+
+class ConnectionFrame(CuminFrame):
+ def __init__(self, app, name):
+ super(ConnectionFrame, self).__init__(app, name)
+
+ self.object = ConnectionParameter(app, "id")
+ self.add_parameter(self.object)
+
+ self.view = ConnectionView(app, "view", self.object)
+ self.add_mode(self.view)
+
+ def show_object(self, session, conn):
+ if hasattr(conn, "vhost"):
+ self.frame.set_object(session, conn.vhost.broker)
+
+ return super(ConnectionFrame, self).show_object(session, conn)
+
+class ConnectionCloseForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(ConnectionCloseForm, self).__init__(app, name, task)
+
+ self.object = ConnectionParameter(app, "conn")
+ self.add_parameter(self.object)
+
+class ConnectionSetCloseForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(ConnectionSetCloseForm, self).__init__(app, name, task)
+
+ item = ConnectionParameter(app, "item")
+
+ self.object = ListParameter(app, "conn", item)
+ self.add_parameter(self.object)
+
+class ConnectionView(CuminView):
+ def __init__(self, app, name, conn):
+ super(ConnectionView, self).__init__(app, name)
+
+ self.tabs = TabbedModeSet(app, "tabs")
+ self.add_child(self.tabs)
+
+ self.tabs.add_tab(ConnectionStats(app, "stats"))
+
+ self.sessions = SessionSet(app, "sessions", conn)
+ self.tabs.add_tab(self.sessions)
+
+ self.tabs.add_tab(CuminDetails(app, "details"))
+
+class ConnectionStats(Widget):
+ def __init__(self, app, name):
+ super(ConnectionStats, self).__init__(app, name)
+
+ self.add_child(StatSet(app, "io", "io"))
+ self.add_child(StatSet(app, "general", "general"))
+
+ chart = self.SendReceiveRateChart(app, "sendrecv")
+ self.add_child(chart)
+
+ def render_title(self, session):
+ return "Statistics"
+
+ class SendReceiveRateChart(StatValueChart):
+ def __init__(self, app, name):
+ super(ConnectionStats.SendReceiveRateChart, self).__init__(app, name)
+
+ self.stats = ("bytesFromClient", "bytesToClient")
+ self.mode = "rate"
+
+ def render_title(self, session, conn):
+ return "Bytes Sent and Received"
+
+class SessionSetTaskForm(CuminTaskForm):
+ def __init__(self, app, name, task):
+ super(SessionSetTaskForm, self).__init__(app, name, task)
+
+ item = SessionParameter(app, "item")
+
+ self.object = ListParameter(app, "session", item)
+ self.add_parameter(self.object)
+
+class SessionSet(CuminSelectionTable):
+ def __init__(self, app, name, conn):
+ item = SessionParameter(app, "item")
+ super(SessionSet, self).__init__(app, name, item)
+
+ self.conn = conn
+
+ col = self.NameColumn(app, "name")
+ self.add_column(col)
+ self.set_default_column(col)
+
+ col = self.ExpiresColumn(app, "expires")
+ self.add_column(col)
+
+ col = self.StatusColumn(app, "status")
+ self.add_column(col)
+
+ self.__phase = PhaseSwitch(app, "phase")
+ self.add_child(self.__phase)
+
+ task = main.module.session_set_detach
+ self.buttons.add_child(TaskButton(app, "detach", task,
self.selection))
+
+ task = main.module.session_set_close
+ self.buttons.add_child(TaskButton(app, "close", task, self.selection))
+
+ def render_title(self, session):
+ conn = self.conn.get(session)
+ return "Sessions %s" % fmt_count(conn.sessions.count())
+
+ def render_sql_where(self, session):
+ conn = self.conn.get(session)
+
+ elems = list()
+ elems.append("s.client_connection_id = %(id)r")
+ elems.append(self.__phase.get_sql_constraint(session, conn))
+
+ return "where %s" % " and ".join(elems)
+
+ def get_sql_values(self, session):
+ conn = self.conn.get(session)
+ return {"id": conn.id}
+
+ class NameColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Name"
+
+ class ExpiresColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Expires"
+
+ def render_value(self, session, value):
+ return fmt_datetime(value)
+
+ class StatusColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Attached?"
+
+ def render_content(self, session, data):
+ return fmt_predicate(data["attached"])
Copied: mgmt/trunk/cumin/python/cumin/messaging/connection.strings (from rev 3460,
mgmt/trunk/cumin/python/cumin/messaging/client.strings)
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/connection.strings
(rev 0)
+++ mgmt/trunk/cumin/python/cumin/messaging/connection.strings 2009-06-18 17:41:14 UTC
(rev 3461)
@@ -0,0 +1,65 @@
+[ConnectionSet.sql]
+select
+ l.id,
+ l.system_connection as sysconn,
+ l.auth_identity as authid,
+ l.federation_link as fedlink,
+ l.address as addr,
+ (c.bytes_from_client - p.bytes_from_client)
+ / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as bs,
+ case when p.bytes_from_client is null then true else false end as bs_is_null,
+ (c.frames_from_client - p.frames_from_client)
+ / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as fs,
+ case when p.frames_from_client is null then true else false end as fs_is_null,
+ (c.bytes_to_client - p.bytes_to_client)
+ / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as br,
+ case when p.bytes_to_client is null then true else false end as br_is_null,
+ (c.frames_to_client - p.frames_to_client)
+ / (extract(epoch from (c.qmf_update_time - p.qmf_update_time)) + 0.0001) as fr,
+ case when p.frames_to_client is null then true else false end as fr_is_null,
+ c.qmf_update_time
+from client_connection as l
+left outer join client_connection_stats as c on c.id = l.stats_curr_id
+left outer join client_connection_stats as p on p.id = l.stats_prev_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[ConnectionSet.count_sql]
+select count(*)
+from client_connection as l
+left outer join client_connection_stats as c on c.id = l.stats_curr_id
+{sql_where}
+
+[ConnectionStats.html]
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Input/Output</h2>
+ {io}
+
+ <h2>General</h2>
+ {general}
+ </td>
+ <td>
+ {sendrecv}
+ </td>
+ </tr>
+ </tbody>
+</table>
+
+[SessionSet.sql]
+select s.id, s.name, s.expire_time as expires, s.attached
+from session as s
+left outer join session_stats as c on c.id = s.stats_curr_id
+left outer join session_stats as p on p.id = s.stats_prev_id
+{sql_where}
+{sql_orderby}
+{sql_limit}
+
+[SessionSet.count_sql]
+select count(*)
+from session as s
+left outer join session_stats as c on c.id = s.stats_curr_id
+{sql_where}