Author: eallen
Date: 2010-12-17 18:51:54 +0000 (Fri, 17 Dec 2010)
New Revision: 4440
Modified:
trunk/cumin/python/cumin/grid/job.py
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/pool.py
trunk/cumin/python/cumin/grid/scheduler.py
trunk/cumin/python/cumin/grid/slot.py
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/grid/submitter.py
trunk/cumin/python/cumin/inventory/system.py
trunk/cumin/python/cumin/messaging/binding.py
trunk/cumin/python/cumin/messaging/broker.py
trunk/cumin/python/cumin/messaging/brokerlink.py
trunk/cumin/python/cumin/messaging/connection.py
trunk/cumin/python/cumin/messaging/exchange.py
trunk/cumin/python/cumin/messaging/queue.py
trunk/cumin/python/cumin/messaging/subscription.py
trunk/cumin/python/cumin/model.py
trunk/cumin/python/cumin/objectselector.py
trunk/cumin/python/cumin/objectselector.strings
trunk/cumin/python/cumin/qmfadapter.py
Log:
-Added MonitorSelfStats to Negotiator and Submitter lists and overview pages.
-Added search boxes to ObjectTable lists to perform SQL LIKE searches
Modified: trunk/cumin/python/cumin/grid/job.py
===================================================================
--- trunk/cumin/python/cumin/grid/job.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/job.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -199,7 +199,7 @@
super(JobSelector, self).__init__(app, name, cls)
- self.adapter = JobSummariesAdapter(app, cls)
+ self.table.adapter = JobSummariesAdapter(app, cls)
self.submission = submission
frame = "main.grid.pool.submission.job"
@@ -220,6 +220,8 @@
self.qmf_response = Attribute(app, "qmf_response")
self.add_attribute(self.qmf_response)
+ self.add_search_filter(cls.GlobalJobId)
+
JobSelectionHold(app, self, "held")
JobSelectionRelease(app, self, "released")
JobSelectionRemove(app, self, "removed")
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -45,6 +45,21 @@
self.add_attribute_column(cls.Machine)
self.add_attribute_column(cls.System)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfAge.name, cls.MonitorSelfAge)
+ self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfCPUUsage.name,
cls.MonitorSelfCPUUsage)
+ self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfImageSize.name,
cls.MonitorSelfImageSize)
+ self.add_column(stat)
+ #stat = MonitorSelfStatColumn(app, cls.MonitorSelfRegisteredSocketCount.name,
cls.MonitorSelfRegisteredSocketCount)
+ #self.add_column(stat)
+ #stat = MonitorSelfStatColumn(app, cls.MonitorSelfResidentSetSize.name,
cls.MonitorSelfResidentSetSize)
+ #self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfTime.name, cls.MonitorSelfTime)
+ self.add_column(stat)
+
+ self.add_search_filter(cls.Name)
+
#self.start = DaemonSelectionStart(app, self, "NEGOTIATOR")
#self.stop = DaemonSelectionStop(app, self, "NEGOTIATOR")
Modified: trunk/cumin/python/cumin/grid/pool.py
===================================================================
--- trunk/cumin/python/cumin/grid/pool.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/pool.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -53,7 +53,7 @@
when = "now() - interval '1 day'"
filter = SqlComparisonFilter(table._qmf_update_time, when, ">")
- self.adapter.query.add_filter(filter)
+ self.table.adapter.query.add_filter(filter)
class PoolNameColumn(ObjectLinkColumn):
def render_header_content(self, session):
Modified: trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- trunk/cumin/python/cumin/grid/scheduler.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/scheduler.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -86,6 +86,17 @@
self.add_attribute_column(cls.TotalRunningJobs)
self.add_attribute_column(cls.TotalHeldJobs)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfAge.name, cls.MonitorSelfAge)
+ self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfCPUUsage.name,
cls.MonitorSelfCPUUsage)
+ self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfImageSize.name,
cls.MonitorSelfImageSize)
+ self.add_column(stat)
+ stat = MonitorSelfStatColumn(app, cls.MonitorSelfTime.name, cls.MonitorSelfTime)
+ self.add_column(stat)
+
+ self.add_search_filter(cls.Name)
+
#self.start = DaemonSelectionStart(app, self, "SCHEDD")
#self.stop = DaemonSelectionStop(app, self, "SCHEDD")
@@ -95,7 +106,10 @@
self.attrs = ("NumUsers", "TotalRunningJobs",
"TotalIdleJobs", "TotalHeldJobs",
- "TotalJobAds", "TotalRemovedJobs")
+ "TotalJobAds", "TotalRemovedJobs",
+ "MonitorSelfAge", "MonitorSelfCPUUsage",
+
"MonitorSelfImageSize","MonitorSelfRegisteredSocketCount",
+
"MonitorSelfResidentSetSize","MonitorSelfTime")
class SchedulerOverview(Widget):
def __init__(self, app, name, scheduler):
Modified: trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- trunk/cumin/python/cumin/grid/slot.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/slot.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -24,6 +24,7 @@
self.pool = pool
self.add_filter(self.pool, cls.Pool, cls.Pool)
+ self.add_search_filter(cls.Name)
frame = "main.grid.pool.slot"
col = ObjectLinkColumn(app, "name", cls.Name, cls._id, frame)
@@ -451,7 +452,7 @@
return item[0][2] and "class='%s'" % item[0][2] or
""
class SlotStates(ItemSet):
- states = ("Unclaimed", "Claimed", "Owner",
"Matched", "Preempting")
+ states = ("Unclaimed", "Claimed", "Unavailable",
"Matched", "Preempting")
def do_get_items(self, session):
return self.states
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/submission.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -63,13 +63,15 @@
super(SubmissionSelector, self).__init__(app, name, cls)
- self.adapter = SubmissionData(app)
+ self.table.adapter = SubmissionData(app)
self.add_attribute_column(cls.Idle)
self.add_attribute_column(cls.Running)
self.add_attribute_column(cls.Completed)
self.add_attribute_column(cls.Held)
+ self.add_search_filter(cls.Name)
+
class PoolSubmissionSelector(SubmissionSelector):
def __init__(self, app, name, pool):
super(PoolSubmissionSelector, self).__init__(app, name)
@@ -108,7 +110,7 @@
super(PoolSubmissionSchedulerSelector, self).__init__(app, name, pool)
scheduler = app.model.com_redhat_grid.Scheduler
- self.SchedulerJoin(app, self.adapter.query, self.cls.sql_table,
+ self.SchedulerJoin(app, self.table.adapter.query, self.cls.sql_table,
self.cls.jobserverRef.sql_column, "jid")
frame = "main.grid.pool.scheduler"
Modified: trunk/cumin/python/cumin/grid/submitter.py
===================================================================
--- trunk/cumin/python/cumin/grid/submitter.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/grid/submitter.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -50,6 +50,8 @@
self.add_attribute_column(cls.RunningJobs)
self.add_attribute_column(cls.HeldJobs)
+ self.add_search_filter(cls.Name)
+
class SubmitterGeneralStatSet(StatSet):
def __init__(self, app, name, object):
super(SubmitterGeneralStatSet, self).__init__(app, name, object)
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/inventory/system.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -30,6 +30,8 @@
self.add_attribute_column(cls.memFree)
self.add_attribute_column(cls.loadAverage1Min)
+ self.add_search_filter(cls.nodeName)
+
class SystemFrame(ObjectFrame):
def __init__(self, app, name):
cls = app.model.com_redhat_sesame.Sysimage
Modified: trunk/cumin/python/cumin/messaging/binding.py
===================================================================
--- trunk/cumin/python/cumin/messaging/binding.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/binding.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -134,7 +134,7 @@
super(BindingSelector, self).__init__(app, name, binding)
- self.adapter = BindingData(app)
+ self.table.adapter = BindingData(app)
frame = "main.messaging.broker.binding"
col = ObjectLinkColumn \
@@ -156,6 +156,8 @@
self.remove = BindingSelectionRemove(app, self)
+ self.add_search_filter(binding.bindingKey)
+
class Exchange(ObjectLinkColumn):
def render_header_content(self, session):
return "Exchange"
Modified: trunk/cumin/python/cumin/messaging/broker.py
===================================================================
--- trunk/cumin/python/cumin/messaging/broker.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/broker.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -65,7 +65,7 @@
super(BrokerSelector, self).__init__(app, name, broker)
- self.adapter = BrokerData(app)
+ self.table.adapter = BrokerData(app)
self.group = SessionAttribute(self, "group")
Modified: trunk/cumin/python/cumin/messaging/brokerlink.py
===================================================================
--- trunk/cumin/python/cumin/messaging/brokerlink.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/brokerlink.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -73,6 +73,8 @@
self.add_attribute_column(cls.transport)
self.add_attribute_column(cls.durable)
+ self.add_search_filter(cls.host)
+
self.remove = BrokerLinkSelectionRemove(app, self)
# Address column XXX
@@ -100,6 +102,8 @@
self.add_attribute_column(cls.tag)
self.add_attribute_column(cls.excludes)
+ self.add_search_filter(cls.src)
+
self.remove = RouteSelectionRemove(app, self)
class RouteSelectionRemove(ObjectSelectorTask):
Modified: trunk/cumin/python/cumin/messaging/connection.py
===================================================================
--- trunk/cumin/python/cumin/messaging/connection.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/connection.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -74,6 +74,8 @@
self.add_attribute_column(cls.bytesFromClient)
self.add_attribute_column(cls.bytesToClient)
+ self.add_search_filter(cls.address)
+
self.close = ConnectionSelectionClose(app, self)
class ConnectionSelectionClose(ObjectSelectorTask):
@@ -194,6 +196,8 @@
self.add_attribute_column(cls.framesOutstanding)
self.add_attribute_column(cls.clientCredit)
+ self.add_search_filter(cls.name)
+
self.close = SessionSelectionClose(app, self)
self.detach = SessionSelectionDetach(app, self)
Modified: trunk/cumin/python/cumin/messaging/exchange.py
===================================================================
--- trunk/cumin/python/cumin/messaging/exchange.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/exchange.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -79,6 +79,7 @@
self.add_attribute_column(cls.byteRoutes)
self.add_reference_filter(vhost, cls.vhostRef)
+ self.add_search_filter(cls.name)
self.remove = ExchangeSelectionRemove(app, self)
Modified: trunk/cumin/python/cumin/messaging/queue.py
===================================================================
--- trunk/cumin/python/cumin/messaging/queue.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/queue.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -79,6 +79,7 @@
self.add_attribute_column(cls.byteDepth)
self.add_reference_filter(vhost, cls.vhostRef)
+ self.add_search_filter(cls.name)
self.remove = QueueSelectionRemove(app, self)
self.purge = QueueSelectionPurge(app, self)
Modified: trunk/cumin/python/cumin/messaging/subscription.py
===================================================================
--- trunk/cumin/python/cumin/messaging/subscription.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/messaging/subscription.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -21,6 +21,8 @@
self.add_attribute_column(cls.arguments)
self.add_attribute_column(cls.delivered)
+ self.add_search_filter(cls.name)
+
class SubscriptionFrame(ObjectFrame):
def __init__(self, app, name):
cls = app.model.org_apache_qpid_broker.Subscription
Modified: trunk/cumin/python/cumin/model.py
===================================================================
--- trunk/cumin/python/cumin/model.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/model.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -1927,57 +1927,6 @@
def get_object_name(self, coll):
return coll.Name
-class CuminNegotiator(RemoteClass):
- def __init__(self, model):
- super(CuminNegotiator, self).__init__(model, "negotiator",
- Negotiator, NegotiatorStats)
-
- prop = CuminProperty(self, "Name")
- prop.title = "Name"
-
- prop = CuminProperty(self, "Machine")
- prop.title = "Machine"
-
- prop = CuminProperty(self, "MyAddress")
- prop.title = "Address"
-
- prop = CuminProperty(self, "DaemonStartTime")
- prop.title = "Start Time"
-
- stat = CuminStat(self, "MonitorSelfAge")
- stat.title = "Age"
- stat.category = "general"
-
- stat = CuminStat(self, "MonitorSelfCPUUsage")
- stat.title = "CPU Usage"
- stat.category = "general"
-
- stat = CuminStat(self, "MonitorSelfImageSize")
- stat.title = "Image Size"
- stat.category = "general"
-
- stat = CuminStat(self, "MonitorSelfRegisteredSocketCount")
- stat.title = "Registered Socket Count"
- stat.category = "general"
-
- stat = CuminStat(self, "MonitorSelfResidentSetSize")
- stat.title = "Resident Set Size"
- stat.category = "general"
-
- action = GetStartedAction(self, "GetStarted")
- action.navigable = False
-
- def init(self):
- super(CuminNegotiator, self).init()
-
- #self.frame = self.model.frame.grid.pool.negotiator
-
- def get_title(self, session):
- return "Negotiator"
-
- def get_object_name(self, neg):
- return neg.Name
-
class CuminSubject(CuminClass):
def __init__(self, model):
super(CuminSubject, self).__init__(model, "subject", Subject)
Modified: trunk/cumin/python/cumin/objectselector.py
===================================================================
--- trunk/cumin/python/cumin/objectselector.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/objectselector.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -73,7 +73,7 @@
self.add_filter(attribute, this, that)
- def add_like_filter(self, attribute, this, type=SqlLikeFilter.BEGINS):
+ def add_like_filter(self, attribute, this, type=SqlLikeFilter.CONTAINS):
assert isinstance(attribute, Attribute), attribute
assert isinstance(this, RosemaryAttribute), this
@@ -88,8 +88,14 @@
for this, vattr, type in self.like_specs:
value = vattr.get(session)
- pre = type == SqlLikeFilter.CONTAINS and "%%" or ""
- values[this.name] = "%s%s%%" % (pre, value)
+ # if the user typed a %, don't add another
+ pre = ""
+ post = "%"
+ if not "%" in value:
+ pre = type == SqlLikeFilter.CONTAINS and "%%" or ""
+ else:
+ post = ""
+ values[this.name] = "%s%s%s" % (pre, value, post)
return values
@@ -119,11 +125,12 @@
else:
self.field = ObjectSqlField(self.table.adapter, self.attr)
-class ObjectSelector(ObjectTable, Form):
+class ObjectSelector(Form):
def __init__(self, app, name, cls):
- super(ObjectSelector, self).__init__(app, name, cls)
+ super(ObjectSelector, self).__init__(app, name)
- self.init_ids(app, cls)
+ self.update_enabled = False
+ self.cls = cls
self.switches = ObjectSelectorSwitches(app, "switches")
self.add_child(self.switches)
@@ -137,6 +144,9 @@
self.links = ObjectSelectorLinks(app, "links")
self.add_child(self.links)
+ self.table = ObjectSelectorTable(app, "table", cls)
+ self.add_child(self.table)
+
self.tasks = list()
def init(self):
@@ -150,6 +160,38 @@
self.buttons.add_child(button)
button.init()
+ def add_search_filter(self, this):
+ search = StringInput(self.app, "search")
+ search.param.default = ""
+
+ self.table.add_like_filter(search.param, this)
+ self.filters.add_child(search)
+
+ def add_filter(self, attribute, this, that=None):
+ self.table.add_filter(attribute, this, that)
+
+ def add_column(self, col):
+ self.table.add_column(col)
+
+ def add_attribute_column(self, attr):
+ self.table.add_attribute_column(attr)
+
+ def add_reference_filter(self, attribute, ref):
+ self.table.add_reference_filter(attribute, ref)
+
+ def insert_column(self, index, column):
+ self.table.insert_column(index, column)
+
+ def render_title(self, session):
+ return self.table.render_title(session)
+
+class ObjectSelectorTable(ObjectTable):
+ def __init__(self, app, name, cls):
+ super(ObjectSelectorTable, self).__init__(app, name, cls)
+
+ self.update_enabled = True
+ self.init_ids(app, cls)
+
def init_ids(self, app, cls):
item = IntegerParameter(app, "item")
@@ -345,3 +387,12 @@
def render_item_class(self, session, item):
return "item"
+
+class MonitorSelfStatColumn(ObjectTableColumn):
+ def render_header_content(self, session):
+ title = self.field.get_title(session)
+ parts = title.split()
+ if len(parts) > 2:
+ if parts[0] == "Monitor" and parts[1] == "Self":
+ return " ".join(parts[2:])
+ return title
Modified: trunk/cumin/python/cumin/objectselector.strings
===================================================================
--- trunk/cumin/python/cumin/objectselector.strings 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/objectselector.strings 2010-12-17 18:51:54 UTC (rev 4440)
@@ -7,8 +7,18 @@
div.ObjectSelectorFilters {
float: right;
+ padding-bottom: 0.25em;
}
+div.ObjectSelectorFilters ul {
+ float: left;
+ margin: 0;
+}
+
+div.ObjectSelectorFilters input {
+ font-size: 0.75em;
+}
+
div.ObjectSelectorButtons {
background-color: #e7e7f7;
padding: 0.35em 0.75em;
@@ -31,14 +41,22 @@
[ObjectSelector.html]
<div id="{id}" class="{class}">
{links}
-
- {filters}
-
{switches}
- <form method="post" action="?">
+ <form id="{id}.form" method="post" action="?">
+ {filters}
{buttons}
+ {table}
+
+ <div>{hidden_inputs}</div>
+ </form>
+ <script type="text/javascript">
+ cumin.restoreTableCheckboxes();
+ </script>
+</div>
+
+[ObjectSelectorTable.html]
<table id="{id}" class="{class}">
<style type="text/css">
{css}
@@ -48,14 +66,6 @@
<tbody>{rows}</tbody>
</table>
- <div>{hidden_inputs}</div>
- </form>
-
- <script type="text/javascript">
- cumin.restoreTableCheckboxes();
- </script>
-</div>
-
[ObjectSelectorControl.html]
<div class="{class}">
<ul>{widgets}</ul>
@@ -67,3 +77,9 @@
<ul>{widgets}</ul>
</div>
+
+[ObjectSelectorFilters.html]
+<div class="{class}">
+ <ul>{widgets}</ul>
+ <input type="submit" value="Search"/>
+</div><div style="clear:both;"></div>
Modified: trunk/cumin/python/cumin/qmfadapter.py
===================================================================
--- trunk/cumin/python/cumin/qmfadapter.py 2010-12-17 16:39:40 UTC (rev 4439)
+++ trunk/cumin/python/cumin/qmfadapter.py 2010-12-17 18:51:54 UTC (rev 4440)
@@ -94,6 +94,10 @@
self.fields_by_attr = dict()
+ def add_like_filter(self, attr):
+ #TODO: add sql LIKE filtering to QMF results
+ pass
+
class QmfField(DataAdapterField):
def __init__(self, adapter, column):
python_type = column.type.python_type
@@ -104,7 +108,6 @@
self.adapter.columns.append(column)
-
class ObjectQmfField(QmfField):
def __init__(self, adapter, attr):
assert isinstance(adapter, ObjectQmfAdapter), adapter