rhmessaging commits: r2682 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:35:26 -0400 (Fri, 24 Oct 2008)
New Revision: 2682
Modified:
mgmt/trunk/cumin/python/cumin/limits.strings
Log:
remove unused {limit_count}
Modified: mgmt/trunk/cumin/python/cumin/limits.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.strings 2008-10-24 15:34:49 UTC (rev 2681)
+++ mgmt/trunk/cumin/python/cumin/limits.strings 2008-10-24 15:35:26 UTC (rev 2682)
@@ -10,8 +10,8 @@
</thead>
<tbody>{items}</tbody>
</table>
-{limit_count}
+
[LimitCount.javascript]
function got_limit_count(obj, id) {
var elem = document.getElementById(id);
16 years, 2 months
rhmessaging commits: r2681 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:34:49 -0400 (Fri, 24 Oct 2008)
New Revision: 2681
Modified:
mgmt/trunk/cumin/python/cumin/limits.py
Log:
Implement better way of determining if there was an error receiving limits.
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-10-24 15:32:11 UTC (rev 2680)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-10-24 15:34:49 UTC (rev 2681)
@@ -20,16 +20,25 @@
def fetch_limits(self, session):
negotiator = self.get_negotiator(session)
if negotiator:
- return self.get_raw_limits(session, negotiator)
+ limits = self.get_raw_limits(session, negotiator)
+ if "timeout" in limits:
+ del limits["timeout"]
+ return limits
else:
return dict()
def get_negotiator(self, session):
#TODO: find better way to get the negotiator. from pool perhaps?
+ most_recent = None
negotiators = Negotiator.select()
for negotiator in negotiators:
if negotiator.managedBroker:
- return negotiator
+ if not most_recent:
+ most_recent = negotiator
+ if negotiator.statsCurr.recTime > most_recent.statsCurr.recTime:
+ most_recent = negotiator
+
+ return most_recent
def set_limit(self, session, limit):
negotiator = self.get_negotiator(session)
16 years, 2 months
rhmessaging commits: r2680 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:32:11 -0400 (Fri, 24 Oct 2008)
New Revision: 2680
Modified:
mgmt/trunk/cumin/python/cumin/job.strings
Log:
Naming the status box "Job Status"
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-24 15:31:38 UTC (rev 2679)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-24 15:32:11 UTC (rev 2680)
@@ -200,7 +200,7 @@
[JobStatus.html]
<div id="{id}" class="CuminStatus {color}">
- <h2>Status</h2>
+ <h2>Job Status</h2>
{job_status}
</div>
16 years, 2 months
rhmessaging commits: r2679 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-24 11:31:38 -0400 (Fri, 24 Oct 2008)
New Revision: 2679
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Removing unused orphaned method
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-24 15:16:22 UTC (rev 2678)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-24 15:31:38 UTC (rev 2679)
@@ -833,9 +833,6 @@
file = self.which_file.get_current_file_name(session)
return (file, start, end)
- class OutTime(AjaxField):
- pass
-
class OutputFile(AjaxField):
def get_url(self, session):
job = self.parent.frame.get_args(session)[0]
16 years, 2 months
rhmessaging commits: r2678 - store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store.
by rhmessaging-commits@lists.jboss.org
Author: tedross
Date: 2008-10-24 11:16:22 -0400 (Fri, 24 Oct 2008)
New Revision: 2678
Modified:
store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp
store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.h
store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.h
Log:
Re-generated qmf files
Modified: store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp
===================================================================
--- store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp 2008-10-23 19:38:37 UTC (rev 2677)
+++ store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.cpp 2008-10-24 15:16:22 UTC (rev 2678)
@@ -575,7 +575,7 @@
ioArgs.i_by = inBuf.getLong();
status = coreObject->ManagementMethod (METHOD_EXPAND, ioArgs, text);
outBuf.putLong (status);
- outBuf.putShortString (::qpid::management::Manageable::StatusText (status, text));
+ outBuf.putMediumString(::qpid::management::Manageable::StatusText (status, text));
return;
}
Modified: store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.h
===================================================================
--- store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.h 2008-10-23 19:38:37 UTC (rev 2677)
+++ store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Journal.h 2008-10-24 15:16:22 UTC (rev 2678)
@@ -96,11 +96,11 @@
struct PerThreadStats** perThreadStatsArray;
inline struct PerThreadStats* getThreadStats() {
- int index = getThreadIndex();
- struct PerThreadStats* threadStats = perThreadStatsArray[index];
+ int idx = getThreadIndex();
+ struct PerThreadStats* threadStats = perThreadStatsArray[idx];
if (threadStats == 0) {
threadStats = new(PerThreadStats);
- perThreadStatsArray[index] = threadStats;
+ perThreadStatsArray[idx] = threadStats;
threadStats->enqueues = 0;
threadStats->dequeues = 0;
threadStats->txnEnqueues = 0;
Modified: store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.h
===================================================================
--- store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.h 2008-10-23 19:38:37 UTC (rev 2677)
+++ store/trunk/cpp/lib/gen/qmf/com/redhat/rhm/store/Store.h 2008-10-24 15:16:22 UTC (rev 2678)
@@ -77,11 +77,11 @@
struct PerThreadStats** perThreadStatsArray;
inline struct PerThreadStats* getThreadStats() {
- int index = getThreadIndex();
- struct PerThreadStats* threadStats = perThreadStatsArray[index];
+ int idx = getThreadIndex();
+ struct PerThreadStats* threadStats = perThreadStatsArray[idx];
if (threadStats == 0) {
threadStats = new(PerThreadStats);
- perThreadStatsArray[index] = threadStats;
+ perThreadStatsArray[idx] = threadStats;
threadStats->tplTxnPrepares = 0;
threadStats->tplTxnCommits = 0;
threadStats->tplTxnAborts = 0;
16 years, 2 months
rhmessaging commits: r2677 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-10-23 15:38:37 -0400 (Thu, 23 Oct 2008)
New Revision: 2677
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
add User->GridUser translation to reserved words map
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-23 19:20:59 UTC (rev 2676)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-23 19:38:37 UTC (rev 2677)
@@ -34,7 +34,7 @@
self.reservedWords = {"in": "inRsv", "In": "InRsv",
"connection": "clientConnection", "Connection": "ClientConnection",
"connectionRef": "clientConnectionRef",
- "user": "juser", "User": "Juser"}
+ "user": "gridUser", "User": "GridUser"}
def renameReservedWord(self, name):
if (name in self.reservedWords.keys()):
@@ -193,7 +193,7 @@
self.finalPythonOutput += 'schemaReservedWordsMap = {"in": "inRsv", "In": "InRsv", \n'
self.finalPythonOutput += ' "connection": "clientConnection", "Connection": "ClientConnection", \n'
self.finalPythonOutput += ' "connectionRef": "clientConnectionRef", \n'
- self.finalPythonOutput += ' "user": "juser", "User": "Juser"} \n\n'
+ self.finalPythonOutput += ' "user": "gridUser", "User": "GridUser"} \n\n'
outputFile = open(self.pythonFilePath, "w")
for xmlFile in self.xmlFilePaths:
schema = mllib.xml_parse(xmlFile)
16 years, 2 months
rhmessaging commits: r2676 - mgmt/trunk/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-10-23 15:20:59 -0400 (Thu, 23 Oct 2008)
New Revision: 2676
Modified:
mgmt/trunk/mint/python/mint/schemaparser.py
Log:
add User->GridUser translation to reserved words map
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-23 18:51:51 UTC (rev 2675)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-23 19:20:59 UTC (rev 2676)
@@ -32,7 +32,9 @@
self.dataTypesMap["map"] = "PickleCol"
# mapping for identifiers in the XML schema that are reserved words in either SQL or Python
self.reservedWords = {"in": "inRsv", "In": "InRsv",
- "connection": "clientConnection", "Connection": "ClientConnection", "User": "Juser"}
+ "connection": "clientConnection", "Connection": "ClientConnection",
+ "connectionRef": "clientConnectionRef",
+ "user": "juser", "User": "Juser"}
def renameReservedWord(self, name):
if (name in self.reservedWords.keys()):
@@ -181,12 +183,17 @@
self.pythonOutput += "import mint\n"
self.pythonOutput += "from sqlobject import *\n"
self.pythonOutput += "from datetime import datetime\n"
- self.pythonOutput += "from qpid.management import objectId\n"
+ self.pythonOutput += "from qpid.management import objectId\n\n"
+ self.pythonOutput += "class Pool(SQLObject):\n"
+ self.pythonOutput += " class sqlmeta:\n"
+ self.pythonOutput += " lazyUpdate = True\n"
+ self.pythonOutput += " sourceId = StringCol(length=1000, default=None, unique=True)\n\n"
self.finalPythonOutput += "\nclassToSchemaNameMap = dict()\n"
self.finalPythonOutput += "schemaNameToClassMap = dict()\n"
self.finalPythonOutput += 'schemaReservedWordsMap = {"in": "inRsv", "In": "InRsv", \n'
self.finalPythonOutput += ' "connection": "clientConnection", "Connection": "ClientConnection", \n'
- self.finalPythonOutput += ' "other": "otherRsv"}\n\n'
+ self.finalPythonOutput += ' "connectionRef": "clientConnectionRef", \n'
+ self.finalPythonOutput += ' "user": "juser", "User": "Juser"} \n\n'
outputFile = open(self.pythonFilePath, "w")
for xmlFile in self.xmlFilePaths:
schema = mllib.xml_parse(xmlFile)
16 years, 2 months
rhmessaging commits: r2675 - in mgmt/trunk: cumin/python/wooly and 2 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-23 14:51:51 -0400 (Thu, 23 Oct 2008)
New Revision: 2675
Modified:
mgmt/trunk/cumin/python/cumin/broker.py
mgmt/trunk/cumin/python/cumin/brokercluster.py
mgmt/trunk/cumin/python/cumin/brokergroup.py
mgmt/trunk/cumin/python/cumin/brokerlink.py
mgmt/trunk/cumin/python/cumin/brokerprofile.py
mgmt/trunk/cumin/python/cumin/client.py
mgmt/trunk/cumin/python/cumin/client.strings
mgmt/trunk/cumin/python/cumin/collector.py
mgmt/trunk/cumin/python/cumin/collector.strings
mgmt/trunk/cumin/python/cumin/exchange.py
mgmt/trunk/cumin/python/cumin/formats.py
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/limits.py
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/negotiator.py
mgmt/trunk/cumin/python/cumin/negotiator.strings
mgmt/trunk/cumin/python/cumin/page.py
mgmt/trunk/cumin/python/cumin/parameters.py
mgmt/trunk/cumin/python/cumin/pool.py
mgmt/trunk/cumin/python/cumin/pool.strings
mgmt/trunk/cumin/python/cumin/queue.py
mgmt/trunk/cumin/python/cumin/scheduler.py
mgmt/trunk/cumin/python/cumin/scheduler.strings
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/submitter.py
mgmt/trunk/cumin/python/cumin/submitter.strings
mgmt/trunk/cumin/python/cumin/system.py
mgmt/trunk/cumin/python/cumin/test.py
mgmt/trunk/cumin/python/cumin/virtualhost.py
mgmt/trunk/cumin/python/cumin/widgets.py
mgmt/trunk/cumin/python/wooly/__init__.py
mgmt/trunk/cumin/python/wooly/devel.py
mgmt/trunk/cumin/python/wooly/forms.py
mgmt/trunk/cumin/python/wooly/widgets.py
mgmt/trunk/mint/python/mint/schema.py
mgmt/trunk/mint/python/mint/schemaparser.py
mgmt/trunk/mint/sql/schema.sql
Log:
Big commit! This contains two major changes:
Visibility control
Where before we had lots of show_xxx methods, this change replaces
them with support on widget to show a widget and all of its
ancestors.
For a typical widget tree, this allows operations such as this:
self.page.main.broker.show(session)
And as a result the main and broker frames will also be shown.
As a convenience there are also get_href and show_object methods on
CuminFrame.
Pools - This change introduces pools to the grid UI
In addition, there's quite a number of small cleanups.
It also contains a temporary workaround for the "user" schema
collision. This will be re-fixed in a better way in a subsequent
commit.
Modified: mgmt/trunk/cumin/python/cumin/broker.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/broker.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/broker.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -53,9 +53,9 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.page.show_main(branch).show_brokers_remove(branch)
+ frame = self.page.main.brokers_remove.show(branch)
frame.ids.set(branch, ids)
- frame.return_url.set(branch, session.marshal())
+ frame.origin.set(branch, session.marshal())
self.page.set_redirect_url(session, branch.marshal())
class BrokerSetGroupInput(BrokerGroupInput):
@@ -87,11 +87,9 @@
return "Name"
def render_content(self, session, data):
- reg = BrokerRegistration.get(data["id"])
- cls = self.app.model.get_class_by_object(reg)
- href = cls.get_object_href(session, reg)
- name = data["name"]
- return fmt_link(href, name)
+ reg = Identifiable(data["id"])
+ href = self.page.main.broker.get_href(session, reg)
+ return fmt_link(href, fmt_shorten(data["name"]))
class GroupsColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -110,11 +108,8 @@
links = list()
for group in broker.groups[:2]:
- branch = session.branch()
- frame = self.app.model.broker_group.show_object \
- (branch, group)
- frame.show_view(branch)
- links.append(fmt_olink(branch, group))
+ href = self.page.main.broker_group.get_href(session, group)
+ links.append(fmt_link(href, group.name))
link = ", ".join(links)
else:
@@ -129,121 +124,53 @@
self.object = BrokerRegistrationParameter(app, "id")
self.add_parameter(self.object)
- view = BrokerView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = BrokerView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- edit = BrokerEdit(app, "edit")
- self.add_mode(edit)
- self.set_edit_mode(edit)
+ self.edit = BrokerEdit(app, "edit")
+ self.add_mode(self.edit)
+ self.set_edit_mode(self.edit)
- remove = BrokerRemove(app, "remove")
- self.add_mode(remove)
- self.set_remove_mode(remove)
+ self.queue = QueueFrame(app, "queue")
+ self.add_mode(self.queue)
- self.__queue = QueueFrame(app, "queue")
- self.add_mode(self.__queue)
-
- self.__queues_purge = QueueSetPurge(app, "queuespurge")
- self.add_mode(self.__queues_purge)
+ self.queues_purge = QueueSetPurge(app, "queuespurge")
+ self.add_mode(self.queues_purge)
- self.__queues_remove = QueueSetRemove(app, "queuesremove")
- self.add_mode(self.__queues_remove)
+ self.queues_remove = QueueSetRemove(app, "queuesremove")
+ self.add_mode(self.queues_remove)
- self.__queue_add = QueueAdd(app, "queueadd")
- self.add_mode(self.__queue_add)
+ self.queue_add = QueueAdd(app, "queueadd")
+ self.add_mode(self.queue_add)
- self.__exchange = ExchangeFrame(app, "exchange")
- self.add_mode(self.__exchange)
+ self.exchange = ExchangeFrame(app, "exchange")
+ self.add_mode(self.exchange)
- self.__exchanges_remove = ExchangeSetRemove(app, "exchangesremove")
- self.add_mode(self.__exchanges_remove)
-
- self.__exchange_add = ExchangeAdd(app, "exchangeadd")
- self.add_mode(self.__exchange_add)
+ self.exchange_add = ExchangeAdd(app, "exchangeadd")
+ self.add_mode(self.exchange_add)
- self.__exchange_bindings_remove = ExchangeBindingSetRemove(app, "exbindingsremove")
- self.add_mode(self.__exchange_bindings_remove)
+ self.exchanges_remove = ExchangeSetRemove(app, "exchangesremove")
+ self.add_mode(self.exchanges_remove)
- self.__queue_bindings_remove = QueueBindingSetRemove(app, "qubindingsremove")
- self.add_mode(self.__queue_bindings_remove)
+ self.bindings_remove = BindingSetRemove(app, "bindingsremove")
+ self.add_mode(self.bindings_remove)
- self.__peer = PeerFrame(app, "peer")
- self.add_mode(self.__peer)
+ self.link = PeerFrame(app, "link")
+ self.add_mode(self.link)
- self.__broker_add = BrokerLinkAdd(app, "brokeradd")
- self.add_mode(self.__broker_add)
+ self.link_add = BrokerLinkAdd(app, "linkadd")
+ self.add_mode(self.link_add)
- self.__conn = ConnectionFrame(app, "conn")
- self.add_mode(self.__conn)
+ self.links_close = BrokerSetClose(app, "linksclose")
+ self.add_mode(self.links_close)
- self.__conns_close = ConnectionSetClose(app, "connsclose")
- self.add_mode(self.__conns_close)
-
- self.__broker_links_close = BrokerSetClose(app, "brokersclose")
- self.add_mode(self.__broker_links_close)
+ self.connection = ConnectionFrame(app, "conn")
+ self.add_mode(self.connection)
- def show_queue(self, session, queue):
- self.__queue.set_object(session, queue)
- self.page.set_current_frame(session, self.__queue)
- return self.show_mode(session, self.__queue)
-
- def show_queues_purge(self, session):
- self.page.set_current_frame(session, self.__queues_purge)
- return self.show_mode(session, self.__queues_purge)
-
- def show_queues_remove(self, session):
- self.page.set_current_frame(session, self.__queues_remove)
- return self.show_mode(session, self.__queues_remove)
-
- def show_queue_add(self, session):
- self.page.set_current_frame(session, self.__queue_add)
- return self.show_mode(session, self.__queue_add)
-
- def show_exchange(self, session, exchange):
- self.__exchange.set_object(session, exchange)
- self.page.set_current_frame(session, self.__exchange)
- return self.show_mode(session, self.__exchange)
-
- def show_exchanges_remove(self, session):
- self.page.set_current_frame(session, self.__exchanges_remove)
- return self.show_mode(session, self.__exchanges_remove)
-
- def show_exchange_bindings_remove(self, session, exchange):
- self.__exchange_bindings_remove.set_exchange(exchange)
- self.page.set_current_frame(session, self.__exchange_bindings_remove)
- return self.show_mode(session, self.__exchange_bindings_remove)
-
- def show_queue_bindings_remove(self, session, queue):
- self.__queue_bindings_remove.set_queue(queue)
- self.page.set_current_frame(session, self.__queue_bindings_remove)
- return self.show_mode(session, self.__queue_bindings_remove)
-
- def show_exchange_add(self, session):
- return self.show_mode(session, self.__exchange_add)
-
- def show_peer(self, session, peer):
- self.__peer.set_object(session, peer)
- self.page.set_current_frame(session, self.__peer)
- return self.show_mode(session, self.__peer)
-
- def show_broker_link_add(self, session):
- self.page.set_current_frame(session, self.__broker_add)
- return self.show_mode(session, self.__broker_add)
-
- def show_broker_links_close(self, session):
- self.page.set_current_frame(session, self.__broker_links_close)
- return self.show_mode(session, self.__broker_links_close)
-
- def show_connection(self, session, conn):
- self.__conn.set_object(session, conn)
- self.page.set_current_frame(session, self.__conn)
- return self.show_mode(session, self.__conn)
-
- def show_connections_close(self, session):
- self.page.set_current_frame(session, self.__conns_close)
- return self.show_mode(session, self.__conns_close)
-
+ self.connections_close = ConnectionSetClose(app, "connsclose")
+ self.add_mode(self.connections_close)
+
class BrokerStatus(CuminStatus):
pass
@@ -323,7 +250,7 @@
def render_add_queue_href(self, session, reg):
branch = session.branch()
- self.frame.show_queue(branch, None).show_add(branch)
+ self.frame.queue.add.show(branch, None)
return branch.marshal()
class BrokerLogTab(Widget):
@@ -523,7 +450,7 @@
def render_add_broker_href(self, session):
branch = session.branch()
- self.frame.show_brokers_add(branch)
+ self.frame.brokers_add.show(branch)
return branch.marshal()
def render_clear_filters_href(self, session):
@@ -834,42 +761,7 @@
for group in reg.groups:
self.groups.get(session).append(group)
-class BrokerRemove(CuminConfirmForm):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def process_cancel(self, session, reg):
- branch = session.branch()
- self.frame.show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
- def process_submit(self, session, reg):
- action = self.app.model.broker_registration.remove
- action.invoke(reg)
-
- branch = session.branch()
- self.page.show_main(branch).show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
- def render_title(self, session, reg):
- return "Unregister Broker '%s'" % reg.name
-
- def render_submit_content(self, session, reg):
- return "Yes, Unregister Broker '%s'" % reg.name
-
- def render_cancel_content(self, session, reg):
- return "No, Cancel"
-
class BrokerSetRemove(CuminBulkActionForm, Frame):
- def __init__(self, app, name):
- super(BrokerSetRemove, self).__init__(app, name)
-
- self.return_url = Parameter(app, "return_url")
- self.add_parameter(self.return_url)
-
- def process_return(self, session):
- self.page.set_redirect_url(session, self.return_url.get(session))
-
def process_item(self, session, id):
action = self.app.model.broker_registration.remove
# XXX need to handle object not found case
Modified: mgmt/trunk/cumin/python/cumin/brokercluster.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/brokercluster.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -119,7 +119,7 @@
def process_cancel(self, session):
branch = session.branch()
- self.page.show_main(branch)
+ self.page.main.show(branch)
self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
@@ -157,7 +157,7 @@
cluster.destroySelf()
branch = session.branch()
- self.page.show_main(branch)
+ self.page.main.show(branch)
self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, cluster):
Modified: mgmt/trunk/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokergroup.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/brokergroup.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -63,21 +63,21 @@
self.object = BrokerGroupParameter(app, "id")
self.add_parameter(self.object)
- view = BrokerGroupView(app, "view")
- self.add_child(view)
- self.set_view_mode(view)
+ self.view = BrokerGroupView(app, "view")
+ self.add_child(self.view)
+ self.set_view_mode(self.view)
- add = BrokerGroupAdd(app, "add")
- self.add_child(add)
- self.set_add_mode(add)
+ self.add = BrokerGroupAdd(app, "add")
+ self.add_child(self.add)
+ self.set_add_mode(self.add)
- edit = BrokerGroupEdit(app, "edit")
- self.add_child(edit)
- self.set_edit_mode(edit)
+ self.edit = BrokerGroupEdit(app, "edit")
+ self.add_child(self.edit)
+ self.set_edit_mode(self.edit)
- remove = BrokerGroupRemove(app, "remove")
- self.add_child(remove)
- self.set_remove_mode(remove)
+ self.remove = BrokerGroupRemove(app, "remove")
+ self.add_child(self.remove)
+ self.set_remove_mode(self.remove)
def render_title(self, session, group):
if group:
Modified: mgmt/trunk/cumin/python/cumin/brokerlink.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/brokerlink.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -45,7 +45,8 @@
def render_add_broker_link_url(self, session, vhost):
branch = session.branch()
- self.frame.show_broker_link_add(branch)
+ self.frame.set_object(branch, vhost.broker.registration)
+ self.frame.link_add.show(branch)
return branch.marshal()
def get_args(self, session):
@@ -114,9 +115,7 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_broker_links_close(branch)
- frame.ids.set(branch, ids)
+ href = self.frame.links_close.get_href(session, ids)
self.page.set_redirect_url(session, branch.marshal())
class PeerRouteSet(CuminTable, Form):
@@ -231,10 +230,15 @@
self.__routes_close = PeerRouteSetClose(app, "routesclose")
self.add_mode(self.__routes_close)
-
def render_title(self, session, peer):
return super(PeerFrame, self).render_title(session, peer)
+ def show_object(self, session, peer):
+ reg = peer.vhost.broker.registration
+ self.page.main.broker.set_object(session, reg)
+
+ return super(PeerFrame, self).show_object(session, peer)
+
def show_bridge_add(self, session):
self.page.set_current_frame(session, self.__bridge_add)
return self.show_mode(session, self.__bridge_add)
@@ -480,7 +484,6 @@
self.process_cancel(session, link)
-
class BrokerLinkAdd(CuminFieldForm):
def __init__(self, app, name):
super(BrokerLinkAdd, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/brokerprofile.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/brokerprofile.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -120,7 +120,7 @@
def process_cancel(self, session):
branch = session.branch()
- self.page.show_main(branch)
+ self.page.main.show(branch)
self.page.set_redirect_url(session, branch.marshal())
def process_submit(self, session):
@@ -158,7 +158,7 @@
profile.destroySelf()
branch = session.branch()
- self.page.show_main(branch)
+ self.page.main.show(branch)
self.page.set_redirect_url(session, branch.marshal())
def render_title(self, session, profile):
Modified: mgmt/trunk/cumin/python/cumin/client.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/client.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -67,22 +67,19 @@
def process_submit(self, session):
ids = self.parent.ids.get(session)
+ # XXX Make table a frame to elim this
self.parent.ids.clear(session)
+ href = self.frame.connections_close.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
- branch = session.branch()
- frame = self.frame.show_connections_close(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
-
class AddressColumn(SqlTableColumn):
def render_title(self, session, data):
return "Address"
def render_content(self, session, data):
conn = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_connection(branch, conn).show_view(branch)
- return fmt_olink(branch, conn, name=data["addr"])
+ href = self.frame.connection.get_href(session, conn)
+ return fmt_link(href, fmt_shorten(data["addr"]))
class SentColumn(NullSortColumn, FreshDataOnlyColumn):
def render_title(self, session, data):
@@ -126,6 +123,12 @@
self.__sessions_close = SessionSetClose(app, "sessionsclose")
self.add_mode(self.__sessions_close)
+ def show_object(self, session, conn):
+ reg = conn.vhost.broker.registration
+ self.page.main.broker.set_object(session, reg)
+
+ return super(ConnectionFrame, self).show_object(session, conn)
+
def show_close(self, session):
return self.show_mode(session, self.__close)
Modified: mgmt/trunk/cumin/python/cumin/client.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/client.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/client.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -128,7 +128,7 @@
</table>
[SessionSet.sql]
-select s.id, s.name, c.expire_time as expires, c.attached as status
+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
Modified: mgmt/trunk/cumin/python/cumin/collector.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/collector.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -27,6 +27,9 @@
self.add_column(col)
self.set_default_column(col)
+ col = self.SystemColumn(app, "system")
+ self.add_column(col)
+
self.__start = self.StartButton(app, "start")
self.add_child(self.__start)
@@ -41,11 +44,19 @@
return "Name"
def render_content(self, session, data):
- sub = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_collector(branch, sub).show_view(branch)
- return fmt_olink(branch, sub, name=data["name"])
+ coll = Identifiable(data["id"])
+ href = self.page.main.pool.collector.get_href(session, coll)
+ return fmt_link(href, data["name"])
+ class SystemColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "System"
+
+ def render_content(self, session, data):
+ sys = Identifiable(data["system_id"])
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
@@ -72,7 +83,7 @@
def render_content(self, session):
return "Stop"
-class CollectorFrame(CuminFrame, JobSetFrame):
+class CollectorFrame(CuminFrame):
def __init__(self, app, name):
super(CollectorFrame, self).__init__(app, name)
@@ -83,7 +94,6 @@
self.add_mode(view)
self.set_view_mode(view)
-
class CollectorView(CuminView):
def __init__(self, app, name):
super(CollectorView, self).__init__(app, name)
@@ -135,4 +145,3 @@
action = self.app.model.master.stop
action.invoke(collector, {"subsystem": "COLLECTOR"})
self.process_cancel(session)
-
Modified: mgmt/trunk/cumin/python/cumin/collector.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/collector.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/collector.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -1,11 +1,18 @@
[CollectorSet.sql]
select
c.id,
- c.name
+ c.name,
+ y.id as system_id,
+ y.node_name as system_name
from collector as c
+inner join system as y on c.system = y.node_name
+{sql_where}
+{sql_orderby}
+{sql_limit}
[CollectorSet.count_sql]
-select count(1) from collector
+select count(*) from collector as c
+{sql_where}
[CollectorView.javascript]
function updateCollector(data) {
Modified: mgmt/trunk/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/exchange.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/exchange.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -81,7 +81,7 @@
def render_add_exchange_url(self, session, vhost):
branch = session.branch()
- self.frame.show_exchange_add(branch)
+ self.frame.exchange_add.show(branch)
return branch.marshal()
def render_title(self, session, vhost):
@@ -102,13 +102,11 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame.show_exchanges_remove(branch)
- frame.ids.set(branch, ids)
+ self.frame.exchanges_remove.show(branch).ids.set(branch, ids)
self.page.set_redirect_url(session, branch.marshal())
def render_content(self, session):
return "Remove"
-
class NameColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -116,10 +114,9 @@
def render_content(self, session, data):
exchange = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_exchange(branch, exchange).show_view(branch)
+ href = self.frame.exchange.get_href(session, exchange)
name = data["name"] or "<em>Default</em>"
- return fmt_olink(branch, exchange, name=name)
+ return fmt_link(href, fmt_shorten(name))
class ProducersColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -128,23 +125,14 @@
def render_content(self, session, data):
return data["producers"]
- # Restore later
- 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"])
-
class BindingsColumn(SqlTableColumn):
def render_title(self, session, data):
return "Bindings"
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"])
+ href = self.frame.exchange.get_href(session, exchange)
+ return fmt_link(href, data["bindings"])
class ReceivedColumn(NullSortColumn, FreshDataOnlyColumn):
def render_title(self, session, data):
@@ -176,14 +164,6 @@
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)
-
-def show_bindings(page, session, exchange):
- frame = page.show_exchange(session, exchange).show_view(session)
- return frame.show_bindings(session)
-
class ExchangeSetRemove(CuminBulkActionForm):
def process_return(self, session):
branch = session.branch()
@@ -210,14 +190,20 @@
self.object = ExchangeParameter(app, "id")
self.add_parameter(self.object)
- view = ExchangeView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = ExchangeView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- remove = ExchangeRemove(app, "remove")
- self.add_mode(remove)
- self.set_remove_mode(remove)
-
+ self.remove = ExchangeRemove(app, "remove")
+ self.add_mode(self.remove)
+ self.set_remove_mode(self.remove)
+
+ def show_object(self, session, exchange):
+ reg = exchange.vhost.broker.registration
+ self.page.main.broker.set_object(session, reg)
+
+ return super(ExchangeFrame, self).show_object(session, exchange)
+
def render_title(self, session, exchange):
if exchange.name:
return super(ExchangeFrame, self).render_title(session, exchange)
@@ -326,11 +312,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- exchange = self.frame.get_args(session)[0]
- branch = session.branch()
- frame = self.frame.frame.show_exchange_bindings_remove(branch, exchange)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.page.main.broker.bindings_remove.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Remove"
@@ -353,42 +336,6 @@
qname = binding.queue.name
return "Exchange: %s <i>and</i> Queue: %s" % (ename, qname)
-class ExchangeBindingSetRemove(BindingSetRemove):
- def __init__(self, app, name):
- super(ExchangeBindingSetRemove, self).__init__(app, name)
-
- self.__exchange = None
-
- def set_exchange(self, exchange):
- self.__exchange = exchange
-
- def process_return(self, session):
- branch = session.branch()
- if self.__exchange:
- mode = self.frame.show_exchange(branch, self.__exchange)
- mode.show_view(branch).show_bindings(branch)
- else:
- self.frame.show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
-class QueueBindingSetRemove(BindingSetRemove):
- def __init__(self, app, name):
- super(QueueBindingSetRemove, self).__init__(app, name)
-
- self.__queue = None
-
- def set_queue(self, queue):
- self.__queue = queue
-
- def process_return(self, session):
- branch = session.branch()
- if self.__queue:
- mode = self.frame.show_queue(branch, self.__queue)
- mode.show_view(branch).show_bindings(branch)
- else:
- self.frame.show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
class ExchangeForm(CuminFieldForm):
def __init__(self, app, name):
super(ExchangeForm, self).__init__(app, name)
@@ -463,33 +410,6 @@
def render_title(self, session):
return "Add Exchange"
-class ExchangeEdit(ExchangeForm):
- def get_args(self, session):
- return self.frame.get_args(session)
-
- def process_cancel(self, session, exchange):
- branch = session.branch()
- self.page.show_exchange(branch, exchange).show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
-
- def process_submit(self, session, exchange):
- if self.validate(session):
- exchange.lock()
- try:
- exchange.name = self.exchange_name.get(session)
- exchange.type = self.type.get(session)
- finally:
- exchange.unlock()
-
- self.process_cancel(session, exchange)
-
- def process_display(self, session, exchange):
- self.exchange_name.set(session, exchange.name)
- self.type.set(session, exchange.type)
-
- def render_title(self, session, exchange):
- return "Edit Exchange '%s'" % exchange.name
-
class ExchangeStats(TabbedModeSet):
def __init__(self, app, name):
super(ExchangeStats, self).__init__(app, name)
@@ -543,5 +463,3 @@
@classmethod
def get_builtins(cls):
return ["", "amq.direct", "amq.topic", "amq.match", "amq.fanout", "qpid.management"]
-
-
Modified: mgmt/trunk/cumin/python/cumin/formats.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/formats.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/formats.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -109,7 +109,7 @@
def fmt_none_brief():
return "<span class=\"none\">–</span>"
-def fmt_shorten(string, pre=16, post=0):
+def fmt_shorten(string, pre=16, post=4):
if len(string) > pre + post:
if post:
string = string[:pre] + "…" + string[-post:]
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -97,32 +97,32 @@
class ConcurrencyLimitsColumn(SqlTableColumn):
def render_title(self, session, data):
- return "Conc. Limits"
+ return "Limits"
class CustomGroupColumn(SqlTableColumn):
def render_title(self, session, data):
return "Job Group"
def render_content(self, session, data):
- job_group = Identifiable(data[self.name])
- if job_group:
- branch = session.branch()
- self.frame.show_job_group(branch, job_group).show_view(branch)
- return fmt_olink(branch, job_group, name=data[self.name], pre=12, post=3)
+ name = data[self.name]
+
+ if name:
+ group = Identifiable(name)
+ href = self.page.main.pool.job_group.get_href(session, group)
+ return fmt_link(href, fmt_shorten(name, 12, 3))
class CustomIdColumn(SqlTableColumn):
def render_title(self, session, data):
return "ID"
def render_content(self, session, data):
- job = Identifiable(data["id"])
- if data[self.name]:
- branch = session.branch()
- self.frame.show_job(branch, job).show_view(branch)
- return fmt_olink(branch, job, name=data[self.name], pre=12, post=3)
- else:
- return data[self.name] # none
+ id = data[self.name]
+ if id:
+ job = Identifiable(data["id"])
+ href = self.page.main.pool.job.get_href(session, job)
+ return fmt_link(href, fmt_shorten(id, 12, 3))
+
class CustomPriorityColumn(SqlTableColumn):
def render_title(self, session, data):
return "Custom Priority"
@@ -132,15 +132,13 @@
return "Global Job Id"
def render_content(self, session, data):
- job = Identifiable(data["id"])
- if data[self.name]:
- #job = Identifiable(data[self.name])
- #if job:
- branch = session.branch()
- self.frame.show_job(branch, job).show_view(branch)
- return fmt_olink(branch, job, name=data[self.name], pre=12, post=3)
- else:
- return data[self.name] # none
+ id = data["id"]
+
+ if id:
+ job = Identifiable(data["id"])
+ href = self.frame.job.get_href(session, job)
+ content = fmt_shorten(data[self.name], 12, 3)
+ return fmt_link(href, content)
class StatusColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -159,27 +157,25 @@
return "Submitter"
def render_content(self, session, data):
- submitter = Identifiable(data["submitter_id"])
- if data["submitter"]:
- branch = session.branch()
- self.frame.show_submitter(branch, submitter).show_view(branch)
- return fmt_olink(branch, submitter, name=data[self.name])
- else:
- return data["submitter"]
+ name = data["submitter"]
+
+ if name:
+ sub = Identifiable(data["submitter_id"])
+ href = self.page.main.pool.submitter.get_href(session, sub)
+ return fmt_link(href, fmt_shorten(name))
class SchedulerColumn(SqlTableColumn):
def render_title(self, session, data):
return "Scheduler"
def render_content(self, session, data):
- scheduler = Identifiable(data["scheduler_id"])
- if data["scheduler"]:
- branch = session.branch()
- self.frame.show_scheduler(branch, scheduler).show_view(branch)
- return fmt_olink(branch, scheduler, name=data[self.name])
- else:
- return data["scheduler"]
-
+ name = data["scheduler"]
+
+ if name:
+ sched = Identifiable(data["scheduler_id"])
+ href = self.page.main.pool.scheduler.get_href(session, sched)
+ return fmt_link(href, fmt_shorten(name))
+
class CommandColumn(ItemTableColumn):
def render_title(self, session, data):
return "Command"
@@ -206,16 +202,17 @@
def find_job(self, session):
search_term = self.job_search.get(session)
+
if search_term:
object = self.frame.get_object(session)
rows = self.find_item(session, object)
+
if rows:
try:
first = rows[0]
job = Identifiable(first["id"])
- branch = session.branch()
- self.frame.show_job(branch, job).show_view(branch)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.job.get_href(session, job)
+ self.page.set_redirect_url(session, href)
except:
self.job_search.set_not_found(session, search_term)
else:
@@ -233,9 +230,14 @@
return self.get_request_visible_columns(session, ["custom_group", "scheduler", "submitter"])
def render_sql_where(self, session, *args):
- phase_sql = self.get_phase_sql(session)
- return "where %s" % phase_sql
+ elems = list()
+ elems.append(self.get_phase_sql(session))
+ elems.append("s.pool = %(pool)s")
+ return "where %s" % " and ".join(elems)
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
+
def render_count(self, session, *args):
count = self.get_item_count(session, *args)
phase = self.get_phase_title(session)
@@ -278,31 +280,6 @@
def render_content(self, session):
return "Go"
-class JobSetFrame(object):
- """ Intermediate class to consolidate the show_xxx methods associated with a jobset
-
- Used by LimitsFrame, SchedulerFrame, SubmitterFrame, etc."""
- def show_job(self, session, job):
- return self.frame.show_job(session, job)
-
- def show_scheduler(self, session, sched):
- return self.frame.show_scheduler(session, sched)
-
- def show_submitter(self, session, submitter):
- return self.frame.show_submitter(session, submitter)
-
- def show_job_group(self, session, job_group):
- return self.frame.show_job_group(session, job_group)
-
- def show_jobs_hold(self, session):
- return self.frame.show_jobs_hold(session)
-
- def show_jobs_release(self, session):
- return self.frame.show_jobs_release(session)
-
- def show_jobs_remove(self, session):
- return self.frame.show_jobs_remove(session)
-
from system import SystemFrame, SystemSet
class JobGroupFrame(CuminFrame):
@@ -312,36 +289,13 @@
self.object = JobGroupParameter(app, "id")
self.add_parameter(self.object)
- view = JobGroupView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = JobGroupView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- self.__system = SystemFrame(app, "system")
- self.add_mode(self.__system)
+ self.system = SystemFrame(app, "system")
+ self.add_mode(self.system)
- def show_system(self, session, system):
- frame = self.show_mode(session, self.__system)
- frame.set_object(session, system)
- return self.page.set_current_frame(session, frame)
-
- def show_job(self, session, job):
- return self.frame.show_job(session, job)
-
- def show_scheduler(self, session, sched):
- return self.frame.show_scheduler(session, sched)
-
- def show_submitter(self, session, submitter):
- return self.frame.show_submitter(session, submitter)
-
- def show_jobs_hold(self, session):
- return self.frame.show_jobs_hold(session)
-
- def show_jobs_release(self, session):
- return self.frame.show_jobs_release(session)
-
- def show_jobs_remove(self, session):
- return self.frame.show_jobs_remove(session)
-
class JobGroupView(CuminView):
def __init__(self, app, name):
super(JobGroupView, self).__init__(app, name)
@@ -417,16 +371,13 @@
percent = (value*1.0) / (jobs*1.0) * 100.0
return jobs and "%2.1f" % percent or "-"
-
class JobRemoveButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_jobs_remove(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.jobs_remove.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Remove"
@@ -444,10 +395,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_jobs_hold(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.jobs_hold.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Hold"
@@ -465,10 +414,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_jobs_release(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.jobs_release.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Release"
@@ -1014,11 +961,12 @@
return "Job Group"
def render_content(self, session, data):
- job_group = Identifiable(data[self.name])
- if job_group:
- branch = session.branch()
- self.frame.show_job_group(branch, job_group).show_view(branch)
- return fmt_olink(branch, job_group, name=data[self.name])
+ name = data[self.name]
+
+ if name:
+ group = Identifiable(name)
+ href = self.page.main.pool.job_group.get_href(session, group)
+ return fmt_link(href, fmt_shorten(name))
class JobsCountColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -1088,10 +1036,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_job_group_remove(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.job_group_remove.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Remove"
@@ -1101,10 +1047,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_job_group_hold(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.job_group_hold.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Hold"
@@ -1114,10 +1058,8 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- branch = session.branch()
- frame = self.frame.show_job_group_release(branch)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.job_group_release.get_href(session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Release"
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -33,7 +33,7 @@
left outer join job_stats as p on p.id = j.stats_prev_id
[JobSet.count_sql]
-select count(1)
+select count(1)
from job as j
left outer join job_stats as c on c.id = j.stats_curr_id
left outer join job_stats as p on p.id = j.stats_prev_id
@@ -118,14 +118,16 @@
var job_search_default_prompt = "{search_default_prompt}"
var job_search_prompt = "{search_prompt}"
</script>
+
[JobGroupSet.sql]
-select distinct
+select
j.custom_group as id,
j.custom_group as job_group,
- (select count(distinct j.global_job_id) from job as j ) as jobs
-/* 1 as jobs */
+ count(*) as jobs
from job as j
+inner join scheduler as s on s.id = j.scheduler_id
{sql_where}
+group by j.custom_group
{sql_orderby}
{sql_limit}
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -76,7 +76,7 @@
return [{"name":x, "curr":limits[x]["CURRENT"], "max":limits[x]["MAX"]} for x in keys]
def render_title(self, session):
- return self.limit_count.get_title(session, "Concurrency Limits")
+ return self.limit_count.get_title(session, "Limits")
class LimitCount(AjaxField):
def get_url(self, session):
@@ -94,9 +94,8 @@
def render_content(self, session, data):
limit = Identifiable(data["name"])
- branch = session.branch()
- self.frame.show_limit(branch, limit).show_view(branch)
- return fmt_olink(branch, limit, name=data["name"])
+ href = self.frame.limit.get_href(session, limit)
+ return fmt_link(href, data["name"])
class CurrentColumn(ItemTableColumn):
def render_title(self, session, data):
@@ -110,7 +109,7 @@
def get_default(self, session):
return dict()
-class LimitsFrame(CuminFrame, JobSetFrame, LimitActions):
+class LimitsFrame(CuminFrame, LimitActions):
def __init__(self, app, name):
super(LimitsFrame, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -23,6 +23,8 @@
self.classes = list()
self.invocations = set()
+ self.frame = None
+
# Messaging
CuminBroker(self)
@@ -64,6 +66,11 @@
def init(self):
self.data.init()
+ self.frame = self.app.main_page.main
+
+ for cls in self.classes:
+ cls.init()
+
def start(self):
self.data.start()
@@ -109,13 +116,17 @@
writer.write("</model>")
def show_main(self, session):
- return self.app.main_page.show_main(session)
+ return self.app.main_page.main.show(session)
+ def get_main_pool(self):
+ for coll in Collector.select():
+ return Pool(coll)
+
class AdProperty(object):
groups = ["Main", "Command Info", "Job Status Info", "Condor Info", "Other"]
def __init__(self, cls, name):
- self.cumin_model = cls.cumin_model
+ self.model = cls.model
self.cumin_class = cls
self.description = None
@@ -128,6 +139,9 @@
self.cumin_class.add_ad_property(self)
+ def init(self):
+ pass
+
def get_title(self, session):
if self.title:
return self.title
@@ -140,7 +154,7 @@
class CuminProperty(object):
def __init__(self, cls, name):
- self.cumin_model = cls.cumin_model
+ self.model = cls.model
self.cumin_class = cls
self.name = name
@@ -151,6 +165,9 @@
self.cumin_class.add_property(self)
+ def init(self):
+ pass
+
def get_title(self, session):
if self.title:
return self.title
@@ -167,7 +184,7 @@
class CuminAction(object):
def __init__(self, cls, name):
- self.cumin_model = cls.cumin_model
+ self.model = cls.model
self.cumin_class = cls
self.name = name
@@ -178,6 +195,9 @@
self.cumin_class.add_action(self)
+ def init(self):
+ pass
+
def show(self, session, object):
raise Exception("Not implemented")
@@ -222,7 +242,7 @@
log.exception(e)
finally:
- self.cumin_model.invocations.add(invoc)
+ self.model.invocations.add(invoc)
#invoc.prt()
@@ -232,7 +252,7 @@
pass
def getSessionFromRegistration(self, reg):
- conn = self.cumin_model.data.getConnectionByRegistration(reg)
+ conn = self.model.data.getConnectionByRegistration(reg)
for sess in conn.mconn.sessions:
if conn.mconn.sessions[sess].name == conn.getSessionId():
#this is active management session
@@ -254,7 +274,7 @@
if not verb:
verb = self.action.get_title(session)
if self.object:
- cls = self.action.cumin_model.get_class_by_object(self.object)
+ cls = self.action.model.get_class_by_object(self.object)
object = cls.get_object_title(session, self.object)
else:
object = self.action.cumin_class.get_title(session)
@@ -279,7 +299,7 @@
class CuminStat(object):
def __init__(self, cls, name):
- self.cumin_model = cls.cumin_model
+ self.model = cls.model
self.cumin_class = cls
self.name = name
@@ -293,6 +313,9 @@
self.cumin_class.add_stat(self)
+ def init(self):
+ pass
+
def samples(self, object, secs):
stats = object.stats
@@ -391,7 +414,7 @@
class CuminClass(object):
def __init__(self, model, name, mint_class):
- self.cumin_model = model
+ self.model = model
self.cumin_name = name
self.mint_class = mint_class
@@ -403,8 +426,10 @@
self.ad_properties = list()
self.ad_properties_by_name = dict()
- self.cumin_model.add_class(self)
+ self.frame = None
+ self.model.add_class(self)
+
def add_property(self, prop):
self.properties.append(prop)
setattr(self, prop.name, prop)
@@ -421,6 +446,19 @@
self.actions.append(action)
setattr(self, action.name, action)
+ def init(self):
+ for prop in self.properties:
+ prop.init()
+
+ for ad_prop in self.ad_properties:
+ ad_prop.init()
+
+ for stat in self.stats:
+ stat.init()
+
+ for action in self.actions:
+ action.init()
+
def get_title(self, session):
return "Object"
@@ -439,7 +477,7 @@
return self.get_object_href(session, Identifiable(id))
def show_object(self, session, object):
- raise Exception("Not implemented")
+ return self.frame.show_object(session, object)
def get_object_title(self, session, object):
title = self.get_title(session)
@@ -485,80 +523,6 @@
prop.title = "Last Updated"
prop.summary = True
-class LocalClass(CuminClass):
- def __init__(self, model, name, mint_class):
- super(LocalClass, self).__init__(model, name, mint_class)
-
- action = self.Add(self, "add")
- action.title = "Add"
-
- action = self.Edit(self, "edit")
- action.title = "Edit"
-
- action = self.Remove(self, "remove")
- action.title = "Remove"
-
- class Add(CuminAction):
- def __init__(self, cls, name):
- super(LocalClass.Add, self).__init__(cls, name)
-
- self.navigable = False
-
- def show(self, session, object):
- frame = self.cumin_class.show_object(session, object)
- return frame.show_add(session)
-
- def do_invoke(self, object, args, completion):
- assert object is None
-
- try:
- object = self.cumin_class.mint_class(**args)
-
- self.cumin_model.app.broker_connect_thread.prompt()
-
- completion("OK")
-
- return object
- except Exception, e:
- log.exception("Action failed")
- completion(e.message or "failed")
-
- class Edit(CuminAction):
- def __init__(self, cls, name):
- super(LocalClass.Edit, self).__init__(cls, name)
-
- self.summary = True
-
- def show(self, session, object):
- frame = self.cumin_class.show_object(session, object)
- return frame.show_edit(session)
-
- def do_invoke(self, object, args, completion):
- try:
- object.set(**args)
- object.syncUpdate()
- completion("OK")
- except Exception, e:
- completion(e.message or "failed")
-
- class Remove(CuminAction):
- def __init__(self, cls, name):
- super(LocalClass.Remove, self).__init__(cls, name)
-
- self.summary = True
-
- def show(self, session, object):
- frame = self.cumin_class.show_object(session, object)
- return frame.show_remove(session)
-
- def do_invoke(self, object, args, completion):
- try:
- object.destroySelf();
- object.syncUpdate()
- completion("OK")
- except Exception, e:
- completion(e.message or "failed")
-
class CuminSystem(RemoteClass):
def __init__(self, model):
super(CuminSystem, self).__init__(model, "system", System, SystemStats)
@@ -586,15 +550,15 @@
#action.title = "Send Ping"
#action.summary = True
+ def init(self):
+ self.frame = self.model.frame.system
+
def get_title(self, session):
return "System"
def get_icon_href(self, session):
return "resource?name=system-36.png"
- def show_object(self, session, system):
- return self.cumin_model.show_main(session).show_system(session, system)
-
def get_object_name(self, object):
return object.nodeName
@@ -618,7 +582,7 @@
return "resource?name=system-36.png"
def show_object(self, session, system):
- return self.cumin_model.show_main(session).show_system(session, system)
+ return self.model.frame.system.show_object(session, system)
def get_object_name(self, object):
return object.nodeName
@@ -678,12 +642,15 @@
action = self.AddQueue(self, "add_queue")
action.summary = True
+ def init(self):
+ self.frame = self.model.frame.broker
+
def get_icon_href(self, session):
return "resource?name=broker-36.png"
def show_object(self, session, broker):
reg = broker.registration
- return self.cumin_model.show_main(session).show_broker(session, reg)
+ return super(CuminBroker, self).show_object(session, reg)
def get_object_name(self, broker):
return broker.id
@@ -695,9 +662,9 @@
def get_verb(self, session):
return "Add"
- def show(self, session, exchange):
- frame = self.cumin_class.show_object(session, exchange)
- return frame.show_exchange_add(session)
+ def show(self, session, reg):
+ frame = self.cumin_class.show_object(session, reg)
+ return frame.exchange_add.show(session)
def do_invoke(self, exchange, reg, completion):
session = self.getSessionFromRegistration(reg)
@@ -714,9 +681,9 @@
def get_verb(self, session):
return "Add"
- def show(self, session, exchange):
- frame = self.cumin_class.show_object(session, exchange)
- return frame.show_broker_link_add(session)
+ def show(self, session, reg):
+ frame = self.cumin_class.show_object(session, reg)
+ return frame.link_add.show(session)
def do_invoke(self, link, args, completion):
reg = args["reg"]
@@ -728,7 +695,7 @@
authMechanism = "PLAIN"
broker = reg._get_broker()
- broker.connect(self.cumin_model.data, completion,
+ broker.connect(self.model.data, completion,
link.host, link.port, link.useSsl, link.durable,
authMechanism, username, password)
@@ -741,7 +708,7 @@
def show(self, session, queue):
frame = self.cumin_class.show_object(session, queue)
- return frame.show_queue_add(session)
+ return frame.queue_add.show(session)
def do_invoke(self, queue, args, completion):
reg = args["reg"]
@@ -942,33 +909,34 @@
action = self.Bind(self, "bind")
action.summary = True
+ def init(self):
+ self.frame = self.model.frame.broker.queue
+
def get_title(self, session):
return "Queue"
def get_icon_href(self, session):
return "resource?name=queue-36.png"
- def show_object(self, session, queue):
- frame = self.cumin_model.show_main(session)
- return frame.show_broker(session, queue.vhost.broker.registration)
-
class Purge(CuminAction):
def show(self, session, queue):
- frame = self.cumin_class.show_object(session, queue)
- frame = frame.show_queue(session, queue)
- return frame.show_purge(session)
+ frame = self.model.frame.broker
+ frame.set_object(session, queue.vhost.broker.registration)
+ frame.queue.set_object(session, queue)
+ return frame.queue.purge.show(session)
def get_title(self, session):
return "Purge"
def do_invoke(self, queue, args, completion):
- queue.purge(self.cumin_model.data, completion, args["request"])
+ queue.purge(self.model.data, completion, args["request"])
class Remove(CuminAction):
def show(self, session, queue):
- frame = self.cumin_class.show_object(session, queue)
- frame = frame.show_queue(session, queue)
- return frame.show_remove(session)
+ frame = self.model.frame.broker
+ frame.set_object(session, queue.vhost.broker.registration)
+ frame.queue.set_object(session, queue)
+ return frame.queue.remove.show(session)
def get_title(self, session):
return "Remove"
@@ -982,9 +950,10 @@
class Bind(CuminAction):
def show(self, session, queue):
- frame = self.cumin_class.show_object(session, queue)
- frame = frame.show_queue(session, queue)
- return frame.show_queue_binding_add(session)
+ frame = self.model.frame.broker
+ frame.set_object(session, queue.vhost.broker.registration)
+ frame.queue.set_object(session, queue)
+ return frame.queue.binding_add.show(session)
def get_title(self, session):
return "Bind"
@@ -1052,9 +1021,8 @@
action = self.Remove(self, "remove")
action.summary = True
- def show_object(self, session, exchange):
- frame = self.cumin_model.show_main(session)
- return frame.show_broker(session, exchange.vhost.broker.registration)
+ def init(self):
+ self.frame = self.model.frame.broker.exchange
def get_title(self, session):
return "Exchange"
@@ -1076,8 +1044,7 @@
def show(self, session, exchange):
frame = self.cumin_class.show_object(session, exchange)
- frame = frame.show_exchange(session, exchange)
- return frame.show_remove(session)
+ return frame.remove.show(session)
def do_invoke(self, exchange, reg, completion):
session = self.getSessionFromRegistration(reg)
@@ -1111,9 +1078,11 @@
return "Remove"
def show(self, session, binding):
+ raise Exception("XXX")
+
frame = self.cumin_class.show_object(session, binding)
- frame = frame.show_exchange(session, binding)
- return frame.show_remove(session)
+ frame = frame.exchange.show_object(session, binding)
+ return frame.remove.show(session)
def do_invoke(self, binding, args, completion):
reg = binding.exchange.vhost.broker.registration
@@ -1164,7 +1133,7 @@
return frame.show_remove(session)
def do_invoke(self, bridge, args, completion):
- bridge.close(self.cumin_model.data, completion)
+ bridge.close(self.model.data, completion)
class CuminConnection(RemoteClass):
def __init__(self, model):
@@ -1202,10 +1171,8 @@
action = self.Close(self, "close")
action.summary = True
- def show_object(self, session, conn):
- frame = self.cumin_model.show_main(session)
- frame = frame.show_broker(session, conn.vhost.broker.registration)
- return frame.show_connection(session, conn)
+ def init(self):
+ self.frame = self.model.frame.broker.connection
def get_title(self, session):
return "Connection"
@@ -1226,7 +1193,7 @@
def do_invoke(self, conn, args, completion):
reg = conn.vhost.broker.registration
- mconn = self.cumin_model.data.getConnectionByRegistration(reg)
+ mconn = self.model.data.getConnectionByRegistration(reg)
# Does it contain a mgmt session?
@@ -1235,7 +1202,7 @@
raise Exception \
("Cannot close management connection %s", conn.address)
- conn.close(self.cumin_model.data, completion)
+ conn.close(self.model.data, completion)
class CuminSession(RemoteClass):
def __init__(self, model):
@@ -1278,13 +1245,13 @@
def do_invoke(self, sess, args, completion):
reg = sess.clientConnection.vhost.broker.registration
- conn = self.cumin_model.data.getConnectionByRegistration(reg)
+ conn = self.model.data.getConnectionByRegistration(reg)
if sess.name == conn.getSessionId():
raise Exception \
("Cannot close management session %s" % sess.name)
- sess.close(self.cumin_model.data, completion)
+ sess.close(self.model.data, completion)
class Detach(CuminAction):
def get_title(self, session):
@@ -1292,27 +1259,27 @@
def do_invoke(self, sess, args, completion):
reg = sess.clientConnection.vhost.broker.registration
- conn = self.cumin_model.data.getConnectionByRegistration(reg)
+ conn = self.model.data.getConnectionByRegistration(reg)
if sess.name == conn.getSessionId():
raise Exception \
("Cannot detach management session %s" % sess.name)
- sess.detach(self.cumin_model.data, completion)
+ sess.detach(self.model.data, completion)
class ResetLifespan(CuminAction):
def get_title(self, session):
return "Reset Lifespan"
def do_invoke(self, object, args, completion):
- object.resetLifespan(self.cumin_model.data, completion)
+ object.resetLifespan(self.model.data, completion)
class SolicitAck(CuminAction):
def get_title(self, session):
return "Solicit Acknowledgment"
def do_invoke(self, object, args, completion):
- object.solicitAck(self.cumin_model.data, completion)
+ object.solicitAck(self.model.data, completion)
class CuminLink(RemoteClass):
def __init__(self, model):
@@ -1354,6 +1321,9 @@
action = self.Bridge(self, "bridge")
action.summary = True
+
+ def init(self):
+ self.frame = self.model.frame.broker.link
def get_title(self, session):
return "Broker Link"
@@ -1361,10 +1331,6 @@
def get_object_name(self, link):
return "%s:%d" % (link.host, link.port)
- def show_object(self, session, link):
- frame = self.cumin_model.show_main(session)
- return frame.show_broker(session, link.vhost.broker.registration)
-
class Bridge(CuminAction):
def show(self, session, link):
frame = self.cumin_class.show_object(session, link)
@@ -1387,7 +1353,7 @@
srcIsQueue = 0
srcIsLocal = 0
- link.bridge(self.cumin_model.data, completion,
+ link.bridge(self.model.data, completion,
durable, src, dest, key,
tag, excludes, srcIsQueue, srcIsLocal)
@@ -1401,7 +1367,7 @@
return "Close"
def do_invoke(self, link, args, completion):
- link.close(self.cumin_model.data, completion)
+ link.close(self.model.data, completion)
class CuminBrokerStoreModule(RemoteClass):
def __init__(self, model):
@@ -1532,7 +1498,7 @@
prop = CuminProperty(self, "members")
prop.title = "Members"
-class CuminBrokerRegistration(LocalClass):
+class CuminBrokerRegistration(CuminClass):
def __init__(self, model):
super(CuminBrokerRegistration, self).__init__ \
(model, "broker_registration", BrokerRegistration)
@@ -1545,30 +1511,97 @@
prop.title = "Port"
prop.summary = True
- self.remove.title = "Unregister"
+ action = self.Add(self, "add")
+ action.title = "Add"
+ action.navigable = False
+ action = self.Edit(self, "edit")
+ action.title = "Edit"
+ action.summary = True
+
+ action = self.Remove(self, "remove")
+ action.title = "Unregister"
+ action.summary = True
+
+ def init(self):
+ self.frame = self.model.frame.broker
+
def get_title(self, session):
return "Broker"
def get_icon_href(self, session):
return "resource?name=broker-36.png"
- def show_object(self, session, reg):
- return self.cumin_model.show_main(session).show_broker(session, reg)
+ class Add(CuminAction):
+ def do_invoke(self, object, args, completion):
+ assert object is None
-class CuminBrokerGroup(LocalClass):
+ try:
+ object = self.cumin_class.mint_class(**args)
+
+ self.model.app.broker_connect_thread.prompt()
+
+ completion("OK")
+
+ return object
+ except Exception, e:
+ log.exception("Action failed")
+ completion(e.message or "failed")
+
+ class Edit(CuminAction):
+ def show(self, session, object):
+ frame = self.cumin_class.show_object(session, object)
+ return frame.show_edit(session)
+
+ def do_invoke(self, object, args, completion):
+ try:
+ object.set(**args)
+ object.syncUpdate()
+ completion("OK")
+ except Exception, e:
+ completion(e.message or "failed")
+
+ class Remove(CuminAction):
+ def show(self, session, object):
+ frame = self.model.frame.brokers_remove
+ frame.ids.set(session, [object.id])
+
+ branch = session.branch()
+ self.model.frame.view.show(branch)
+ frame.origin.set(session, branch.marshal())
+
+ return frame.show(session)
+
+ def do_invoke(self, object, args, completion):
+ try:
+ object.destroySelf();
+ object.syncUpdate()
+ completion("OK")
+ except Exception, e:
+ completion(e.message or "failed")
+
+class CuminBrokerGroup(CuminClass):
def __init__(self, model):
super(CuminBrokerGroup, self).__init__ \
(model, "broker_group", BrokerGroup)
- self.add.title = "Add Group"
+ action = self.Add(self, "add")
+ action.title = "Add"
+ action.navigable = False
+ action = self.Edit(self, "edit")
+ action.title = "Edit"
+ action.summary = True
+
+ action = self.Remove(self, "remove")
+ action.title = "Remove"
+ action.summary = True
+
action = self.RemoveSet(self, "remove_set")
action.title = "Remove"
- def show_object(self, session, group):
- frame = self.cumin_model.show_main(session)
- return frame.show_broker_group(session, group)
+ def init(self):
+ self.frame = self.model.frame.broker_group
def get_title(self, session):
return "Broker Group"
@@ -1576,24 +1609,77 @@
def get_icon_href(self, session):
return "resource?name=group-36.png"
+ class Add(CuminAction):
+ def show(self, session, object):
+ frame = self.cumin_class.show_object(session, object)
+ return frame.show_add(session)
+
+ def do_invoke(self, object, args, completion):
+ assert object is None
+
+ try:
+ object = self.cumin_class.mint_class(**args)
+
+ completion("OK")
+
+ return object
+ except Exception, e:
+ log.exception("Action failed")
+ completion(e.message or "failed")
+
+ class Edit(CuminAction):
+ def show(self, session, object):
+ frame = self.cumin_class.show_object(session, object)
+ return frame.show_edit(session)
+
+ def do_invoke(self, object, args, completion):
+ try:
+ object.set(**args)
+ object.syncUpdate()
+ completion("OK")
+ except Exception, e:
+ completion(e.message or "failed")
+
+ class Remove(CuminAction):
+ def show(self, session, object):
+ frame = self.model.frame.broker_groups_remove
+ frame.objects.set(session, [object])
+ return frame.show(session)
+
+ def do_invoke(self, object, args, completion):
+ try:
+ object.destroySelf();
+ object.syncUpdate()
+ completion("OK")
+ except Exception, e:
+ completion(e.message or "failed")
+
class RemoveSet(CuminSetAction):
def show(self, session, groups):
- frame = self.cumin_model.show_main(session)
- return frame.show_broker_groups_remove(session, groups)
+ frame = self.model.frame.broker_groups_remove
+ frame.objects.set(session, groups)
+ return frame.show(session)
def do_invoke(self, groups, args, completion):
for group in groups:
group.destroySelf()
group.syncUpdate()
- completion("yo!")
+ completion("OK")
+class Pool(object):
+ def __init__(self, collector):
+ assert collector
+
+ self.collector = collector
+ self.id = self.collector.Pool
+ self.name = self.collector.Name
+
class CuminPool(CuminClass):
def __init__(self, model):
- super(CuminPool, self).__init__ \
- (model, "collector_registration", CollectorRegistration)
+ super(CuminPool, self).__init__(model, "pool", Pool)
- prop = CuminProperty(self, "collectorId")
+ prop = CuminProperty(self, "id")
prop.title = "Collector ID"
prop.summary = True
@@ -1615,6 +1701,9 @@
stat = CuminStat(self, "Jobs")
stat.title = "Total Jobs"
+ def init(self):
+ self.frame = self.model.frame.pool
+
def get_title(self, session):
return "Pool"
@@ -1626,9 +1715,6 @@
return title
- def show_object(self, session, pool):
- return self.cumin_model.show_main(session).show_pool(session, pool)
-
class CuminLimit(CuminClass):
def __init__(self, model):
super(CuminLimit, self).__init__ \
@@ -1653,17 +1739,9 @@
action.navigable = False
action.title = "Set Limit"
- def show_object(self, session, limit):
- frame = self.cumin_model.show_main(session)
- frame = frame.children_by_name["pool"]
- return frame.show_limit(session, limit)
+ def init(self):
+ self.frame = self.model.frame.pool.limit
- class Edit(CuminAction):
- def show(self, session, limit):
- frame = self.cumin_class.show_object(session, limit)
- frame = frame.show_edit(session)
- return frame
-
def get_title(self, session):
return "Concurrency Limit"
@@ -1672,6 +1750,12 @@
name = limit.id
return "%s '%s'" % (title, name)
+ class Edit(CuminAction):
+ def show(self, session, limit):
+ frame = self.cumin_class.show_object(session, limit)
+ frame = frame.show_edit(session)
+ return frame
+
class SetLimit(CuminAction):
def show(self, session, job):
pass
@@ -1682,7 +1766,7 @@
def do_invoke(self, limit, negotiator, completion):
Name = limit.id
Max = limit.max
- negotiator.SetLimit(self.cumin_model.data, completion, Name, str(Max))
+ negotiator.SetLimit(self.model.data, completion, Name, str(Max))
class CuminJobGroup(CuminClass):
def __init__(self, model):
@@ -1716,9 +1800,8 @@
action.title = "Remove"
action.summary = True
- def show_object(self, session, group):
- frame = self.cumin_model.show_main(session)
- return frame.children_by_name["pool"]
+ def init(self):
+ self.frame = self.model.frame.pool.job_group
def get_object_title(self, session, group):
title = self.get_title(session)
@@ -1733,26 +1816,20 @@
class Hold(CuminAction):
def show(self, session, group):
- frame = self.cumin_class.show_object(session, group)
- frame = frame.show_job_group_hold(session)
- ids = [group.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.job_group_hold.show(session)
+ frame.ids.set(session, [group.id])
return frame
class Release(CuminAction):
def show(self, session, group):
- frame = self.cumin_class.show_object(session, group)
- frame = frame.show_job_group_release(session)
- ids = [group.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.job_group_release.show(session)
+ frame.ids.set(session, [group.id])
return frame
class Remove(CuminAction):
def show(self, session, group):
- frame = self.cumin_class.show_object(session, group)
- frame = frame.show_job_group_remove(session)
- ids = [group.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.job_group_remove.show(session)
+ frame.ids.set(session, [group.id])
return frame
class CuminJob(RemoteClass):
@@ -1867,7 +1944,7 @@
prop.title = "Command"
prop = CuminProperty(self, "ConcurrencyLimits")
- prop.title = "Concurrency Limits"
+ prop.title = "Limits"
prop = CuminProperty(self, "CustomId")
prop.title = "Custom ID"
@@ -1921,65 +1998,38 @@
action = self.Fetch(self, "fetch")
action.navigable = False
+ def init(self):
+ self.frame = self.model.frame.pool.job
+
def get_title(self, session):
return "Job"
def get_object_name(self, job):
return job.CustomId
- def show_object(self, session, job):
- frame = self.get_pool_frame(session)
- return frame.show_job(session, job)
-
- def get_pool_frame(self, session):
- frame = self.cumin_model.show_main(session)
- return frame.children_by_name["pool"]
-
class JobStatusProperty(AdProperty):
def render_status(self, session, status):
return JobStatusInfo.get_status_string(status)
class GroupProperty(CuminProperty):
def value(self, session, job):
- branch = session.branch()
- frame = self.cumin_class.get_pool_frame(branch)
- try:
- group = JobGroup(job.CustomGroup)
- frame.show_job_group(branch, group)
- return fmt_olink(branch, group, name=group.get_id(), pre=12, post=3)
- except Exception, e:
- return "Unavailable"
+ group = JobGroup(job.CustomGroup)
+ href = self.model.frame.pool.job_group.get_href(session, group)
+ content = fmt_shorten(group.id, 12, 3)
+ return fmt_link(href, group.get_id())
-
class SubmitterProperty(CuminProperty):
def value(self, session, job):
- branch = session.branch()
- frame = self.cumin_class.get_pool_frame(branch)
- try:
- submitter = job.submitter
- frame.show_submitter(branch, submitter)
- except:
- submitter = job
- submitter.Name = "Unavailable"
- frame.show_job(branch, job)
-
- return fmt_olink(branch, submitter, name=submitter.Name)
+ sub = job.submitter
+ href = self.model.frame.pool.submitter.get_href(session, sub)
+ return fmt_link(href, sub.Name)
-
class SchedulerProperty(CuminProperty):
def value(self, session, job):
- branch = session.branch()
- frame = self.cumin_class.get_pool_frame(branch)
- try:
- scheduler = job.scheduler
- frame.show_scheduler(branch, scheduler)
- except:
- scheduler = job
- scheduler.Name = "Unavailable"
- frame.show_job(branch, job)
-
- return fmt_olink(branch, scheduler, name=scheduler.Name)
-
+ sched = job.scheduler
+ href = self.model.frame.pool.scheduler.get_href(session, sched)
+ return fmt_link(href, sched.Name)
+
class GetAd(CuminAction):
def do_invoke(self, job):
self.job_ads = {"":{"VALUE": "", "TYPE": 0}}
@@ -1993,7 +2043,7 @@
return self.got_data
try:
- job.GetAd(self.cumin_model.data, completion, self.job_ads)
+ job.GetAd(self.model.data, completion, self.job_ads)
except:
return self.job_ads
@@ -2027,7 +2077,7 @@
try:
data = dict()
- job.Fetch(self.cumin_model.data, completion, file, start, end, data)
+ job.Fetch(self.model.data, completion, file, start, end, data)
# wait for up to 20 seconds for completion to be called
wait(predicate, timeout=20)
if not self.got_data:
@@ -2042,17 +2092,15 @@
class Hold(CuminAction):
def show(self, session, job):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_jobs_hold(session)
- ids = [job.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.jobs_hold.show(session)
+ frame.ids.set(session, [job.id])
return frame
def get_title(self, session):
return "Hold"
def do_invoke(self, job, reason, completion):
- job.Hold(self.cumin_model.data, completion, reason)
+ job.Hold(self.model.data, completion, reason)
def get_enabled(self, session, job):
is_held = JobStatusInfo.get_status_int("Held") == job.JobStatus
@@ -2061,17 +2109,15 @@
class Release(CuminAction):
def show(self, session, job):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_jobs_release(session)
- ids = [job.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.jobs_release.show(session)
+ frame.ids.set(session, [job.id])
return frame
def get_title(self, session):
return "Release"
def do_invoke(self, job, reason, completion):
- job.Release(self.cumin_model.data, completion, reason)
+ job.Release(self.model.data, completion, reason)
def get_enabled(self, session, job):
is_held = JobStatusInfo.get_status_int("Held") == job.JobStatus
@@ -2080,17 +2126,15 @@
class Remove(CuminAction):
def show(self, session, job):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_jobs_remove(session)
- ids = [job.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.jobs_remove.show(session)
+ frame.ids.set(session, [job.id])
return frame
def get_title(self, session):
return "Remove"
def do_invoke(self, job, reason, completion):
- job.Remove(self.cumin_model.data, completion, reason)
+ job.Remove(self.model.data, completion, reason)
def get_enabled(self, session, job):
is_deleted = job.deletionTime is not None
@@ -2106,7 +2150,7 @@
def do_invoke(self, job, args, completion):
Name = args[0]
Value = args[1]
- job.SetAttribute(self.cumin_model.data, completion, Name, str(Value))
+ job.SetAttribute(self.model.data, completion, Name, str(Value))
class CuminScheduler(RemoteClass):
def __init__(self, model):
@@ -2155,6 +2199,9 @@
action = self.Stop(self, "stop")
action.summary = True
+
+ def init(self):
+ self.frame = self.model.frame.pool.scheduler
def get_title(self, session):
return "Scheduler"
@@ -2162,20 +2209,10 @@
def get_object_name(self, sched):
return sched.Name
- def get_pool_frame(self, session):
- frame = self.cumin_model.show_main(session)
- return frame.children_by_name["pool"]
-
- def show_object(self, session, sched):
- frame = self.get_pool_frame(session)
- return frame.show_scheduler(session, sched).show_view(session)
-
class Start(CuminAction):
def show(self, session, sched):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_scheds_start(session)
- ids = [sched.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.show_scheds_start(session)
+ frame.ids.set(session, [sched.id])
return frame
def get_title(self, session):
@@ -2187,10 +2224,8 @@
class Stop(CuminAction):
def show(self, session, sched):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_scheds_stop(session)
- ids = [sched.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.show_scheds_stop(session)
+ frame.ids.set(session, [sched.id])
return frame
def get_title(self, session):
@@ -2217,6 +2252,9 @@
stat = CuminStat(self, "HeldJobs")
stat.title = "Held Jobs"
+ def init(self):
+ self.frame = self.model.frame.pool.submitter
+
def get_title(self, session):
return "Submitter"
@@ -2224,16 +2262,14 @@
return sub.Name
def show_object(self, session, sub):
- # XXX temporary solution
- for pool in Pool.selectBy(name="main"):
- break
+ pool = self.model.get_main_pool()
- frame = self.cumin_model.show_main(session)
- frame = frame.show_pool(session, pool)
- frame = frame.show_submitter(session, sub).show_view(session)
+ assert pool
- return frame
+ self.model.frame.pool.set_object(session, pool)
+ return self.frame.show_object(session, sub)
+
class CuminCollector(RemoteClass):
def __init__(self, model):
super(CuminCollector, self).__init__(model, "collector",
@@ -2251,13 +2287,8 @@
action = self.Stop(self, "stop")
action.summary = True
- def get_pool_frame(self, session):
- frame = self.cumin_model.show_main(session)
- return frame.children_by_name["pool"]
-
- def show_object(self, session, coll):
- frame = self.get_pool_frame(session)
- return frame.show_collector(session, coll).show_view(session)
+ def init(self):
+ self.frame = self.model.frame.pool.collector
def get_title(self, session):
return "Collector"
@@ -2267,8 +2298,7 @@
class Start(CuminAction):
def show(self, session, collector):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_colls_start(session)
+ frame = self.model.frame.pool.show_colls_start(session)
ids = [collector.id]
frame.ids.set(session, ids)
return frame
@@ -2282,8 +2312,7 @@
class Stop(CuminAction):
def show(self, session, collector):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_colls_stop(session)
+ frame = self.model.frame.pool.show_colls_stop(session)
ids = [collector.id]
frame.ids.set(session, ids)
return frame
@@ -2348,26 +2377,19 @@
action = self.GetLimitCount(self, "GetLimitCount")
action.navigable = False
+ def init(self):
+ self.frame = self.model.frame.pool.negotiator
+
def get_title(self, session):
return "Negotiator"
def get_object_name(self, neg):
return neg.Name
- def get_pool_frame(self, session):
- frame = self.cumin_model.show_main(session)
- return frame.children_by_name["pool"]
-
- def show_object(self, session, neg):
- frame = self.get_pool_frame(session)
- return frame.show_negotiator(session, neg).show_view(session)
-
class Start(CuminAction):
def show(self, session, neg):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_negs_start(session)
- ids = [neg.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.show_negs_start(session)
+ frame.ids.set(session, [neg.id])
return frame
def get_title(self, session):
@@ -2379,10 +2401,8 @@
class Stop(CuminAction):
def show(self, session, neg):
- frame = self.cumin_class.get_pool_frame(session)
- frame = frame.show_negs_stop(session)
- ids = [neg.id]
- frame.ids.set(session, ids)
+ frame = self.model.frame.pool.show_negs_stop(session)
+ frame.ids.set(session, [neg.id])
return frame
def get_title(self, session):
@@ -2394,7 +2414,7 @@
class GetLimitCount(CuminAction):
def do_invoke(self, negotiator):
- action = self.cumin_model.negotiator.GetLimits
+ action = self.model.negotiator.GetLimits
limits = action.do_invoke(negotiator)
return "<count value=\"%i\" />" % len(limits)
@@ -2411,7 +2431,7 @@
return self.got_data
try:
- negotiator.GetLimits(self.cumin_model.data, completion, self.lim)
+ negotiator.GetLimits(self.model.data, completion, self.lim)
except:
return self.lim
@@ -2496,4 +2516,3 @@
writer.write("<data>")
writer.write(data)
writer.write("</data>")
-
Modified: mgmt/trunk/cumin/python/cumin/negotiator.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/negotiator.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -30,6 +30,9 @@
col = self.StartedColumn(app, "started")
self.add_column(col)
+ col = self.SystemColumn(app, "system")
+ self.add_column(col)
+
self.__start = self.StartButton(app, "start")
self.add_child(self.__start)
@@ -44,11 +47,13 @@
return "Name"
def render_content(self, session, data):
- sub = Identifiable(data["id"])
branch = session.branch()
- self.frame.show_negotiator(branch, sub).show_view(branch)
- return fmt_olink(branch, sub, name=data["name"])
+ neg = Identifiable(data["id"])
+ self.app.model.negotiator.show_object(branch, neg)
+
+ return fmt_olink(branch, neg, name=data["name"])
+
class StartedColumn(SqlTableColumn):
def render_title(self, session, data):
return "Started"
@@ -61,6 +66,15 @@
else:
return "No"
+ class SystemColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "System"
+
+ def render_content(self, session, data):
+ sys = Identifiable(data["system_id"])
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
@@ -87,16 +101,16 @@
def render_content(self, session):
return "Stop"
-class NegotiatorFrame(CuminFrame, JobSetFrame):
+class NegotiatorFrame(CuminFrame):
def __init__(self, app, name):
super(NegotiatorFrame, self).__init__(app, name)
self.object = NegotiatorParameter(app, "id")
self.add_parameter(self.object)
- view = NegotiatorView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = NegotiatorView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
class NegotiatorView(CuminView):
def __init__(self, app, name):
Modified: mgmt/trunk/cumin/python/cumin/negotiator.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/negotiator.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -4,13 +4,20 @@
n.name,
n.daemon_start_time as started,
c.monitor_self_age as age,
- c.rec_time
+ c.rec_time,
+ y.id as system_id,
+ y.node_name as system_name
from negotiator as n
left outer join negotiator_stats as c on c.id = n.stats_curr_id
left outer join negotiator_stats as p on p.id = n.stats_prev_id
+inner join system as y on n.system = y.node_name
+{sql_where}
+{sql_orderby}
+{sql_limit}
[NegotiatorSet.count_sql]
-select count(1) from negotiator
+select count(*) from negotiator as n
+{sql_where}
[NegotiatorView.javascript]
function updateNegotiator(data) {
Modified: mgmt/trunk/cumin/python/cumin/page.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/page.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -25,18 +25,13 @@
def __init__(self, app, name):
super(MainPage, self).__init__(app, name)
- self.__main = MainFrame(app, "main")
- self.add_mode(self.__main)
- self.set_default_frame(self.__main)
+ self.main = MainFrame(app, "main")
+ self.add_mode(self.main)
+ self.set_default_frame(self.main)
- def show_main(self, session):
- frame = self.show_mode(session, self.__main)
- return self.set_current_frame(session, frame)
-
def render_title(self, session):
return "MRG Management"
-# XXX merge this into the above
class MainFrame(CuminFrame):
def __init__(self, app, name):
super(MainFrame, self).__init__(app, name)
@@ -46,43 +41,37 @@
self.__tabs = MainFrameTabs(app, "tabs")
self.add_child(self.__tabs)
- view = MainView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = MainView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- self.__password = ChangePasswordForm(app, "password")
- self.add_mode(self.__password)
+ self.broker = BrokerFrame(app, "broker")
+ self.add_mode(self.broker)
- self.__broker = BrokerFrame(app, "broker")
- self.add_mode(self.__broker)
+ self.broker_group = BrokerGroupFrame(app, "group")
+ self.add_mode(self.broker_group)
- self.__brokers_add = BrokerSetAdd(app, "brokersadd")
- self.add_mode(self.__brokers_add)
+ self.system = SystemFrame(app, "system")
+ self.add_mode(self.system)
- self.__brokers_remove = BrokerSetRemove(app, "brokersremove")
- self.add_mode(self.__brokers_remove)
+ self.pool = PoolFrame(app, "pool")
+ self.add_mode(self.pool)
- self.__group = BrokerGroupFrame(app, "group")
- self.add_mode(self.__group)
+ self.change_password = ChangePasswordForm(app, "password")
+ self.add_mode(self.change_password)
+ self.brokers_add = BrokerSetAdd(app, "brokersadd")
+ self.add_mode(self.brokers_add)
+
+ self.brokers_remove = BrokerSetRemove(app, "brokersremove")
+ self.add_mode(self.brokers_remove)
+
action = self.app.model.broker_group.remove_set
item = BrokerGroupParameter(app, "item")
- self.__groups_remove = CuminSetActionForm \
+ self.broker_groups_remove = CuminSetActionForm \
(app, "groupsremove", action, item)
- self.add_mode(self.__groups_remove)
+ self.add_mode(self.broker_groups_remove)
- self.__profile = BrokerProfileFrame(app, "profile")
- self.add_mode(self.__profile)
-
- self.__cluster = BrokerClusterFrame(app, "cluster")
- self.add_mode(self.__cluster)
-
- self.__pool = PoolFrame(app, "pool")
- self.add_mode(self.__pool)
-
- self.__system = SystemFrame(app, "system")
- self.add_mode(self.__system)
-
def render_title(self, session):
return "Main"
@@ -127,58 +116,6 @@
ccount = self.app.model.count_invocations("OK")
return len(self.app.model.invocations) - pcount - ccount
- def show_change_password(self, session):
- frame = self.show_mode(session, self.__password)
- return self.page.set_current_frame(session, frame)
-
- def show_broker(self, session, reg):
- assert isinstance(reg, BrokerRegistration)
- frame = self.show_mode(session, self.__broker)
- frame.set_object(session, reg)
- return self.page.set_current_frame(session, frame)
-
- def show_brokers_add(self, session):
- frame = self.show_mode(session, self.__brokers_add)
- return self.page.set_current_frame(session, frame)
-
- def show_brokers_remove(self, session):
- frame = self.show_mode(session, self.__brokers_remove)
- return self.page.set_current_frame(session, frame)
-
- def show_broker_group(self, session, group):
- frame = self.show_mode(session, self.__group)
- frame.set_object(session, group)
- return self.page.set_current_frame(session, frame)
-
- def show_broker_groups_remove(self, session, groups):
- frame = self.show_mode(session, self.__groups_remove)
- frame.objects.set(session, groups)
- return self.page.set_current_frame(session, frame)
-
- def show_broker_profile(self, session, profile):
- frame = self.show_mode(session, self.__profile)
- frame.set_object(session, profile)
- return self.page.set_current_frame(session, frame)
-
- def show_broker_cluster(self, session, cluster):
- frame = self.show_mode(session, self.__cluster)
- frame.set_object(session, cluster)
- return self.page.set_current_frame(session, frame)
-
- def show_pool(self, session, pool):
- frame = self.show_mode(session, self.__pool)
- frame.set_object(session, pool)
- return self.page.set_current_frame(session, frame)
-
- def show_system(self, session, system):
- frame = self.show_mode(session, self.__system)
- frame.set_object(session, system)
- return self.page.set_current_frame(session, frame)
-
- def set_pool_mode(self, session):
- frame = self.show_mode(session, self.__pool)
- return self.page.set_current_frame(session, frame)
-
def show_grid_tab(self, session):
self.__tabs.set_grid_tab(session)
@@ -218,8 +155,7 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page.show_main(session).show_view(session)
- frame.show_home(session)
+ self.page.main.view.home.show(session)
class MessagingTab(Tab):
def render_content(self, session):
@@ -227,8 +163,7 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page.show_main(session).show_view(session)
- frame.show_messaging(session)
+ self.page.main.view.messaging.show(session)
class GridTab(Tab):
def render_content(self, session):
@@ -236,46 +171,37 @@
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page.show_main(session).show_view(session)
- frame.show_grid(session)
+ self.page.main.view.grid.show(session)
+ pool = self.app.model.get_main_pool()
+
+ if pool:
+ self.page.main.pool.show_object(session, pool)
+
class SystemsTab(Tab):
def render_content(self, session):
return "Systems"
def edit_session(self, session):
self.parent.selection.set(session, self.name)
- frame = self.page.show_main(session).show_view(session)
- frame.show_systems(session)
+ self.page.main.view.systems.show(session)
class MainView(ModeSet):
def __init__(self, app, name):
super(MainView, self).__init__(app, name)
- self.__home = HomeView(app, "home")
- self.add_mode(self.__home)
+ self.home = HomeView(app, "home")
+ self.add_mode(self.home)
- self.__messaging = MessagingView(app, "msg")
- self.add_mode(self.__messaging)
+ self.messaging = MessagingView(app, "msg")
+ self.add_mode(self.messaging)
- self.__grid = GridView(app, "grd")
- self.add_mode(self.__grid)
+ self.grid = GridView(app, "grd")
+ self.add_mode(self.grid)
- self.__systems = SystemsView(app, "sys")
- self.add_mode(self.__systems)
+ self.systems = SystemsView(app, "sys")
+ self.add_mode(self.systems)
- def show_home(self, session):
- return self.show_mode(session, self.__home)
-
- def show_messaging(self, session):
- return self.show_mode(session, self.__messaging)
-
- def show_grid(self, session):
- return self.show_mode(session, self.__grid)
-
- def show_systems(self, session):
- return self.show_mode(session, self.__systems)
-
class HomeView(TabbedModeSet):
def __init__(self, app, name):
super(HomeView, self).__init__(app, name)
@@ -285,7 +211,7 @@
def render_change_password_href(self, session):
branch = session.branch()
- self.frame.show_change_password(branch)
+ self.frame.change_password.show(branch)
return branch.marshal()
class Heading(CuminHeading):
Modified: mgmt/trunk/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/parameters.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/parameters.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -1,3 +1,4 @@
+import model
from wooly import *
from mint import *
@@ -118,17 +119,12 @@
return str(peer.id)
class PoolParameter(Parameter):
- def get_default(self, session):
- try:
- coll = CollectorRegistration.selectBy(name="main")[0]
- except IndexError:
- raise Exception("Main pool not found")
-
- return coll
-
def do_unmarshal(self, string):
- return CollectorRegistration.get(int(string))
+ for coll in Collector.selectBy(Pool=string):
+ break
+ return model.Pool(coll)
+
def do_marshal(self, pool):
return str(pool.id)
Modified: mgmt/trunk/cumin/python/cumin/pool.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/pool.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -45,16 +45,10 @@
def render_content(self, session, data):
pool = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_pool(branch, pool).show_view(branch)
+ href = self.frame.pool.get_href(session, pool)
- name = data["name"]
+ return fmt_link(href, data["name"])
- if name == "main":
- name = "Main Pool"
-
- return fmt_olink(branch, pool, name=name)
-
class JobsColumn(SqlTableColumn):
def render_title(self, session, data):
return "Jobs"
@@ -76,25 +70,31 @@
self.object = PoolParameter(app, "id")
self.add_parameter(self.object)
- view = PoolView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = PoolView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- self.__job = JobFrame(app, "job")
- self.add_mode(self.__job)
+ self.job = JobFrame(app, "job")
+ self.add_mode(self.job)
- self.__sched = SchedulerFrame(app, "sched")
- self.add_mode(self.__sched)
+ self.job_group = JobGroupFrame(app, "jobgroup")
+ self.add_mode(self.job_group)
+
+ self.scheduler = SchedulerFrame(app, "sched")
+ self.add_mode(self.scheduler)
- self.__sub = SubmitterFrame(app, "sub")
- self.add_mode(self.__sub)
+ self.submitter = SubmitterFrame(app, "sub")
+ self.add_mode(self.submitter)
- self.__coll = CollectorFrame(app, "coll")
- self.add_mode(self.__coll)
+ self.collector = CollectorFrame(app, "coll")
+ self.add_mode(self.collector)
- self.__neg = NegotiatorFrame(app, "neg")
- self.add_mode(self.__neg)
+ self.limit = LimitsFrame(app, "limit")
+ self.add_mode(self.limit)
+ self.negotiator = NegotiatorFrame(app, "neg")
+ self.add_mode(self.negotiator)
+
self.__startneg = NegStart(app, "startneg")
self.add_mode(self.__startneg)
@@ -113,65 +113,24 @@
self.__stopsched = SchedulerStop(app, "stopsched")
self.add_mode(self.__stopsched)
- self.__jobs_hold = JobSetHold(app, "jobshold")
- self.add_mode(self.__jobs_hold)
+ self.jobs_hold = JobSetHold(app, "jobshold")
+ self.add_mode(self.jobs_hold)
- self.__jobs_release = JobSetRelease(app, "jobsrelease")
- self.add_mode(self.__jobs_release)
+ self.jobs_release = JobSetRelease(app, "jobsrelease")
+ self.add_mode(self.jobs_release)
- self.__jobs_remove = JobSetRemove(app, "jobsremove")
- self.add_mode(self.__jobs_remove)
+ self.jobs_remove = JobSetRemove(app, "jobsremove")
+ self.add_mode(self.jobs_remove)
- self.__job_group = JobGroupFrame(app, "jobgroup")
- self.add_mode(self.__job_group)
+ self.job_group_hold = JobGroupHold(app, "jobgrouphold")
+ self.add_mode(self.job_group_hold)
- self.__limit = LimitsFrame(app, "limit")
- self.add_mode(self.__limit)
-
- self.__job_group_hold = JobGroupHold(app, "jobgrouphold")
- self.add_mode(self.__job_group_hold)
+ self.job_group_release = JobGroupRelease(app, "jobgrouprelease")
+ self.add_mode(self.job_group_release)
- self.__job_group_release = JobGroupRelease(app, "jobgrouprelease")
- self.add_mode(self.__job_group_release)
+ self.job_group_remove = JobGroupRemove(app, "jobgroupremove")
+ self.add_mode(self.job_group_remove)
- self.__job_group_remove = JobGroupRemove(app, "jobgroupremove")
- self.add_mode(self.__job_group_remove)
-
- def show_job(self, session, job):
- self.__job.set_object(session, job)
- self.page.set_current_frame(session, self.__job)
- return self.show_mode(session, self.__job)
-
- def show_job_group(self, session, job_group):
- self.__job_group.set_object(session, job_group)
- self.page.set_current_frame(session, self.__job_group)
- return self.show_mode(session, self.__job_group)
-
- def show_limit(self, session, limit):
- self.__limit.set_object(session, limit)
- self.page.set_current_frame(session, self.__limit)
- return self.show_mode(session, self.__limit)
-
- def show_scheduler(self, session, sched):
- self.__sched.set_object(session, sched)
- self.page.set_current_frame(session, self.__sched)
- return self.show_mode(session, self.__sched)
-
- def show_submitter(self, session, sub):
- self.__sub.set_object(session, sub)
- self.page.set_current_frame(session, self.__sub)
- return self.show_mode(session, self.__sub)
-
- def show_collector(self, session, sub):
- self.__coll.set_object(session, sub)
- self.page.set_current_frame(session, self.__coll)
- return self.show_mode(session, self.__coll)
-
- def show_negotiator(self, session, sub):
- self.__neg.set_object(session, sub)
- self.page.set_current_frame(session, self.__neg)
- return self.show_mode(session, self.__neg)
-
def show_negs_start(self, session):
self.page.set_current_frame(session, self.__startneg)
return self.show_mode(session, self.__startneg)
@@ -196,30 +155,6 @@
self.page.set_current_frame(session, self.__stopcoll)
return self.show_mode(session, self.__stopcoll)
- def show_jobs_hold(self, session):
- self.page.set_current_frame(session, self.__jobs_hold)
- return self.show_mode(session, self.__jobs_hold)
-
- def show_jobs_release(self, session):
- self.page.set_current_frame(session, self.__jobs_release)
- return self.show_mode(session, self.__jobs_release)
-
- def show_jobs_remove(self, session):
- self.page.set_current_frame(session, self.__jobs_remove)
- return self.show_mode(session, self.__jobs_remove)
-
- def show_job_group_hold(self, session):
- self.page.set_current_frame(session, self.__job_group_hold)
- return self.show_mode(session, self.__job_group_hold)
-
- def show_job_group_release(self, session):
- self.page.set_current_frame(session, self.__job_group_release)
- return self.show_mode(session, self.__job_group_release)
-
- def show_job_group_remove(self, session):
- self.page.set_current_frame(session, self.__job_group_remove)
- return self.show_mode(session, self.__job_group_remove)
-
class PoolView(CuminView):
def __init__(self, app, name):
super(PoolView, self).__init__(app, name)
@@ -236,36 +171,80 @@
jobs = JobsAndGroupsTab(app, "jobs")
self.__tabs.add_tab(jobs)
- scheds = self.SchedulersTab(app, "scheds")
+ scheds = PoolSchedulerSet(app, "scheds")
self.__tabs.add_tab(scheds)
- subs = self.SubmittersTab(app, "subs")
+ subs = PoolSubmitterSet(app, "subs")
self.__tabs.add_tab(subs)
- colls = self.CollectorsTab(app, "colls")
+ colls = PoolCollectorSet(app, "colls")
self.__tabs.add_tab(colls)
- neg = self.NegotiatorsTab(app, "neg")
- self.__tabs.add_tab(neg)
+ negs = PoolNegotiatorSet(app, "negs")
+ self.__tabs.add_tab(negs)
limits = self.LimitsTab(app, "limits")
self.__tabs.add_tab(limits)
- class SchedulersTab(SchedulerSet):
+ class LimitsTab(LimitsSet):
pass
- class SubmittersTab(SubmitterSet):
- pass
+class PoolSchedulerSet(SchedulerSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
- class CollectorsTab(CollectorSet):
- pass
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
- class NegotiatorsTab(NegotiatorSet):
- pass
+ def render_title(self, session, pool):
+ count = self.get_item_count(session, pool)
+ return "Schedulers %s" % fmt_count(count)
- class LimitsTab(LimitsSet):
- pass
+ def render_sql_where(self, session, pool):
+ return "where s.pool = %(pool)s"
+
+class PoolSubmitterSet(SubmitterSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
+
+ def render_title(self, session, pool):
+ count = self.get_item_count(session, pool)
+ return "Submitters %s" % fmt_count(count)
+
+ def render_sql_where(self, session, pool):
+ return "where d.pool = %(pool)s"
+class PoolCollectorSet(CollectorSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
+
+ def render_title(self, session, pool):
+ count = self.get_item_count(session, pool)
+ return "Collectors %s" % fmt_count(count)
+
+ def render_sql_where(self, session, pool):
+ return "where c.pool = %(pool)s"
+
+class PoolNegotiatorSet(NegotiatorSet):
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def get_sql_values(self, session, pool):
+ return {"pool": pool.id}
+
+ def render_title(self, session, pool):
+ count = self.get_item_count(session, pool)
+ return "Negotiators %s" % fmt_count(count)
+
+ def render_sql_where(self, session, pool):
+ return "where n.pool = %(pool)s"
+
class PoolStats(Widget):
def __init__(self, app, name):
super(PoolStats, self).__init__(app, name)
@@ -323,4 +302,3 @@
class PoolStatus(CuminStatus):
def render_status(self, session, pool):
return "Active"
-
Modified: mgmt/trunk/cumin/python/cumin/pool.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/pool.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -1,12 +1,18 @@
[PoolSet.sql]
-select
- r.id,
- r.name,
- (select count(*) from job) as jobs
-from collector_registration as r
+select p.pool as id, p.name, j.jobs
+from
+ (select pool, name
+ from collector
+ group by pool, name) as p
+left outer join
+ (select s.pool, count(*) as jobs
+ from job j
+ left outer join scheduler as s on j.scheduler_id = s.id
+ group by s.pool) as j
+ on j.pool = p.pool
[PoolSet.count_sql]
-select count(*) from collector_registration
+select count(*) from collector
[PoolStatus.html]
<div id="{id}" class="CuminStatus {color}">
Modified: mgmt/trunk/cumin/python/cumin/queue.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/queue.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/queue.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -66,7 +66,7 @@
def render_add_queue_url(self, session, vhost):
branch = session.branch()
- self.frame.show_queue_add(branch)
+ self.frame.queue_add.show(branch)
return branch.marshal()
def get_args(self, session):
@@ -91,8 +91,7 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame.show_queues_purge(branch)
- frame.ids.set(branch, ids)
+ self.frame.queues_purge.show(branch).ids.set(branch, ids)
self.page.set_redirect_url(session, branch.marshal())
def render_content(self, session):
@@ -104,8 +103,7 @@
self.parent.ids.clear(session)
branch = session.branch()
- frame = self.frame.show_queues_remove(branch)
- frame.ids.set(branch, ids)
+ self.frame.queues_remove.show(branch).ids.set(branch, ids)
self.page.set_redirect_url(session, branch.marshal())
def render_content(self, session):
@@ -118,9 +116,8 @@
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"])
+ href = self.frame.queue.get_href(session, queue)
+ return fmt_link(href, fmt_shorten(data["name"]))
class ConsumersColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -128,13 +125,6 @@
def render_content(self, session, data):
return data["consumers"]
-
- # Restore later
- 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"])
class BindingsColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -142,10 +132,8 @@
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"])
+ href = self.frame.queue.get_href(session, queue)
+ return fmt_link(href, data["bindings"])
class EnqueuedColumn(NullSortColumn, FreshDataOnlyColumn):
def render_title(self, session, data):
@@ -177,14 +165,6 @@
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)
-
-def show_bindings(page, session, queue):
- frame = page.show_queue(session, queue).show_view(session)
- return frame.show_bindings(session)
-
class QueueFrame(CuminFrame):
def __init__(self, app, name):
super(QueueFrame, self).__init__(app, name)
@@ -192,30 +172,25 @@
self.object = QueueParameter(app, "id")
self.add_parameter(self.object)
- view = QueueView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = QueueView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- add = QueueAdd(app, "add")
- self.add_mode(add)
- self.set_add_mode(add)
-
self.purge = QueuePurge(app, "purge")
self.add_mode(self.purge)
- self.queue_binding_add = QueueBindingAdd(app, "queuebindingadd")
- self.add_mode(self.queue_binding_add)
+ self.binding_add = QueueBindingAdd(app, "bindingadd")
+ self.add_mode(self.binding_add)
- remove = QueueRemove(app, "remove")
- self.add_mode(remove)
- self.set_remove_mode(remove)
+ self.remove = QueueRemove(app, "remove")
+ self.add_mode(self.remove)
+ self.set_remove_mode(self.remove)
- def show_purge(self, session):
- return self.show_mode(session, self.purge)
+ def show_object(self, session, queue):
+ reg = queue.vhost.broker.registration
+ self.page.main.broker.set_object(session, reg)
- def show_queue_binding_add(self, session):
- self.page.set_current_frame(session, self.queue_binding_add)
- return self.show_mode(session, self.queue_binding_add)
+ return super(QueueFrame, self).show_object(session, queue)
def render_href(self, session, queue):
if queue:
@@ -267,14 +242,14 @@
self.__tabs.add_tab(QueueStats(app, "stats"))
- self.__bindings = QueueBindingSet(app, "bindings")
- self.__tabs.add_tab(self.__bindings)
+ self.bindings = QueueBindingSet(app, "bindings")
+ self.__tabs.add_tab(self.bindings)
- details = CuminDetails(app, "details")
- self.__tabs.add_tab(details)
+ self.details = CuminDetails(app, "details")
+ self.__tabs.add_tab(self.details)
def show_bindings(self, session):
- self.__tabs.show_mode(session, self.__bindings);
+ self.__tabs.show_mode(session, self.bindings);
def render_script(self, session, queue):
data = "model.xml?class=queue;id=%i" % queue.id
@@ -294,7 +269,7 @@
def render_add_queue_binding_url(self, session, vhost):
branch = session.branch()
- self.frame.show_queue_binding_add(branch)
+ self.frame.binding_add.show(branch)
return branch.marshal()
def render_sql_where(self, session, queue):
@@ -312,11 +287,9 @@
ids = self.parent.ids.get(session)
self.parent.ids.clear(session)
- queue = self.frame.get_args(session)[0]
- branch = session.branch()
- frame = self.frame.frame.show_queue_bindings_remove(branch, queue)
- frame.ids.set(branch, ids)
- self.page.set_redirect_url(session, branch.marshal())
+ href = self.frame.frame.bindings_remove.get_href \
+ (session, ids)
+ self.page.set_redirect_url(session, href)
def render_content(self, session):
return "Remove"
Modified: mgmt/trunk/cumin/python/cumin/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/scheduler.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -27,13 +27,28 @@
self.add_column(col)
self.set_default_column(col)
+ col = self.SystemColumn(app, "system")
+ self.add_column(col)
+
+ col = self.UsersColumn(app, "users")
+ col.alignment = "right"
+ self.add_column(col)
+
+ col = self.RunningJobsColumn(app, "running")
+ col.alignment = "right"
+ self.add_column(col)
+
+ col = self.HeldJobsColumn(app, "held")
+ col.alignment = "right"
+ self.add_column(col)
+
self.__start = self.StartButton(app, "start")
self.add_child(self.__start)
self.__stop = self.StopButton(app, "stop")
self.add_child(self.__stop)
- def render_title(self, session):
+ def render_title(self, session, *args):
return "Schedulers %s" % fmt_count(Scheduler.select().count())
class NameColumn(SqlTableColumn):
@@ -42,10 +57,30 @@
def render_content(self, session, data):
sched = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_scheduler(branch, sched).show_view(branch)
- return fmt_olink(branch, sched, name=data["name"])
+ href = self.page.main.pool.scheduler.get_href(session, sched)
+ return fmt_link(href, data["name"])
+ class UsersColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Users"
+
+ class RunningJobsColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Running Jobs"
+
+ class HeldJobsColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "Held Jobs"
+
+ class SystemColumn(SqlTableColumn):
+ def render_title(self, session, data):
+ return "System"
+
+ def render_content(self, session, data):
+ sys = Identifiable(data["system_id"])
+ href = self.page.main.system.get_href(session, sys)
+ return fmt_link(href, data["system_name"])
+
class StartButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
@@ -72,7 +107,7 @@
def render_content(self, session):
return "Stop"
-class SchedulerFrame(CuminFrame, JobSetFrame):
+class SchedulerFrame(CuminFrame):
def __init__(self, app, name):
super(SchedulerFrame, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -1,11 +1,22 @@
[SchedulerSet.sql]
select
s.id,
- s.name
+ s.name,
+ y.id as system_id,
+ y.node_name as system_name,
+ c.num_users as users,
+ c.total_running_jobs as running,
+ c.total_held_jobs as held
from scheduler as s
+left outer join scheduler_stats as c on c.id = s.stats_curr_id
+inner join system as y on s.system = y.node_name
+{sql_where}
+{sql_orderby}
+{sql_limit}
[SchedulerSet.count_sql]
-select count(*) from scheduler
+select count(*) from scheduler as s
+{sql_where}
[SchedulerView.javascript]
function updateScheduler(data) {
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -89,6 +89,7 @@
params = list()
cls = self.app.model.get_class_by_object(object).cumin_name
+
params.append("class=%s" % cls)
params.append("id=%i" % object.id)
Modified: mgmt/trunk/cumin/python/cumin/submitter.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/submitter.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -34,11 +34,10 @@
def render_content(self, session, data):
sub = Identifiable(data["id"])
- branch = session.branch()
- self.frame.show_submitter(branch, sub).show_view(branch)
- return fmt_olink(branch, sub, name=data["name"])
+ href = self.page.main.pool.submitter.get_href(session, sub)
+ return fmt_link(href, data["name"])
-class SubmitterFrame(CuminFrame, JobSetFrame):
+class SubmitterFrame(CuminFrame):
def __init__(self, app, name):
super(SubmitterFrame, self).__init__(app, name)
@@ -49,7 +48,6 @@
self.add_mode(view)
self.set_view_mode(view)
-
class SubmitterView(CuminView):
def __init__(self, app, name):
super(SubmitterView, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/submitter.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.strings 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/submitter.strings 2008-10-23 18:51:51 UTC (rev 2675)
@@ -3,9 +3,15 @@
s.id,
s.name
from submitter as s
+inner join scheduler as d on s.scheduler_id = d.id
+{sql_where}
+{sql_orderby}
+{sql_limit}
[SubmitterSet.count_sql]
-select count(*) from submitter
+select count(*) from submitter as s
+inner join scheduler as d on s.scheduler_id = d.id
+{sql_where}
[SubmitterView.javascript]
function updateSubmitter(data) {
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -30,15 +30,8 @@
def render_content(self, session, data):
system = Identifiable(data["id"])
- branch = session.branch()
- #rather than use self.frame, force getting the
- # system frame and showing the system tab. This
- # is done because we can switch to the system
- # frame from within the grid frame
- frame = self.app.model.show_main(branch)
- frame.show_system_tab(branch)
- frame.show_system(branch, system).show_view(branch)
- return fmt_olink(branch, system, name=data["name"])
+ href = self.page.main.system.get_href(session, system)
+ return fmt_link(href, fmt_shorten(data["name"]))
class SystemFrame(CuminFrame):
def __init__(self, app, name):
@@ -47,18 +40,10 @@
self.object = SystemParameter(app, "id")
self.add_parameter(self.object)
- view = SystemView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = SystemView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- def show_job(self, session, ident):
- frame = self.app.model.show_main(session)
- frame.show_grid_tab(session)
- frame.show_view(session).show_grid(session)
- frame = frame.set_pool_mode(session)
- job = Job.get(ident.id)
- return frame.show_job(session, job)
-
class SystemStatus(CuminStatus):
pass
Modified: mgmt/trunk/cumin/python/cumin/test.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/test.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/test.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -259,18 +259,21 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_broker_link_add(s)
-
+ p.main.broker.set_object(s, self.env.broker_registration)
+
+ form = p.main.broker.link_add
+ form.show(s)
+
host = dict()
host["name"] = "localhost"
host["port"] = "9991"
host["password"] = ""
host["username"] = ""
form.host.set(s, host)
+
form.durable.set(s, "transient")
+ form.submit(s)
- form.submit(s)
p.process(s)
self.env.check_redirect(p, s)
@@ -294,13 +297,13 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_broker_links_close(s)
+ p.main.broker.set_object(s, self.env.broker_registration)
- ids = [self.env.link.id]
- form.ids.set(s, ids)
-
+ form = p.main.broker.links_close
+ form.show(s)
+ form.ids.set(s, [self.env.link.id])
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
@@ -310,10 +313,6 @@
wait(predicate)
- # if it timed out, raise an exception
- if not self.env.link.deletionTime:
- raise Exception("Link not removed")
-
class RouteTest(Test):
def __init__(self, env, parent):
super(RouteTest, self).__init__(env, parent)
@@ -328,9 +327,12 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_peer(s, self.env.link).show_bridge_add(s)
-
+ p.main.broker.set_object(s, self.env.broker_registration)
+ p.main.broker.link.set_object(s, self.env.link)
+
+ form = p.main.broker.link.bridge_add
+ form.show(s)
+
vhost = self.env.vhost
exchange = Exchange.selectBy(vhost=vhost, name=self.env.broker_exchange.name)[0]
form.exchange.set(s, str(exchange.id))
@@ -340,6 +342,7 @@
form.excludes.set(s, "cumin.tag")
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
@@ -359,13 +362,14 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_peer(s, self.env.link).show_routes_close(s)
+ p.main.broker.set_object(s, self.env.broker_registration)
+ p.main.broker.link.set_object(s, self.evn.link)
- ids = [self.env.bridge.id]
- form.ids.set(s, ids)
-
+ form = p.main.broker.link.routes_close
+ form.show(s)
+ form.ids.set(s, [self.env.bridge.id])
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
@@ -390,7 +394,8 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- form = p.show_main(s).show_brokers_add(s)
+ form = p.main.brokers_add
+ form.show(s)
form.names.get(s).append(session.id)
addr = "%s:%s" % \
@@ -424,7 +429,9 @@
p, s = self.env.page_and_session()
- form = p.show_main(s).show_broker(s, reg).show_remove(s)
+ form = p.main.brokers_remove
+ form.show(s)
+ form.ids.set(s, [reg.id])
form.submit(s)
p.process(s)
@@ -447,7 +454,8 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- form = p.show_main(s).show_broker_group(s, None).show_add(s)
+ form = p.main.broker_group.add
+ form.show(s)
form.group_name.set(s, session.id)
form.submit(s)
@@ -465,9 +473,11 @@
class Edit(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
- group = self.env.broker_group
- form = p.show_main(s).show_broker_group(s, group).show_edit(s)
+ p.main.broker_group.set_object(s, self.env.broker_group)
+
+ form = p.main.broker_group.edit
+ form.show(s)
form.group_name.set(s, session.id + "%;&#\\")
form.submit(s)
@@ -478,9 +488,11 @@
class Remove(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
- group = self.env.broker_group
- form = p.show_main(s).show_broker_group(s, group).show_remove(s)
+ p.main.broker_group.set_object(s, self.env.broker_group)
+
+ form = p.main.broker_group.remove
+ form.show(s)
form.submit(s)
p.process(s)
@@ -534,51 +546,76 @@
self.BindTopic(env, self)
self.BindFanout(env, self)
self.BindHeaders(env, self)
- self.RemoveBindDirect(env, self)
def do_run(self, session):
self.run_children(session)
class BindDirect(Test):
+ def __init__(self, env, parent):
+ super(BindQueueTest.BindDirect, self).__init__(env, parent)
+
+ self.RemoveBindDirect(env, self)
+
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg)
- form = form.show_queue(s, self.env.queue)
- form = form.show_queue_binding_add(s)
+ p.main.broker.set_object(s, self.env.broker.registration)
+ p.main.broker.queue.set_object(s, self.env.queue)
+
+ form = p.main.broker.queue.binding_add
+ form.show(s)
+
binding = dict()
binding["test"] = {}
direct = binding["test"]
direct["name"] = "amq.direct"
direct["type"] = "direct"
+
form.bindings.dict_param.set(s, binding)
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
def predicate():
for item in Binding.selectBy(queue=self.env.queue, bindingKey=self.env.queue.name):
+ self.env.binding_direct = item
return True
wait(predicate)
- # if it timed out, raise an exception
- try:
- self.env.binding_direct = Binding.selectBy(queue=self.env.queue, bindingKey=self.env.queue.name)[0]
- except IndexError:
- raise Exception("Direct Binding not added")
+ class RemoveBindDirect(Test):
+ def do_run(self, session):
+ p, s = self.env.page_and_session()
+ p.main.broker.set_object(s, self.env.broker_registration)
+
+ form = p.main.broker.bindings_remove.show(s)
+ form.ids.set([self.env.binding_direct.id])
+ form.submit(s)
+
+ p.process(s)
+
+ self.env.check_redirect(p, s)
+
+ def predicate():
+ return self.env.binding_direct.deletionTime
+
+ wait(predicate)
+
+ # if it timed out, raise an exception
+ if not self.env.binding_direct.deletionTime:
+ raise Exception("Direct Binding not removed")
+
class BindTopic(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg)
- form = form.show_queue(s, self.env.queue)
- form = form.show_queue_binding_add(s)
+ frame = p.main.broker.queue.show_object(s, self.env.queue)
+
+ form = frame.binding_add
binding = dict()
binding["test"] = {}
direct = binding["test"]
@@ -598,20 +635,15 @@
wait(predicate)
- # if it timed out, raise an exception
- try:
- Binding.selectBy(queue=self.env.queue, bindingKey="topic.key")[0]
- except IndexError:
- raise Exception("Topic Binding not added")
-
class BindFanout(Test):
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg)
- form = form.show_queue(s, self.env.queue)
- form = form.show_queue_binding_add(s)
+ frame = p.main.broker.queue.show_object(s, self.env.queue)
+
+ form = frame.binding_add
+ form.show(s)
+
binding = dict()
binding["test"] = {}
direct = binding["test"]
@@ -641,10 +673,11 @@
def do_run(self, session):
p, s = self.env.page_and_session()
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg)
- form = form.show_queue(s, self.env.queue)
- form = form.show_queue_binding_add(s)
+ frame = p.main.broker.queue.show_object(s, self.env.queue)
+
+ form = frame.binding_add
+ form.show(s)
+
binding = dict()
binding["test"] = {}
direct = binding["test"]
@@ -673,31 +706,6 @@
except IndexError:
raise Exception("Headers Binding not added")
- class RemoveBindDirect(Test):
- def do_run(self, session):
- p, s = self.env.page_and_session()
-
- reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg)
- form = form.show_queue_bindings_remove(s, self.env.queue)
-
- ids = [self.env.binding_direct.id]
- form.ids.set(s, ids)
-
- form.submit(s)
- p.process(s)
-
- self.env.check_redirect(p, s)
-
- def predicate():
- return self.env.binding_direct.deletionTime
-
- wait(predicate)
-
- # if it timed out, raise an exception
- if not self.env.binding_direct.deletionTime:
- raise Exception("Direct Binding not removed")
-
class AddQueueTest(Test):
def __init__(self, env, parent):
super(AddQueueTest, self).__init__(env, parent)
@@ -709,12 +717,15 @@
p, s = self.env.page_and_session()
reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_queue_add(s)
+ p.main.broker.set_object(s, reg)
+
+ form = p.main.broker.queue_add
+ form.show(s)
form.namef.set(s, name)
form.durable.set(s, "durable")
form.autodelete.set(s, "preserve")
+ form.submit(s)
- form.submit(s)
p.process(s)
self.env.check_redirect(p, s)
@@ -766,12 +777,13 @@
p, s = self.env.page_and_session()
reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_queues_remove(s)
+ p.main.broker.set_object(s, reg)
- ids = [self.env.queue.id]
- form.ids.set(s, ids)
-
+ form = p.main.broker.queues_remove
+ form.show(s)
+ form.ids.set(s, [self.env.queue.id])
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
@@ -782,10 +794,6 @@
wait(predicate)
- # if it timed out, raise an exception
- if not self.env.queue.deletionTime:
- raise Exception("Queue not removed")
-
class ExchangeTest(Test):
def __init__(self, env, parent):
super(ExchangeTest, self).__init__(env, parent)
@@ -810,7 +818,10 @@
p, s = self.env.page_and_session()
reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_exchange_add(s)
+ p.main.broker.set_object(s, reg)
+
+ form = p.main.broker.exchange_add
+ form.show(s)
form.exchange_name.set(s, name)
form.type.set(s, "topic")
form.submit(s)
@@ -827,7 +838,6 @@
wait(predicate)
- # if it timed out, raise an exception
try:
self.env.added_exchange = Exchange.selectBy(vhost=vhost, name=name)[0]
except IndexError:
@@ -839,12 +849,13 @@
p, s = self.env.page_and_session()
reg = self.env.broker_registration
- form = p.show_main(s).show_broker(s, reg).show_exchanges_remove(s)
+ p.main.broker.set_object(s, reg)
- ids = [self.env.added_exchange.id]
- form.ids.set(s, ids)
-
+ form = p.main.broker.exchanges_remove
+ form.show(s)
+ form.ids.set(s, [self.env.added_exchange.id])
form.submit(s)
+
p.process(s)
self.env.check_redirect(p, s)
@@ -856,9 +867,6 @@
return self.env.added_exchange.deletionTime
wait(predicate)
- # if it timed out, raise an exception
- if not self.env.added_exchange.deletionTime:
- raise Exception("Exchange %s not removed" % name)
class ConnectionTest(Test):
def do_run(self, session):
Modified: mgmt/trunk/cumin/python/cumin/virtualhost.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/virtualhost.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/virtualhost.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -31,31 +31,19 @@
self.object = VirtualHostParameter(app, "id")
self.add_parameter(self.object)
- view = VirtualHostView(app, "view")
- self.add_mode(view)
- self.set_view_mode(view)
+ self.view = VirtualHostView(app, "view")
+ self.add_mode(self.view)
+ self.set_view_mode(self.view)
- self.__queue = QueueFrame(app, "queue")
- self.add_mode(self.__queue)
+ self.queue = QueueFrame(app, "queue")
+ self.add_mode(self.queue)
self.__exchange = ExchangeFrame(app, "exchange")
- self.add_mode(self.__exchange)
+ self.add_mode(self.exchange)
- self.__conn = ConnectionFrame(app, "conn")
- self.add_mode(self.__conn)
+ self.conn = ConnectionFrame(app, "conn")
+ self.add_mode(self.conn)
- def show_queue(self, session, queue):
- self.__queue.set_object(session, queue)
- return self.show_mode(session, self.__queue)
-
- def show_exchange(self, session, exchange):
- self.__exchange.set_object(session, exchange)
- return self.show_mode(session, self.__exchange)
-
- def show_connection(self, session, conn):
- self.__conn.set_object(session, conn)
- return self.show_mode(session, self.__conn)
-
class VirtualHostView(CuminView):
def __init__(self, app, name):
super(VirtualHostView, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -53,6 +53,10 @@
self.__edit = None
self.__remove = None
+ def show_object(self, session, object):
+ self.object.set(session, object)
+ return self.show(session)
+
def get_args(self, session):
if self.object:
return (self.get_object(session),)
@@ -66,6 +70,12 @@
def set_object(self, session, object):
return self.object.set(session, object)
+ def get_href(self, session, object):
+ branch = session.branch()
+ self.object.set(branch, object)
+ self.__view.show(branch)
+ return branch.marshal()
+
def set_view_mode(self, mode):
self.__view = mode
@@ -76,28 +86,20 @@
self.__add = mode
def show_add(self, session):
- return self.show_frame_mode(session, self.__add)
+ return self.show_mode(session, self.__add)
def set_edit_mode(self, mode):
self.__edit = mode
def show_edit(self, session):
- return self.show_frame_mode(session, self.__edit)
+ return self.show_mode(session, self.__edit)
def set_remove_mode(self, mode):
self.__remove = mode
def show_remove(self, session):
- return self.show_frame_mode(session, self.__remove)
+ return self.show_mode(session, self.__remove)
- def show_frame_mode(self, session, mode):
- self.show_mode(session, mode)
-
- if isinstance(mode, Frame):
- self.page.set_current_frame(session, mode)
-
- return mode
-
def do_process(self, session, *args):
self.page.get_frames(session).append(self)
@@ -105,15 +107,12 @@
def render_href(self, session, *args):
branch = session.branch()
- self.page.set_current_frame(branch, self)
- self.show_view(branch)
+ self.__view.show(branch)
return branch.marshal()
def render_title(self, session, *args):
obj = self.get_object(session)
- assert obj
-
cls = self.app.model.get_class_by_object(obj)
return fmt_shorten(cls.get_object_title(session, obj), 16, 4)
@@ -137,16 +136,6 @@
def render_title(self, session, *args):
return self.frame.render_title(session, *args)
- def render_edit_href(self, session, *args):
- branch = session.branch()
- self.frame.show_edit(branch)
- return branch.marshal()
-
- def render_remove_href(self, session, *args):
- branch = session.branch()
- self.frame.show_remove(branch)
- return branch.marshal()
-
class FormHelp(Widget):
def __init__(self, app, name):
super(FormHelp, self).__init__(app, name)
@@ -266,6 +255,12 @@
return "Act on object %s" % id
class CuminBulk(ItemSet, CuminForm, Frame):
+ def get_href(self, session, ids):
+ branch = session.branch()
+ self.ids.set(branch, ids)
+ self.show(branch)
+ return branch.marshal()
+
def process_submit(self, session, *args):
items = self.get_items(session, *args)
@@ -285,7 +280,6 @@
def render_form_heading(self, session, *args):
return "Actions"
-
class CuminBulkActionForm(CuminBulk, CuminIntIdList):
def get_items(self, session, *args):
@@ -750,7 +744,7 @@
self.add_child(self.phase)
def get_args(self, session):
- obj = self.frame.get_object(session)
+ return self.frame.get_args(session)
return (obj,)
def get_sql_values(self, session, obj):
@@ -761,26 +755,32 @@
return "Queue"
def render_content(self, session, data):
- queue = Identifiable(data["q_id"])
- branch = session.branch()
- self.frame.frame.show_queue(branch, queue).show_view(branch)
- return fmt_olink(branch, Queue.get(data["q_id"]))
+ queue = Queue.get(data["q_id"])
+ href = self.page.main.broker.queue.get_href(session, queue)
+ return fmt_link(href, fmt_shorten(queue.name))
class ENameColumn(SqlTableColumn):
def render_title(self, session, data):
return "Exchange"
def render_content(self, session, data):
- exchange = Identifiable(data["e_id"])
- branch = session.branch()
- self.frame.frame.show_exchange(branch, exchange).show_view(branch)
- name = Exchange.get(data["e_id"]).name or "<em>Default</em>"
- return fmt_olink(branch, exchange, name=name)
+ exchange = Exchange.get(data["e_id"])
+ href = self.page.main.broker.exchange.get_href(session, exchange)
+ if exchange.name:
+ name = fmt_shorten(exchange.name)
+ else:
+ name = "<em>Default</em>"
+
+ return fmt_link(href, name)
+
class KeyColumn(SqlTableColumn):
def render_title(self, session, data):
return "Key"
+ def render_value(self, session, value):
+ return fmt_shorten(value)
+
class RateColumn(ItemTableColumn):
def render_title(self, session, data):
return "Message Rate"
@@ -990,9 +990,6 @@
def render_title(self, session):
return "Durable?"
- def get(self, session):
- return self.param.get(session)
-
class Durable(RadioFieldOption):
def render_value(self, session):
return "durable"
@@ -1144,9 +1141,6 @@
def render_title(self, session):
return "Auto-Delete?"
- def get(self, session):
- return self.param.get(session)
-
class AutoDel(RadioFieldOption):
def render_value(self, session):
return "autodel"
@@ -1176,4 +1170,3 @@
def get_url(self, session):
pass
-
Modified: mgmt/trunk/cumin/python/wooly/__init__.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/__init__.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/wooly/__init__.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -200,6 +200,17 @@
if str:
return str
+ def show(self, session):
+ assert self.parent
+
+ self.parent.show_child(session, self)
+ self.parent.show(session)
+
+ return self
+
+ def show_child(self, session, child):
+ pass
+
def save_parameters(self, session, params):
params.extend(self.parameters)
@@ -274,6 +285,11 @@
return "%s('%s')" % (self.__class__.__name__, self.path)
class Frame(Widget):
+ def show(self, session):
+ super(Frame, self).show(session)
+
+ return self.page.set_current_frame(session, self)
+
def save_parameters(self, session, params):
frame = self.page.get_current_frame(session)
@@ -324,6 +340,12 @@
def get_cache_control(self, session):
return None
+ def show(self, session):
+ pass
+
+ def show_child(self, session, child):
+ pass
+
def save_session(self, session):
pass
@@ -511,6 +533,12 @@
if self.render_stack:
self.render_stack[0].write(out)
+ def print_last_call(self, out=sys.stdout):
+ if self.render_stack:
+ self.render_stack[-1].write(out)
+ elif self.process_stack:
+ self.process_stack[-1].write(out)
+
def branch(self):
session = Session(self.page)
session.trunk = self
@@ -868,7 +896,7 @@
writer.write(" session: " + str(self.session))
writer.write(os.linesep)
- for item in self.session_values.iteritems():
+ for item in sorted(self.session_values.items()):
writer.write(" value: %s = %s" % item)
writer.write(os.linesep)
Modified: mgmt/trunk/cumin/python/wooly/devel.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/devel.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/wooly/devel.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -2,6 +2,7 @@
from random import sample
from time import clock
from xml.parsers.expat import ParserCreate
+from traceback import print_exc
from wooly import *
@@ -9,6 +10,7 @@
def __init__(self, app, check_xml=False):
self.app = app
self.check_xml = check_xml
+ self.continue_on_error = False
def run(self, max=-1):
visited = set()
@@ -27,16 +29,30 @@
session = Session.unmarshal(self.app, url)
- page = session.page
- page.process(session)
+ try:
+ page = session.page
+ page.process(session)
- html = page.render(session)
+ html = page.render(session)
+ except KeyboardInterrupt:
+ raise
+ except:
+ print
+ session.debug.print_last_call()
+
+ if self.continue_on_error:
+ print_exc(file=sys.stderr)
+ else:
+ raise
+
if self.check_xml:
try:
parser = ParserCreate()
parser.Parse(html)
- except Exception, e:
+ except KeyboardInterrupt:
+ raise
+ except:
print
html = html + "[eof]"
@@ -46,7 +62,10 @@
for i, line in enumerate(lines):
print "%4i %s" % (i + 1, line)
- raise e
+ if self.continue_on_error:
+ print_exc(file=sys.stderr)
+ else:
+ raise
bytes = len(html)
millis = (clock() - start) * 1000
Modified: mgmt/trunk/cumin/python/wooly/forms.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/forms.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/wooly/forms.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -354,6 +354,9 @@
def get(self, session):
return self.param.get(session)
+ def set(self, session, value):
+ self.param.set(session, value)
+
def render_inputs(self, session, *args):
writer = Writer()
Modified: mgmt/trunk/cumin/python/wooly/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/wooly/widgets.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/cumin/python/wooly/widgets.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -37,6 +37,9 @@
return mode
+ def show_child(self, session, child):
+ return self.show_mode(session, child)
+
def do_process(self, session, *args):
mode = self.get_selected_mode(session)
Modified: mgmt/trunk/mint/python/mint/schema.py
===================================================================
--- mgmt/trunk/mint/python/mint/schema.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/mint/python/mint/schema.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -16,7 +16,8 @@
statsCurr = ForeignKey('SlotStats', cascade='null', default=None)
statsPrev = ForeignKey('SlotStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
- collector = ForeignKey('Collector', cascade='null', default=None)
+ Pool = StringCol(length=1000, default=None)
+ System = StringCol(length=1000, default=None)
AccountingGroup = StringCol(length=1000, default=None)
Arch = StringCol(length=1000, default=None)
CheckpointPlatform = StringCol(length=1000, default=None)
@@ -151,6 +152,7 @@
Note = StringCol(length=4000, default=None)
Out = StringCol(length=4000, default=None)
Owner = StringCol(length=1000, default=None)
+ Juser = StringCol(length=1000, default=None)
ProcId = IntCol(default=None)
QDate = TimestampCol(default=None)
JobUniverse = IntCol(default=None)
@@ -245,6 +247,8 @@
statsCurr = ForeignKey('SchedulerStats', cascade='null', default=None)
statsPrev = ForeignKey('SchedulerStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
+ Pool = StringCol(length=1000, default=None)
+ System = StringCol(length=1000, default=None)
JobQueueBirthdate = TimestampCol(default=None)
MaxJobsRunning = IntCol(default=None)
Machine = StringCol(length=1000, default=None)
@@ -328,6 +332,8 @@
statsCurr = ForeignKey('NegotiatorStats', cascade='null', default=None)
statsPrev = ForeignKey('NegotiatorStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
+ Pool = StringCol(length=1000, default=None)
+ System = StringCol(length=1000, default=None)
Name = StringCol(length=1000, default=None)
Machine = StringCol(length=1000, default=None)
MyAddress = StringCol(length=1000, default=None)
@@ -395,6 +401,8 @@
statsCurr = ForeignKey('CollectorStats', cascade='null', default=None)
statsPrev = ForeignKey('CollectorStats', cascade='null', default=None)
classInfos = dict() # brokerId => classInfo
+ Pool = StringCol(length=1000, default=None)
+ System = StringCol(length=1000, default=None)
CondorPlatform = StringCol(length=1000, default=None)
CondorVersion = StringCol(length=1000, default=None)
Name = StringCol(length=1000, default=None)
@@ -412,6 +420,68 @@
+class Master(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ sourceScopeId = BigIntCol(default=None)
+ sourceObjectId = BigIntCol(default=None)
+ creationTime = TimestampCol(default=None)
+ deletionTime = TimestampCol(default=None)
+ managedBroker = StringCol(length=1000, default=None)
+ statsCurr = ForeignKey('MasterStats', cascade='null', default=None)
+ statsPrev = ForeignKey('MasterStats', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+ Pool = StringCol(length=1000, default=None)
+ System = StringCol(length=1000, default=None)
+ Name = StringCol(length=1000, default=None)
+ Machine = StringCol(length=1000, default=None)
+ PublicNetworkIpAddr = StringCol(length=1000, default=None)
+ MyAddress = StringCol(length=1000, default=None)
+ RealUid = IntCol(default=None)
+
+ CondorPlatform = StringCol(length=1000, default=None)
+ CondorVersion = StringCol(length=1000, default=None)
+ DaemonStartTime = TimestampCol(default=None)
+
+
+ def Start(self, model, callback, Subsystem):
+ actualArgs = dict()
+ actualArgs["Subsystem"] = Subsystem
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "Start",
+ callback, args=actualArgs)
+
+ def Stop(self, model, callback, Subsystem):
+ actualArgs = dict()
+ actualArgs["Subsystem"] = Subsystem
+ conn = model.connections[self.managedBroker]
+ classInfo = self.classInfos[self.managedBroker]
+ originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
+ conn.callMethod(originalId, classInfo, "Stop",
+ callback, args=actualArgs)
+
+class MasterStats(SQLObject):
+ class sqlmeta:
+ lazyUpdate = True
+
+ recTime = TimestampCol(default=None)
+ master = ForeignKey('Master', cascade='null', default=None)
+ classInfos = dict() # brokerId => classInfo
+
+ MonitorSelfAge = IntCol(default=None)
+ MonitorSelfCPUUsage = FloatCol(default=None)
+ MonitorSelfImageSize = FloatCol(default=None)
+ MonitorSelfRegisteredSocketCount = IntCol(default=None)
+ MonitorSelfResidentSetSize = IntCol(default=None)
+ MonitorSelfTime = TimestampCol(default=None)
+
+
+
+
class Acl(SQLObject):
class sqlmeta:
lazyUpdate = True
@@ -690,16 +760,16 @@
conn.callMethod(originalId, classInfo, "echo",
callback, args=actualArgs)
- def connect(self, model, callback, host, port, useSsl, durable, authMechanism, username, password):
+ def connect(self, model, callback, host, port, durable, authMechanism, username, password, transport):
"""Establish a connection to another broker"""
actualArgs = dict()
actualArgs["host"] = host
actualArgs["port"] = port
- actualArgs["useSsl"] = useSsl
actualArgs["durable"] = durable
actualArgs["authMechanism"] = authMechanism
actualArgs["username"] = username
actualArgs["password"] = password
+ actualArgs["transport"] = transport
conn = model.connections[self.managedBroker]
classInfo = self.classInfos[self.managedBroker]
originalId = objectId(None, self.sourceScopeId, self.sourceObjectId)
@@ -776,6 +846,7 @@
classInfos = dict() # brokerId => classInfo
broker = ForeignKey('Broker', cascade='null', default=None)
name = StringCol(length=1000, default=None)
+ federationTag = StringCol(length=1000, default=None)
class VhostStats(SQLObject):
@@ -1000,7 +1071,7 @@
vhost = ForeignKey('Vhost', cascade='null', default=None)
host = StringCol(length=1000, default=None)
port = IntCol(default=None)
- useSsl = BoolCol(default=None)
+ transport = StringCol(length=1000, default=None)
durable = BoolCol(default=None)
@@ -1163,9 +1234,6 @@
classToSchemaNameMap['Slot'] = 'Slot'
schemaNameToClassMap['Slot'] = Slot
-Collector.sqlmeta.addJoin(SQLMultipleJoin('Slot', joinMethodName='slots'))
-
-
Slot.sqlmeta.addJoin(SQLMultipleJoin('SlotStats', joinMethodName='stats'))
classToSchemaNameMap['Job'] = 'Job'
@@ -1201,6 +1269,11 @@
Collector.sqlmeta.addJoin(SQLMultipleJoin('CollectorStats', joinMethodName='stats'))
+classToSchemaNameMap['Master'] = 'Master'
+schemaNameToClassMap['Master'] = Master
+
+Master.sqlmeta.addJoin(SQLMultipleJoin('MasterStats', joinMethodName='stats'))
+
classToSchemaNameMap['Acl'] = 'acl'
schemaNameToClassMap['acl'] = Acl
Modified: mgmt/trunk/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/mint/python/mint/schemaparser.py 2008-10-23 18:51:51 UTC (rev 2675)
@@ -32,7 +32,7 @@
self.dataTypesMap["map"] = "PickleCol"
# mapping for identifiers in the XML schema that are reserved words in either SQL or Python
self.reservedWords = {"in": "inRsv", "In": "InRsv",
- "connection": "clientConnection", "Connection": "ClientConnection"}
+ "connection": "clientConnection", "Connection": "ClientConnection", "User": "Juser"}
def renameReservedWord(self, name):
if (name in self.reservedWords.keys()):
Modified: mgmt/trunk/mint/sql/schema.sql
===================================================================
--- mgmt/trunk/mint/sql/schema.sql 2008-10-22 20:40:01 UTC (rev 2674)
+++ mgmt/trunk/mint/sql/schema.sql 2008-10-23 18:51:51 UTC (rev 2675)
@@ -262,6 +262,8 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
+ pool VARCHAR(1000),
+ system VARCHAR(1000),
condor_platform VARCHAR(1000),
condor_version VARCHAR(1000),
name VARCHAR(1000),
@@ -335,6 +337,7 @@
note VARCHAR(4000),
out VARCHAR(4000),
owner VARCHAR(1000),
+ juser VARCHAR(1000),
proc_id INT,
q_date TIMESTAMP,
job_universe INT,
@@ -423,7 +426,7 @@
vhost_id INT,
host VARCHAR(1000),
port INT,
- use_ssl BOOL,
+ transport VARCHAR(1000),
durable BOOL
);
@@ -435,6 +438,40 @@
last_error VARCHAR(1000)
);
+CREATE TABLE master (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ source_scope_id BIGINT,
+ source_object_id BIGINT,
+ creation_time TIMESTAMP,
+ deletion_time TIMESTAMP,
+ managed_broker VARCHAR(1000),
+ stats_curr_id INT,
+ stats_prev_id INT,
+ pool VARCHAR(1000),
+ system VARCHAR(1000),
+ name VARCHAR(1000),
+ machine VARCHAR(1000),
+ public_network_ip_addr VARCHAR(1000),
+ my_address VARCHAR(1000),
+ real_uid INT,
+ condor_platform VARCHAR(1000),
+ condor_version VARCHAR(1000),
+ daemon_start_time TIMESTAMP
+);
+
+CREATE TABLE master_stats (
+ id SERIAL PRIMARY KEY,
+ rec_time TIMESTAMP,
+ master_id INT,
+ monitor_self_age INT,
+ monitor_self_cpu_usage FLOAT,
+ monitor_self_image_size FLOAT,
+ monitor_self_registered_socket_count INT,
+ monitor_self_resident_set_size INT,
+ monitor_self_time TIMESTAMP
+);
+
CREATE TABLE negotiator (
id SERIAL PRIMARY KEY,
rec_time TIMESTAMP,
@@ -445,6 +482,8 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
+ pool VARCHAR(1000),
+ system VARCHAR(1000),
name VARCHAR(1000),
machine VARCHAR(1000),
my_address VARCHAR(1000),
@@ -534,6 +573,8 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
+ pool VARCHAR(1000),
+ system VARCHAR(1000),
job_queue_birthdate TIMESTAMP,
max_jobs_running INT,
machine VARCHAR(1000),
@@ -599,7 +640,8 @@
managed_broker VARCHAR(1000),
stats_curr_id INT,
stats_prev_id INT,
- collector_id INT,
+ pool VARCHAR(1000),
+ system VARCHAR(1000),
accounting_group VARCHAR(1000),
arch VARCHAR(1000),
checkpoint_platform VARCHAR(1000),
@@ -796,7 +838,8 @@
stats_curr_id INT,
stats_prev_id INT,
broker_id INT,
- name VARCHAR(1000)
+ name VARCHAR(1000),
+ federation_tag VARCHAR(1000)
);
CREATE TABLE vhost_stats (
@@ -921,6 +964,12 @@
ALTER TABLE link_stats ADD CONSTRAINT link_id_exists FOREIGN KEY (link_id) REFERENCES link (id) ON DELETE SET NULL;
+ALTER TABLE master ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES master_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE master ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES master_stats (id) ON DELETE SET NULL;
+
+ALTER TABLE master_stats ADD CONSTRAINT master_id_exists FOREIGN KEY (master_id) REFERENCES master (id) ON DELETE SET NULL;
+
ALTER TABLE negotiator ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES negotiator_stats (id) ON DELETE SET NULL;
ALTER TABLE negotiator ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES negotiator_stats (id) ON DELETE SET NULL;
@@ -955,8 +1004,6 @@
ALTER TABLE slot ADD CONSTRAINT stats_prev_id_exists FOREIGN KEY (stats_prev_id) REFERENCES slot_stats (id) ON DELETE SET NULL;
-ALTER TABLE slot ADD CONSTRAINT collector_id_exists FOREIGN KEY (collector_id) REFERENCES collector (id) ON DELETE SET NULL;
-
ALTER TABLE slot_stats ADD CONSTRAINT slot_id_exists FOREIGN KEY (slot_id) REFERENCES slot (id) ON DELETE SET NULL;
ALTER TABLE store ADD CONSTRAINT stats_curr_id_exists FOREIGN KEY (stats_curr_id) REFERENCES store_stats (id) ON DELETE SET NULL;
16 years, 2 months
rhmessaging commits: r2673 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2008-10-21 19:28:26 -0400 (Tue, 21 Oct 2008)
New Revision: 2673
Modified:
store/trunk/cpp/tests/MessageUtils.h
store/trunk/cpp/tests/SimpleTest.cpp
Log:
Remove dependency on MessageDelivery from qpid tree.
Modified: store/trunk/cpp/tests/MessageUtils.h
===================================================================
--- store/trunk/cpp/tests/MessageUtils.h 2008-10-21 20:32:06 UTC (rev 2672)
+++ store/trunk/cpp/tests/MessageUtils.h 2008-10-21 23:28:26 UTC (rev 2673)
@@ -23,7 +23,6 @@
#include <qpid/broker/Message.h>
-#include <qpid/broker/MessageDelivery.h>
#include <qpid/framing/AMQFrame.h>
#include <qpid/framing/all_method_bodies.h>
#include <qpid/framing/Uuid.h>
@@ -55,4 +54,11 @@
AMQFrame content(in_place<AMQContentBody>(data));
msg->getFrames().append(content);
}
+
+ static void deliver(QueuedMessage& msg, FrameHandler& h, uint16_t framesize)
+ {
+ msg.payload->sendHeader(h, framesize);
+ msg.payload->sendContent(*(msg.queue), h, framesize);
+ }
+
};
Modified: store/trunk/cpp/tests/SimpleTest.cpp
===================================================================
--- store/trunk/cpp/tests/SimpleTest.cpp 2008-10-21 20:32:06 UTC (rev 2672)
+++ store/trunk/cpp/tests/SimpleTest.cpp 2008-10-21 23:28:26 UTC (rev 2673)
@@ -302,9 +302,9 @@
DummyHandler handler;
QueuedMessage qm(queue.get(),msg,0);
- MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getMessageDeliveryToken("ignore", 0, 0), 100);
- BOOST_CHECK_EQUAL((size_t) 3, handler.frames.size());
- AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[2].getBody()));
+ MessageUtils::deliver(qm, handler, 100);
+ BOOST_CHECK_EQUAL((size_t) 2, handler.frames.size());
+ AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[1].getBody()));
BOOST_REQUIRE(contentBody);
BOOST_CHECK_EQUAL(data1.size() + data2.size(), contentBody->getData().size());
BOOST_CHECK_EQUAL(data1 + data2, contentBody->getData());
@@ -394,10 +394,10 @@
DummyHandler handler;
QueuedMessage qm(queue.get(), msg, 0);
//52 chars of data, i.e. 2 chunks of 20 and one of 12
- MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getMessageDeliveryToken("ignore", 0, 0), 20);
- BOOST_REQUIRE(handler.frames.size() > 2);
+ MessageUtils::deliver(qm, handler, 20);
+ BOOST_REQUIRE(handler.frames.size() > 1);
string loaded;
- for (uint i = 2; i < handler.frames.size(); i++) {
+ for (uint i = 1; i < handler.frames.size(); i++) {
AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
BOOST_REQUIRE(contentBody);
loaded += contentBody->getData();
@@ -438,11 +438,12 @@
//load lazily
DummyHandler handler;
QueuedMessage qm(queue.get(),msg,0);
- MessageDelivery::deliver(qm, handler, 0, MessageDelivery::getMessageDeliveryToken("ignore", 0, 0), 20);//52 chars of data, i.e. 2 chunks of 20 and one of 12
+ //52 chars of data, i.e. 2 chunks of 20 and one of 12
+ MessageUtils::deliver(qm, handler, 20);
- BOOST_REQUIRE(handler.frames.size() > 2);
+ BOOST_REQUIRE(handler.frames.size() > 1);
string loaded;
- for (uint i = 2; i < handler.frames.size(); i++) {
+ for (uint i = 1; i < handler.frames.size(); i++) {
AMQContentBody* contentBody(dynamic_cast<AMQContentBody*>(handler.frames[i].getBody()));
BOOST_REQUIRE(contentBody);
loaded += contentBody->getData();
16 years, 2 months