rhmessaging commits: r1426 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-04 15:57:47 -0500 (Tue, 04 Dec 2007)
New Revision: 1426
Modified:
mgmt/cumin/python/cumin/queue.py
Log:
Fix old dummy data model leftovers.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-12-04 20:55:58 UTC (rev 1425)
+++ mgmt/cumin/python/cumin/queue.py 2007-12-04 20:57:47 UTC (rev 1426)
@@ -210,20 +210,22 @@
def render_item_href(self, session, binding):
branch = session.branch()
- self.page().show_exchange(branch, binding.get_exchange())
+ self.page().show_exchange(branch, binding.exchange)
return branch.marshal()
def render_item_name(self, session, binding):
- return binding.get_exchange().name
+ return binding.exchange.name
def render_item_binding_key(self, session, binding):
- return binding.binding_key
+ return binding.bindingKey
def render_item_messages_matched(self, session, binding):
- return binding.get_measurement("msgMatched").get_value()
+ #stat = self.app.model.binding.get_stat("msgMatched")
+ return binding.statsCurr.msgMatched #XXX
def render_item_messages_matched_rate(self, session, binding):
- value = binding.get_measurement("msgMatched").get_rate()
+ #stat = self.app.model.binding.get_stat("msgMatched")
+ value = binding.statsCurr.msgMatched #XXX
return fmt_rate(value, "msg", "sec")
class QueueForm(CuminForm):
18 years, 4 months
rhmessaging commits: r1425 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-04 15:55:58 -0500 (Tue, 04 Dec 2007)
New Revision: 1425
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/widgets.strings
Log:
Moves the group input template to the right place.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-04 20:22:39 UTC (rev 1424)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-04 20:55:58 UTC (rev 1425)
@@ -31,7 +31,7 @@
self.add_parameter(self.action)
self.add_form_parameter(self.action)
- self.groups = BrokerGroupInput(app, "groups", self)
+ self.groups = self.BrokerSetGroupInput(app, "groups", self)
self.add_child(self.groups)
self.submit = BooleanParameter(app, "submit")
@@ -120,6 +120,9 @@
def render_item_load(self, session, broker):
return "%.2f" % random()
+ class BrokerSetGroupInput(BrokerGroupInput):
+ pass
+
class BrokerPaginator(Paginator):
def get_object(self, session, model):
return list(BrokerRegistration.select()) #XXX ugh
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-12-04 20:22:39 UTC (rev 1424)
+++ mgmt/cumin/python/cumin/broker.strings 2007-12-04 20:55:58 UTC (rev 1425)
@@ -47,6 +47,12 @@
background-color: #ff9;
}
+[BrokerSetGroupInput.html]
+<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="submit()">
+ <option value="">Choose Group...</option>
+ {items}
+</select>
+
[BrokerConfigTab.html]
<ul class="actions">
<li><a class="nav" href="{href}">Add Property</a></li>
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2007-12-04 20:22:39 UTC (rev 1424)
+++ mgmt/cumin/python/cumin/widgets.strings 2007-12-04 20:55:58 UTC (rev 1425)
@@ -46,10 +46,3 @@
[Paginator.item_html]
<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
-
-[BrokerGroupInput.html]
-{errors}
-<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="submit()">
- <option value="">Choose Group...</option>
- {items}
-</select>
18 years, 4 months
rhmessaging commits: r1424 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: gordonsim
Date: 2007-12-04 15:22:39 -0500 (Tue, 04 Dec 2007)
New Revision: 1424
Modified:
store/trunk/cpp/lib/BdbMessageStore.cpp
store/trunk/cpp/lib/TxnCtxt.h
Log:
Hack to serialise all bdb store transactions to avoid deadlocking.
Modified: store/trunk/cpp/lib/BdbMessageStore.cpp
===================================================================
--- store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-04 19:30:24 UTC (rev 1423)
+++ store/trunk/cpp/lib/BdbMessageStore.cpp 2007-12-04 20:22:39 UTC (rev 1424)
@@ -84,7 +84,7 @@
try {
env.open(bdbdir.c_str(), DB_THREAD | DB_CREATE | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | DB_USE_ENVIRON, 0);
- txn.begin(env);
+ txn.begin(env, false);
open(queueDb, txn.get(), "queues.db", false);
open(configDb, txn.get(), "config.db", false);
open(exchangeDb, txn.get(), "exchanges.db", false);
@@ -291,7 +291,7 @@
IdDbt key(e.getPersistenceId());
BindingDbt value(e, q, k, a);
TxnCtxt txn;
- txn.begin(env);
+ txn.begin(env, true);
put(bindingDb, txn.get(), key, value);
txn.commit();
}
@@ -304,7 +304,7 @@
BindingDbt value(e, q, k, a);
TxnCtxt txn;
- txn.begin(env);
+ txn.begin(env, true);
if (deleteKeyValuePair(bindingDb, txn.get(), key, value)) {
txn.commit();
@@ -325,7 +325,7 @@
message_index messages;//id->message
TxnCtxt txn;
- txn.begin(env);
+ txn.begin(env, false);
try {
//read all queues, calls recoversMessages
recoverQueues(txn, registry, queues, prepared, messages);
@@ -729,7 +729,7 @@
{
checkInit();
TxnCtxt txn;
- txn.begin(env);
+ txn.begin(env, true);
u_int64_t messageId (msg->getPersistenceId());
if (messageId == 0 || !msg->isContentReleased()) {
@@ -752,7 +752,7 @@
if (messageId) {
Dbt key (&messageId, sizeof(messageId));
TxnCtxt txn;
- txn.begin(env);
+ txn.begin(env, true);
try {
deleteIfUnused(txn.get(), key);
txn.commit();
@@ -881,7 +881,7 @@
txn = check(ctxt);
} else {
txn = &implicit;
- txn->begin(env);
+ txn->begin(env, !usingJrnl());
}
try {
@@ -1026,7 +1026,7 @@
txn = check(ctxt);
} else {
txn = &implicit;
- txn->begin(env);
+ txn->begin(env, !usingJrnl());
}
try {
@@ -1211,27 +1211,27 @@
void BdbMessageStore::completed(TPCTxnCtxt& txn, Db& discard, Db& apply, bool commit)
{
- if (!txn.get()) txn.begin(env);
+ if (!txn.get()) txn.begin(env, !usingJrnl());
try {
StringDbt key(txn.getXid());
if (!usingJrnl()){
- //scroll through all records matching xid in apply and dequeue
- //using the message and queue id encoded in each value
- Cursor c;
- c.open(apply, txn.get());
- IdPairDbt value;
-
- for (int status = c->get(&key, &value, DB_SET); status == 0; status = c->get(&key, &value, DB_NEXT_DUP)) {
+ //scroll through all records matching xid in apply and dequeue
+ //using the message and queue id encoded in each value
+ Cursor c;
+ c.open(apply, txn.get());
+ IdPairDbt value;
+
+ for (int status = c->get(&key, &value, DB_SET); status == 0; status = c->get(&key, &value, DB_NEXT_DUP)) {
dequeue(txn.get(), value.message, value.queue);
- }
- c.close();
-
- //delete all records matching xid
- discard.del(txn.get(), &key, 0);
- apply.del(txn.get(), &key, 0);
- }
+ }
+ c.close();
+
+ //delete all records matching xid
+ discard.del(txn.get(), &key, 0);
+ apply.del(txn.get(), &key, 0);
+ }
prepareXidDb.del(txn.get(), &key, 0);
txn.complete(commit);
@@ -1247,7 +1247,7 @@
checkInit();
// pass sequence number for c/a when using jrnl
TxnCtxt* txn(new TxnCtxt(&messageIdSequence ));
- txn->begin(env);
+ txn->begin(env, !usingJrnl());
return auto_ptr<TransactionContext>(txn);
}
@@ -1259,7 +1259,7 @@
// pass sequence number for c/a when using jrnl
TPCTxnCtxt* txn(new TPCTxnCtxt(xid, jtx));
- txn->begin(env);
+ txn->begin(env, !usingJrnl());
return auto_ptr<TPCTransactionContext>(txn);
}
Modified: store/trunk/cpp/lib/TxnCtxt.h
===================================================================
--- store/trunk/cpp/lib/TxnCtxt.h 2007-12-04 19:30:24 UTC (rev 1423)
+++ store/trunk/cpp/lib/TxnCtxt.h 2007-12-04 20:22:39 UTC (rev 1424)
@@ -28,6 +28,7 @@
#include <qpid/broker/MessageStore.h>
#include <qpid/sys/Mutex.h>
#include <boost/shared_ptr.hpp>
+#include <memory>
#include <vector>
#include "JournalImpl.h"
#include "DataTokenImpl.h"
@@ -45,97 +46,105 @@
class TxnCtxt : public qpid::broker::TransactionContext
{
protected:
- typedef std::set<qpid::broker::ExternalQueueStore*> ipqdef;
- ipqdef impactedQueues; // list of Queues used in the txn
+ typedef std::set<qpid::broker::ExternalQueueStore*> ipqdef;
+ typedef std::auto_ptr<qpid::sys::Mutex::ScopedLock> AutoScopedLock;
+
+ static qpid::sys::Mutex globalSerialiser;
+
+ ipqdef impactedQueues; // list of Queues used in the txn
static unsigned int count;
mutable qpid::sys::Mutex Lock;
- IdSequence* loggedtx;
-
- unsigned int getCount() {
+ IdSequence* loggedtx;
+ AutoScopedLock globalHolder;
+
+ unsigned int getCount() {
qpid::sys::Mutex::ScopedLock locker(Lock);
- return ++count;
- }
- /**
- * local txn id, if non XA.
- */
- std::string tid;
- DbTxn* txn;
-
- void completeTXN(bool commit){
- for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i != impactedQueues.end(); i++) {
- JournalImpl* jc = static_cast<JournalImpl*>(*i);
- if (jc && loggedtx) { /* if using journal */
- boost::intrusive_ptr<DataTokenImpl> dtokp(new DataTokenImpl);
- dtokp->ref();
- dtokp->set_rid(loggedtx->next());
- try{
- if (commit)
- jc->txn_commit(dtokp.get(), getXid());
- else
- {
- jc->txn_abort(dtokp.get(), getXid());
+ return ++count;
+ }
+ /**
+ * local txn id, if non XA.
+ */
+ std::string tid;
+ DbTxn* txn;
+
+ void completeTXN(bool commit){
+ for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i != impactedQueues.end(); i++) {
+ JournalImpl* jc = static_cast<JournalImpl*>(*i);
+ if (jc && loggedtx) { /* if using journal */
+ boost::intrusive_ptr<DataTokenImpl> dtokp(new DataTokenImpl);
+ dtokp->ref();
+ dtokp->set_rid(loggedtx->next());
+ try{
+ if (commit)
+ jc->txn_commit(dtokp.get(), getXid());
+ else
+ {
+ jc->txn_abort(dtokp.get(), getXid());
}
- } catch (const journal::jexception& e) {
-//std::cout << "Error commit" << e << std::endl;
- THROW_STORE_EXCEPTION(std::string("Error commit") + e.what());
- }
-
- }
- }
- sync();
- deleteXidRecord();
- }
-
+ } catch (const journal::jexception& e) {
+ //std::cout << "Error commit" << e << std::endl;
+ THROW_STORE_EXCEPTION(std::string("Error commit") + e.what());
+ }
+
+ }
+ }
+ sync();
+ deleteXidRecord();
+ }
+
public:
TxnCtxt(IdSequence* _loggedtx=NULL) : loggedtx(_loggedtx), txn(0) {
- if (loggedtx){ tid.assign( "rhm-tid"); tid+=getCount(); }
- }
+ if (loggedtx){ tid.assign( "rhm-tid"); tid+=getCount(); }
+ }
- /**
- * Call to make sure all the data for this txn is written to safe store
- *
- *@return if the data sucessfully synced.
- */
- void sync(){
- bool allWritten = false;
- bool firstloop = true;
- while (loggedtx && !allWritten){
+ /**
+ * Call to make sure all the data for this txn is written to safe store
+ *
+ *@return if the data sucessfully synced.
+ */
+ void sync(){
+ bool allWritten = false;
+ bool firstloop = true;
+ while (loggedtx && !allWritten){
if (!firstloop) ::usleep(AIO_SLEEP_TIME); // move this into the get events call aiolib..
- allWritten = true;
- for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i != impactedQueues.end(); i++) {
- JournalImpl* jc = static_cast<JournalImpl*>(*i);
-
- try
- {
- if (jc && !(jc->is_txn_synced(getXid())))
- {
- if (firstloop)
- jc->flush();
- allWritten = false;
- jc->get_wr_events();
- }
- } catch (const journal::jexception& e) {
-//std::cout << " TxnCtxt: Error sync 3" << e << std::flush;
- THROW_STORE_EXCEPTION(std::string("Error sync") + e.what());
- }
- }
- firstloop = false;
- }
- }
-
+ allWritten = true;
+ for (TxnCtxt::ipqdef::iterator i = impactedQueues.begin(); i != impactedQueues.end(); i++) {
+ JournalImpl* jc = static_cast<JournalImpl*>(*i);
+
+ try
+ {
+ if (jc && !(jc->is_txn_synced(getXid())))
+ {
+ if (firstloop)
+ jc->flush();
+ allWritten = false;
+ jc->get_wr_events();
+ }
+ } catch (const journal::jexception& e) {
+ //std::cout << " TxnCtxt: Error sync 3" << e << std::flush;
+ THROW_STORE_EXCEPTION(std::string("Error sync") + e.what());
+ }
+ }
+ firstloop = false;
+ }
+ }
+
virtual ~TxnCtxt() { if(txn) abort(); }
- void begin(DbEnv& env){ env.txn_begin(0, &txn, 0); }
- void commit(){ txn->commit(0); completeTXN(true); txn = 0; }
- void abort(){ txn->abort(); completeTXN(false); txn = 0; }
+ void begin(DbEnv& env, bool sync = false){
+ env.txn_begin(0, &txn, 0);
+ if (sync) globalHolder = AutoScopedLock(new qpid::sys::Mutex::ScopedLock(globalSerialiser));
+ }
+ void commit(){ txn->commit(0); completeTXN(true); txn = 0; globalHolder.reset(); }
+ void abort(){ txn->abort(); completeTXN(false); txn = 0; globalHolder.reset(); }
DbTxn* get(){ return txn; }
virtual bool isTPC() { return false; }
- virtual const std::string& getXid() { return tid; }
-
- void deleteXidRecord(){ impactedQueues.clear(); }
- void addXidRecord(qpid::broker::ExternalQueueStore* queue){
- impactedQueues.insert(queue); }
-
+ virtual const std::string& getXid() { return tid; }
+
+ void deleteXidRecord(){ impactedQueues.clear(); }
+ void addXidRecord(qpid::broker::ExternalQueueStore* queue) {
+ impactedQueues.insert(queue); }
+
};
class TPCTxnCtxt : public TxnCtxt, public qpid::broker::TPCTransactionContext
@@ -146,12 +155,15 @@
virtual bool isTPC() { return true; }
virtual const std::string& getXid() { return xid; }
// commit the BDB abort, abort commit the jnrl
- void commit(){ txn->commit(0); txn = 0; }
- void abort(){ txn->abort(); txn = 0; }
+ void commit(){ txn->commit(0); txn = 0; globalHolder.reset(); }
+ void abort(){ txn->abort(); txn = 0; globalHolder.reset(); }
void complete(bool commit){
- txn->commit(0); completeTXN(commit); txn = 0; }
+ txn->commit(0); completeTXN(commit); txn = 0;
+ }
};
+qpid::sys::Mutex TxnCtxt::globalSerialiser;
+
}}
#endif
18 years, 4 months
rhmessaging commits: r1423 - in mgmt: mint/python/mint and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-04 14:30:24 -0500 (Tue, 04 Dec 2007)
New Revision: 1423
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/mint/python/mint/__init__.py
Log:
Adds logic to the config callback to associate brokers with
registrations.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-04 16:53:03 UTC (rev 1422)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-04 19:30:24 UTC (rev 1423)
@@ -600,6 +600,8 @@
reg.name = names[i]
+ self.app.model.data.connectToBroker(reg.host, reg.port or 5672)
+
self.process_cancel(session, model)
class BrokerRemove(CuminConfirmForm):
Modified: mgmt/mint/python/mint/__init__.py
===================================================================
--- mgmt/mint/python/mint/__init__.py 2007-12-04 16:53:03 UTC (rev 1422)
+++ mgmt/mint/python/mint/__init__.py 2007-12-04 19:30:24 UTC (rev 1423)
@@ -73,6 +73,25 @@
else:
#print "\n\n=============== %s %d found AFTER QUERY\n\n" % (objType.__name__, idOriginal)
pass
+
+ if obj and obj.__class__ is Broker and obj.registration is None:
+ host, port = obj.managedBroker.split(":")
+
+ port = int(port)
+
+ if port == 5672:
+ port = None
+
+ regs = BrokerRegistration.selectBy(host=host, port=port)
+
+ print "regs", regs
+
+ for reg in regs:
+ print "Attaching broker to reg", reg
+
+ reg.broker = obj
+ obj.registration = reg
+
return obj
def getByIndexAttrib(self, objType, indexAttrib, indexValue, create=False, args={}):
18 years, 4 months
rhmessaging commits: r1422 - in mgmt/cumin/python: wooly and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-04 11:53:03 -0500 (Tue, 04 Dec 2007)
New Revision: 1422
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/cumin/python/cumin/brokergroup.py
mgmt/cumin/python/cumin/page.strings
mgmt/cumin/python/cumin/widgets.py
mgmt/cumin/python/cumin/widgets.strings
mgmt/cumin/python/wooly/forms.py
mgmt/cumin/python/wooly/forms.strings
Log:
Fixes javascript auto submit of broker list actions.
Separates bulk group add out to a separate drop down list.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-04 16:53:03 UTC (rev 1422)
@@ -30,10 +30,14 @@
self.action = Parameter(app, "action")
self.add_parameter(self.action)
self.add_form_parameter(self.action)
+
+ self.groups = BrokerGroupInput(app, "groups", self)
+ self.add_child(self.groups)
+
+ self.submit = BooleanParameter(app, "submit")
+ self.add_parameter(self.submit)
+ self.add_form_parameter(self.submit)
- self.submit = self.Submit(app, "submit", self)
- self.add_child(self.submit)
-
self.paginator = self.BrokerPaginator(app, "page")
self.add_child(self.paginator)
@@ -63,6 +67,9 @@
def render_action_param_name(self, session, broker):
return self.action.path()
+ def render_submit_param_name(self, session, broker):
+ return self.submit.path()
+
def render_item_checkbox_name(self, session, broker):
return self.brokers.path()
@@ -113,10 +120,6 @@
def render_item_load(self, session, broker):
return "%.2f" % random()
- class Submit(FormButton):
- def render_content(self, session, model):
- return "Submit"
-
class BrokerPaginator(Paginator):
def get_object(self, session, model):
return list(BrokerRegistration.select()) #XXX ugh
@@ -596,7 +599,7 @@
reg.host = elems[0]
reg.name = names[i]
-
+
self.process_cancel(session, model)
class BrokerRemove(CuminConfirmForm):
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/broker.strings 2007-12-04 16:53:03 UTC (rev 1422)
@@ -4,12 +4,16 @@
<div class="sactions">
<h2>Act on Selected Brokers:</h2>
- <select name="{action_param_name}">
+
+ <select name="{action_param_name}" onchange="submit()">
<option value="">Choose Action...</option>
<option value="shutdown">Shutdown</option>
<option value="loadbalance">Load Balance</option>
</select>
- {submit}
+
+ <h2>Add to Group:</h2>
+
+ {groups}
</div>
<table class="mobjects">
@@ -24,6 +28,7 @@
{items}
</table>
+ <input type="hidden" name="{submit_param_name}" value="t"/>
{hidden_inputs}
</form>
Modified: mgmt/cumin/python/cumin/brokergroup.py
===================================================================
--- mgmt/cumin/python/cumin/brokergroup.py 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/brokergroup.py 2007-12-04 16:53:03 UTC (rev 1422)
@@ -135,16 +135,6 @@
def process_display(self, session, group):
self.group_name.set(session, group.name)
-class BrokerGroupInput(OptionInputSet):
- def do_get_items(self, session, model):
- return model.get_broker_groups()
-
- def render_item_value(self, session, group):
- return group.id
-
- def render_item_selected_attr(self, session, group):
- return None
-
class BrokerGroupRemove(CuminConfirmForm):
def get_title(self, session, group):
return "Remove Broker Group '%s'" % group.name
Modified: mgmt/cumin/python/cumin/page.strings
===================================================================
--- mgmt/cumin/python/cumin/page.strings 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/page.strings 2007-12-04 16:53:03 UTC (rev 1422)
@@ -157,6 +157,10 @@
margin: 0 0.5em 0 0;
}
+div.sactions select {
+ margin: 0 0.5em 0 0;
+}
+
div.mobject div.mactions h2 {
display: inline;
font-size: 0.9em;
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/widgets.py 2007-12-04 16:53:03 UTC (rev 1422)
@@ -4,6 +4,7 @@
from wooly.widgets import *
from wooly.forms import *
+from parameters import *
from charts import *
from formats import *
from util import *
@@ -308,3 +309,19 @@
else:
return super(SQLObjectItemSet, self).get_item_count \
(session, object)
+
+class BrokerGroupInput(OptionInputSet):
+ def __init__(self, app, name, form):
+ super(BrokerGroupInput, self).__init__(app, name, form)
+
+ self.set_parameter(BrokerGroupParameter(app, "param"))
+ self.add_parameter(self.get_parameter())
+
+ def do_get_items(self, session, model):
+ return list(BrokerGroup.select())
+
+ def render_item_value(self, session, group):
+ return group.id
+
+ def render_item_content(self, session, group):
+ return group.name
Modified: mgmt/cumin/python/cumin/widgets.strings
===================================================================
--- mgmt/cumin/python/cumin/widgets.strings 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/cumin/widgets.strings 2007-12-04 16:53:03 UTC (rev 1422)
@@ -46,3 +46,10 @@
[Paginator.item_html]
<li><a {item_class_attr} href="{item_href}">{item_content}</a></li>
+
+[BrokerGroupInput.html]
+{errors}
+<select name="{name}" tabindex="{tab_index}" {disabled_attr} onchange="submit()">
+ <option value="">Choose Group...</option>
+ {items}
+</select>
Modified: mgmt/cumin/python/wooly/forms.py
===================================================================
--- mgmt/cumin/python/wooly/forms.py 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/wooly/forms.py 2007-12-04 16:53:03 UTC (rev 1422)
@@ -183,7 +183,7 @@
class FormButton(FormInput):
def __init__(self, app, name, form):
- FormInput.__init__(self, app, name, form)
+ super(FormButton, self).__init__(app, name, form)
self.set_parameter(BooleanParameter(app, "param"))
self.add_parameter(self.get_parameter())
Modified: mgmt/cumin/python/wooly/forms.strings
===================================================================
--- mgmt/cumin/python/wooly/forms.strings 2007-12-03 20:38:37 UTC (rev 1421)
+++ mgmt/cumin/python/wooly/forms.strings 2007-12-04 16:53:03 UTC (rev 1422)
@@ -36,4 +36,4 @@
<select name="{name}" tabindex="{tab_index}" {disabled_attr}>{items}</select>
[OptionInputSet.item_html]
-<option value="{item_value}" tabindex="{tab_index}" {item_selected_attr} {disabled_attr}>{item_content}</option>
+<option value="{item_value}" {item_selected_attr}>{item_content}</option>
18 years, 4 months
rhmessaging commits: r1421 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-03 15:38:37 -0500 (Mon, 03 Dec 2007)
New Revision: 1421
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/notes/justin-todo.txt
Log:
As far as is currently possible, implement bulk broker shutdown and
load balancing. The actual call out to the broker or agent that does
it is stubbed.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-03 20:03:33 UTC (rev 1420)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-03 20:38:37 UTC (rev 1421)
@@ -27,6 +27,10 @@
self.add_parameter(self.brokers)
self.add_form_parameter(self.brokers)
+ self.action = Parameter(app, "action")
+ self.add_parameter(self.action)
+ self.add_form_parameter(self.action)
+
self.submit = self.Submit(app, "submit", self)
self.add_child(self.submit)
@@ -44,11 +48,21 @@
if self.submit.get(session):
self.submit.set(session, False)
- for broker in self.brokers.get(session):
- print "broker", broker
+ action = self.action.get(session)
+ brokers = self.brokers.get(session)
+ if action == "shutdown":
+ for broker in brokers:
+ print "Shutting down broker", broker
+ elif action == "loadbalance":
+ for broker in brokers:
+ print "Load balancing broker", broker
+
self.page().set_redirect_url(session, session.marshal())
+ def render_action_param_name(self, session, broker):
+ return self.action.path()
+
def render_item_checkbox_name(self, session, broker):
return self.brokers.path()
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-12-03 20:03:33 UTC (rev 1420)
+++ mgmt/cumin/python/cumin/broker.strings 2007-12-03 20:38:37 UTC (rev 1421)
@@ -4,18 +4,10 @@
<div class="sactions">
<h2>Act on Selected Brokers:</h2>
- <select>
- <option>Choose Action...</option>
- <optgroup label="Actions">
- <option>Shutdown</option>
- <option>Load Balance</option>
- </optgroup>
- <optgroup label="Add to Group">
- <option>East Coast</option>
- <option>West Coast</option>
- <option>Marketing</option>
- <option>Sales</option>
- </optgroup>
+ <select name="{action_param_name}">
+ <option value="">Choose Action...</option>
+ <option value="shutdown">Shutdown</option>
+ <option value="loadbalance">Load Balance</option>
</select>
{submit}
</div>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-12-03 20:03:33 UTC (rev 1420)
+++ mgmt/notes/justin-todo.txt 2007-12-03 20:38:37 UTC (rev 1421)
@@ -12,12 +12,8 @@
* Add queue journal stats
- * "shutdown brokers"
-
* "shutdown broker"
- * "load balance brokers"
-
* "add brokers to group"
* "shutdown broker groups"
18 years, 4 months
rhmessaging commits: r1420 - in mgmt: notes and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-03 15:03:33 -0500 (Mon, 03 Dec 2007)
New Revision: 1420
Modified:
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/broker.strings
mgmt/notes/justin-todo.txt
Log:
Hooks up the unregister broker form.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-03 20:00:30 UTC (rev 1419)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-03 20:03:33 UTC (rev 1420)
@@ -119,6 +119,10 @@
self.add_mode(self.view)
self.set_view_mode(self.view)
+ self.remove = BrokerRemove(app, "remove")
+ self.add_mode(self.remove)
+ self.set_remove_mode(self.remove)
+
self.prop = BrokerConfigPropertyForm(app, "prop")
self.add_mode(self.prop)
@@ -235,7 +239,7 @@
class BrokerStatus(CuminStatus):
pass
-class BrokerView(Widget):
+class BrokerView(CuminView):
def __init__(self, app, name):
super(BrokerView, self).__init__(app, name)
@@ -289,7 +293,6 @@
def get_title(self, session, broker):
vhost = self.get_object(session, broker)
return "Queues %s" % fmt_count(vhost and len(vhost.queues) or 0)
-
def get_object(self, session, broker):
broker = broker.broker # Navigate from registration to real broker
if broker:
@@ -584,7 +587,7 @@
class BrokerRemove(CuminConfirmForm):
def get_title(self, session, broker):
- return "Remove Broker '%s'" % broker.port
+ return "Unregister Broker '%s'" % broker.name
def process_cancel(self, session, broker):
branch = session.branch()
@@ -592,14 +595,14 @@
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, broker):
- broker.remove()
+ broker.destroySelf()
branch = session.branch()
self.page().show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def render_submit_content(self, session, broker):
- return "Yes, Remove Broker '%s'" % broker.port
+ return "Yes, Unregister Broker '%s'" % broker.name
def render_cancel_content(self, session, broker):
return "No, Cancel"
Modified: mgmt/cumin/python/cumin/broker.strings
===================================================================
--- mgmt/cumin/python/cumin/broker.strings 2007-12-03 20:00:30 UTC (rev 1419)
+++ mgmt/cumin/python/cumin/broker.strings 2007-12-03 20:03:33 UTC (rev 1420)
@@ -134,7 +134,7 @@
<th class="actions" colspan="2">
<h2>Act on This Broker:</h2>
<a href="{href}">Shutdown</a>
- <a href="{href}">Unregister</a>
+ <a href="{remove_href}">Unregister</a>
</th>
</tr>
</table>
Modified: mgmt/notes/justin-todo.txt
===================================================================
--- mgmt/notes/justin-todo.txt 2007-12-03 20:00:30 UTC (rev 1419)
+++ mgmt/notes/justin-todo.txt 2007-12-03 20:03:33 UTC (rev 1420)
@@ -12,8 +12,6 @@
* Add queue journal stats
- * "unregister broker"
-
* "shutdown brokers"
* "shutdown broker"
@@ -42,8 +40,6 @@
* Prepare for journal stats on queue
- * Dispose of old dummy model
-
Deferred
* Add a wooly.focus(id) method to replace the ad-hoc javascript I'm
18 years, 4 months
rhmessaging commits: r1419 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-03 15:00:30 -0500 (Mon, 03 Dec 2007)
New Revision: 1419
Modified:
mgmt/cumin/python/cumin/__init__.py
Log:
Print a warning instead of blowing up on failing to connect to one of
the registered brokers.
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-12-03 19:28:17 UTC (rev 1418)
+++ mgmt/cumin/python/cumin/__init__.py 2007-12-03 20:00:30 UTC (rev 1419)
@@ -30,7 +30,11 @@
self.model = CuminModel()
for reg in BrokerRegistration.select():
- self.model.data.connectToBroker(reg.host, reg.port or 5672)
+ try:
+ self.model.data.connectToBroker(reg.host, reg.port or 5672)
+ except:
+ print "Failed connecting to broker '%s' at %s:%i" % \
+ (reg.name, reg.host, reg.port or 5672)
if reg.broker is None:
pass
18 years, 4 months
rhmessaging commits: r1418 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-03 14:28:17 -0500 (Mon, 03 Dec 2007)
New Revision: 1418
Added:
mgmt/cumin/python/cumin/stat.py
mgmt/cumin/python/cumin/stat.strings
Removed:
mgmt/cumin/python/cumin/measurement.py
mgmt/cumin/python/cumin/measurement.strings
Modified:
mgmt/cumin/python/cumin/client.py
mgmt/cumin/python/cumin/client.strings
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/exchange.strings
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/queue.strings
Log:
Renames measurement* to stat*, consistent with the new model.
Modified: mgmt/cumin/python/cumin/client.py
===================================================================
--- mgmt/cumin/python/cumin/client.py 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/client.py 2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,7 +1,7 @@
from wooly import *
from wooly.widgets import *
-from measurement import *
+from stat import *
from widgets import *
from parameters import *
from formats import *
@@ -134,7 +134,7 @@
def __init__(self, app, name):
super(ClientStatistics.StatisticsCurrent, self).__init__(app, name)
- self.add_child(MeasurementSet(app, "general", "general"))
+ self.add_child(StatSet(app, "general", "general"))
def get_title(self, session, client):
return "Current"
Modified: mgmt/cumin/python/cumin/client.strings
===================================================================
--- mgmt/cumin/python/cumin/client.strings 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/client.strings 2007-12-03 19:28:17 UTC (rev 1418)
@@ -132,7 +132,7 @@
</tr>
</table>
<script>
- cumin.client.listeners["{id}.general"] = updateMeasurements;
+ cumin.client.listeners["{id}.general"] = updateStats;
</script>
[StatisticsHistory.html]
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/exchange.py 2007-12-03 19:28:17 UTC (rev 1418)
@@ -3,7 +3,7 @@
from wooly.forms import *
from wooly.resources import *
-from measurement import *
+from stat import *
from model import *
from widgets import *
from parameters import *
@@ -141,7 +141,7 @@
return fmt_rate(value, "byte", "sec")
def render_bytes_dropped(self, session, exchange):
- return self.app.cmodel.exchange.get_stat("byteDrops").value(exchange)
+ return self.app.model.exchange.get_stat("byteDrops").value(exchange)
class ExchangeView(Widget):
def __init__(self, app, name):
@@ -343,7 +343,7 @@
def __init__(self, app, name):
super(ExchangeStatistics.StatisticsCurrent, self).__init__(app, name)
- self.add_child(MeasurementSet(app, "general", "general"))
+ self.add_child(StatSet(app, "general", "general"))
def get_title(self, session, exchange):
return "Current"
Modified: mgmt/cumin/python/cumin/exchange.strings
===================================================================
--- mgmt/cumin/python/cumin/exchange.strings 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/exchange.strings 2007-12-03 19:28:17 UTC (rev 1418)
@@ -200,7 +200,7 @@
</tr>
</table>
<script>
- cumin.exchange.listeners["{id}.general"] = updateMeasurements;
+ cumin.exchange.listeners["{id}.general"] = updateStats;
</script>
[StatisticsHistory.html]
Deleted: mgmt/cumin/python/cumin/measurement.py
===================================================================
--- mgmt/cumin/python/cumin/measurement.py 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/measurement.py 2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,66 +0,0 @@
-from wooly import *
-from wooly.widgets import *
-from mint import *
-
-from widgets import *
-from parameters import *
-from util import *
-from formats import *
-
-strings = StringCatalog(__file__)
-
-class MeasurementSet(ItemSet):
- unit_abbrevs = dict()
- unit_abbrevs["message"] = "msg"
- unit_abbrevs["transaction"] = "trans"
-
- def __init__(self, app, name, category):
- super(MeasurementSet, self).__init__(app, name)
-
- self.category = category
-
- self.object = Attribute(app, "object");
- self.add_attribute(self.object);
-
- def do_get_items(self, session, object):
- stats = list()
- cls = self.app.model.get_class(object)
-
- for stat in cls.stats:
- if self.category in stat.categories:
- stats.append((stat, object))
-
- return stats
-
- def render_item_title(self, session, args):
- stat, object = args
- return stat.title
-
- def render_item_name(self, session, args):
- stat, object = args
- return stat.name
-
- def render_item_value(self, session, args):
- stat, object = args
-
- if stat.link_cb:
- branch = session.branch()
- stat.link_cb(self.page(), branch, object)
- return fmt_link(branch.marshal(), stat.value(object))
- else:
- return stat.value(object)
-
- def render_item_extra(self, session, args):
- stat, object = args
-
- if False and stat.highlow: #XXX
- return "<small>high</small> <span>%i</span> " + \
- "<small>low</small> <span>%i</span>" \
- % (stat.high(object) or 0, stat.low(object) or 0)
- else:
- unit = self.unit_abbrevs.get(stat.unit, stat.unit)
- return fmt_rate(stat.rate(object), unit, "sec")
-
- def render_item_average(self, session, args):
- stat, object = args
- return None #XXX "%0.2f" % (sum(measure.values) / float(len(measure.values)))
Deleted: mgmt/cumin/python/cumin/measurement.strings
===================================================================
--- mgmt/cumin/python/cumin/measurement.strings 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/measurement.strings 2007-12-03 19:28:17 UTC (rev 1418)
@@ -1,52 +0,0 @@
-[MeasurementSet.javascript]
-function updateMeasurements(id, object) {
- var table = wooly.doc().elembyid(id)
- var trs = table.elem("tbody").elems("tr");
- var tr = trs.next();
-
- while (tr) {
- var attr = tr.getattr("stat");
-
- if (attr) {
- var stat = object.stat[attr];
- var tds = tr.elems("td", null, null, 0, 2);
-
- tds.next().text().set(stat.value);
-
- var td = tds.next();
-
- var phs = td.elems("span", null, null, 0, 2);
- var ph = phs.next();
-
- if (ph) {
- ph.set(stat.high);
-
- ph = phs.next();
-
- ph.set(stat.low);
- } else {
- td.text().set(stat.rate);
- }
- }
-
- tr = trs.next();
- }
-}
-
-[MeasurementSet.html]
-<table id="{id}" class="mobjects">
- <tr>
- <th style="width: 45%;">Statistic</th>
- <th style="width: 20%;" class="ralign">Current</th>
- <th style="width: 35%;" class="ralign"></th>
- </tr>
-
- {items}
-</table>
-
-[MeasurementSet.item_html]
-<tr stat="{item_name}">
- <th>{item_title}</th>
- <td class="ralign"> {item_value}</td>
- <td class="ralign"> {item_extra}</td>
-</tr>
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/queue.py 2007-12-03 19:28:17 UTC (rev 1418)
@@ -6,7 +6,7 @@
from datetime import datetime
from exchange import ExchangeInputSet
-from measurement import *
+from stat import *
from widgets import *
from parameters import *
from formats import *
@@ -451,14 +451,11 @@
def __init__(self, app, name):
super(QueueStatistics.StatisticsCurrent, self).__init__(app, name)
- self.add_child(MeasurementSet(app, "general", "general"))
- self.add_child(MeasurementSet(app, "disk", "disk"))
- self.add_child(MeasurementSet \
- (app, "transactional", "transactional"))
- self.add_child(MeasurementSet \
- (app, "persistent", "persistent"))
- self.add_child(MeasurementSet \
- (app, "transaction", "transaction"))
+ self.add_child(StatSet(app, "general", "general"))
+ self.add_child(StatSet(app, "disk", "disk"))
+ self.add_child(StatSet(app, "transactional", "transactional"))
+ self.add_child(StatSet(app, "persistent", "persistent"))
+ self.add_child(StatSet(app, "transaction", "transaction"))
def get_title(self, session, queue):
return "Current"
Modified: mgmt/cumin/python/cumin/queue.strings
===================================================================
--- mgmt/cumin/python/cumin/queue.strings 2007-12-03 19:11:22 UTC (rev 1417)
+++ mgmt/cumin/python/cumin/queue.strings 2007-12-03 19:28:17 UTC (rev 1418)
@@ -257,10 +257,10 @@
</tr>
</table>
<script>
- cumin.queue.listeners["{id}.general"] = updateMeasurements;
- cumin.queue.listeners["{id}.persistent"] = updateMeasurements;
- cumin.queue.listeners["{id}.transactional"] = updateMeasurements;
- cumin.queue.listeners["{id}.transaction"] = updateMeasurements;
+ cumin.queue.listeners["{id}.general"] = updateStats;
+ cumin.queue.listeners["{id}.persistent"] = updateStats;
+ cumin.queue.listeners["{id}.transactional"] = updateStats;
+ cumin.queue.listeners["{id}.transaction"] = updateStats;
</script>
[StatisticsHistory.html]
Copied: mgmt/cumin/python/cumin/stat.py (from rev 1417, mgmt/cumin/python/cumin/measurement.py)
===================================================================
--- mgmt/cumin/python/cumin/stat.py (rev 0)
+++ mgmt/cumin/python/cumin/stat.py 2007-12-03 19:28:17 UTC (rev 1418)
@@ -0,0 +1,66 @@
+from wooly import *
+from wooly.widgets import *
+from mint import *
+
+from widgets import *
+from parameters import *
+from util import *
+from formats import *
+
+strings = StringCatalog(__file__)
+
+class StatSet(ItemSet):
+ unit_abbrevs = dict()
+ unit_abbrevs["message"] = "msg"
+ unit_abbrevs["transaction"] = "trans"
+
+ def __init__(self, app, name, category):
+ super(StatSet, self).__init__(app, name)
+
+ self.category = category
+
+ self.object = Attribute(app, "object");
+ self.add_attribute(self.object);
+
+ def do_get_items(self, session, object):
+ stats = list()
+ cls = self.app.model.get_class(object)
+
+ for stat in cls.stats:
+ if self.category in stat.categories:
+ stats.append((stat, object))
+
+ return stats
+
+ def render_item_title(self, session, args):
+ stat, object = args
+ return stat.title
+
+ def render_item_name(self, session, args):
+ stat, object = args
+ return stat.name
+
+ def render_item_value(self, session, args):
+ stat, object = args
+
+ if stat.link_cb:
+ branch = session.branch()
+ stat.link_cb(self.page(), branch, object)
+ return fmt_link(branch.marshal(), stat.value(object))
+ else:
+ return stat.value(object)
+
+ def render_item_extra(self, session, args):
+ stat, object = args
+
+ if False and stat.highlow: #XXX
+ return "<small>high</small> <span>%i</span> " + \
+ "<small>low</small> <span>%i</span>" \
+ % (stat.high(object) or 0, stat.low(object) or 0)
+ else:
+ unit = self.unit_abbrevs.get(stat.unit, stat.unit)
+ return fmt_rate(stat.rate(object), unit, "sec")
+
+ def render_item_average(self, session, args):
+ stat, object = args
+ return None #XXX "%0.2f" % (sum(stat.values) / float(len(stat.values)))
Copied: mgmt/cumin/python/cumin/stat.strings (from rev 1403, mgmt/cumin/python/cumin/measurement.strings)
===================================================================
--- mgmt/cumin/python/cumin/stat.strings (rev 0)
+++ mgmt/cumin/python/cumin/stat.strings 2007-12-03 19:28:17 UTC (rev 1418)
@@ -0,0 +1,52 @@
+[StatSet.javascript]
+function updateStats(id, object) {
+ var table = wooly.doc().elembyid(id)
+ var trs = table.elem("tbody").elems("tr");
+ var tr = trs.next();
+
+ while (tr) {
+ var attr = tr.getattr("stat");
+
+ if (attr) {
+ var stat = object.stat[attr];
+ var tds = tr.elems("td", null, null, 0, 2);
+
+ tds.next().text().set(stat.value);
+
+ var td = tds.next();
+
+ var phs = td.elems("span", null, null, 0, 2);
+ var ph = phs.next();
+
+ if (ph) {
+ ph.set(stat.high);
+
+ ph = phs.next();
+
+ ph.set(stat.low);
+ } else {
+ td.text().set(stat.rate);
+ }
+ }
+
+ tr = trs.next();
+ }
+}
+
+[StatSet.html]
+<table id="{id}" class="mobjects">
+ <tr>
+ <th style="width: 45%;">Statistic</th>
+ <th style="width: 20%;" class="ralign">Current</th>
+ <th style="width: 35%;" class="ralign"></th>
+ </tr>
+
+ {items}
+</table>
+
+[StatSet.item_html]
+<tr stat="{item_name}">
+ <th>{item_title}</th>
+ <td class="ralign"> {item_value}</td>
+ <td class="ralign"> {item_extra}</td>
+</tr>
18 years, 4 months
rhmessaging commits: r1417 - in mgmt/cumin: python/cumin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2007-12-03 14:11:22 -0500 (Mon, 03 Dec 2007)
New Revision: 1417
Modified:
mgmt/cumin/bin/cumin-test
mgmt/cumin/python/cumin/__init__.py
mgmt/cumin/python/cumin/broker.py
mgmt/cumin/python/cumin/exchange.py
mgmt/cumin/python/cumin/measurement.py
mgmt/cumin/python/cumin/model.py
mgmt/cumin/python/cumin/parameters.py
mgmt/cumin/python/cumin/queue.py
mgmt/cumin/python/cumin/widgets.py
Log:
Removes all the old dummy data.
Modified: mgmt/cumin/bin/cumin-test
===================================================================
--- mgmt/cumin/bin/cumin-test 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/bin/cumin-test 2007-12-03 19:11:22 UTC (rev 1417)
@@ -65,8 +65,7 @@
from cumin.model import *
def do_main(port, bench_hits, debug=True):
- model = DummyModel()
- app = Cumin(model)
+ app = Cumin()
if debug or bench_hits:
app.enable_debug()
Modified: mgmt/cumin/python/cumin/__init__.py
===================================================================
--- mgmt/cumin/python/cumin/__init__.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/__init__.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -9,7 +9,7 @@
from mint import *
from sqlobject.main import *
-from model import DummyModel, CuminModel
+from model import CuminModel
from demo import DemoData
from page import CuminPage
from queue import QueueXmlPage, QueueChartPage
@@ -17,7 +17,7 @@
from client import ClientXmlPage, ClientChartPage
class Cumin(Application):
- def __init__(self, model):
+ def __init__(self):
super(Cumin, self).__init__()
try:
@@ -27,21 +27,10 @@
self.add_resource_dir(os.path.join(self.home, "resources"))
- self.model = model
- self.cmodel = CuminModel()
+ self.model = CuminModel()
- self.mint = MintModel()
-
- try:
- sys = System.get(1)
- except SQLObjectNotFound:
- sys = System()
- sys.set(sysId=0, idOriginal=0)
-
- self.model.sys = sys
-
for reg in BrokerRegistration.select():
- self.mint.connectToBroker(reg.host, reg.port or 5672)
+ self.model.data.connectToBroker(reg.host, reg.port or 5672)
if reg.broker is None:
pass
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/broker.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -528,7 +528,7 @@
def render_groups(self, session, index):
writer = Writer()
- for group in self.app.model.get_broker_groups():
+ for group in BrokerGroup.select():
self.group_tmpl.render(session, (index, group), writer)
return writer.to_string()
Modified: mgmt/cumin/python/cumin/exchange.py
===================================================================
--- mgmt/cumin/python/cumin/exchange.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/exchange.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -69,19 +69,19 @@
def render_item_received(self, session, exchange):
unit = self.unit.get(session)
key = unit == "b" and "byteReceives" or "msgReceives"
- value = self.app.cmodel.exchange.get_stat(key).rate(exchange)
+ value = self.app.model.exchange.get_stat(key).rate(exchange)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_routed(self, session, exchange):
unit = self.unit.get(session)
key = unit == "b" and "byteRoutes" or "msgRoutes"
- value = self.app.cmodel.exchange.get_stat(key).rate(exchange)
+ value = self.app.model.exchange.get_stat(key).rate(exchange)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_dropped(self, session, exchange):
unit = self.unit.get(session)
key = unit == "b" and "byteDrops" or "msgDrops"
- return self.app.cmodel.exchange.get_stat(key).value(exchange)
+ return self.app.model.exchange.get_stat(key).value(exchange)
def render_item_status(self, session, exchange):
return fmt_ostatus(exchange)
@@ -110,8 +110,8 @@
def get_object(self, session, object):
exchange = self.param.get(session)
# XXX
- #self.app.cmodel.get_stat(exchange, "producers").link_cb = show_producers
- #self.app.cmodel.get_stat(exchange, "bindings").link_cb = show_bindings
+ #self.app.model.get_stat(exchange, "producers").link_cb = show_producers
+ #self.app.model.get_stat(exchange, "bindings").link_cb = show_bindings
return exchange
def get_title(self, session, exchange):
@@ -122,22 +122,22 @@
return "exchange.xml?id=%i" % exchange.id
def render_messages_received(self, session, exchange):
- value = self.app.cmodel.exchange.get_stat("msgReceives").rate(exchange)
+ value = self.app.model.exchange.get_stat("msgReceives").rate(exchange)
return fmt_rate(value, "msg", "sec")
def render_messages_routed(self, session, exchange):
- value = self.app.cmodel.exchange.get_stat("msgRoutes").rate(exchange)
+ value = self.app.model.exchange.get_stat("msgRoutes").rate(exchange)
return fmt_rate(value, "msg", "sec")
def render_messages_dropped(self, session, exchange):
- return self.app.cmodel.exchange.get_stat("msgDrops").value(exchange)
+ return self.app.model.exchange.get_stat("msgDrops").value(exchange)
def render_bytes_received(self, session, exchange):
- value = self.app.cmodel.exchange.get_stat("byteReceives").rate(exchange)
+ value = self.app.model.exchange.get_stat("byteReceives").rate(exchange)
return fmt_rate(value, "byte", "sec")
def render_bytes_routed(self, session, exchange):
- value = self.app.cmodel.exchange.get_stat("byteRoutes").rate(exchange)
+ value = self.app.model.exchange.get_stat("byteRoutes").rate(exchange)
return fmt_rate(value, "byte", "sec")
def render_bytes_dropped(self, session, exchange):
@@ -271,17 +271,12 @@
def process_submit(self, session, vhost):
if self.validate(session):
- exchange = Exchange(self.app.model)
+ exchange = Exchange()
+ exchange.name = self.exchange_name.get(session)
+ exchange.type = self.type.get(session)
- exchange.lock()
- try:
- exchange.name = self.exchange_name.get(session)
- exchange.type = self.type.get(session)
- finally:
- exchange.unlock()
+ vhost.addExchange(exchange)
- vhost.add_exchange(exchange)
-
branch = session.branch()
self.page().show_exchange(branch, exchange).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
Modified: mgmt/cumin/python/cumin/measurement.py
===================================================================
--- mgmt/cumin/python/cumin/measurement.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/measurement.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -24,7 +24,7 @@
def do_get_items(self, session, object):
stats = list()
- cls = self.app.cmodel.get_class(object)
+ cls = self.app.model.get_class(object)
for stat in cls.stats:
if self.category in stat.categories:
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/model.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -1,11 +1,12 @@
-import mint
+from mint import *
from wooly import *
-from wooly.model import *
from util import *
-class CuminModel(object):
+class CuminModel():
def __init__(self):
+ self.data = MintModel()
+
self.classes = dict()
self.queue = CuminQueue(self)
@@ -105,9 +106,9 @@
class CuminQueue(CuminClass):
def __init__(self, model):
- super(CuminQueue, self).__init__(model, "queue", mint.Queue)
+ super(CuminQueue, self).__init__(model, "queue", Queue)
- self.mint_stats_class = mint.QueueStats
+ self.mint_stats_class = QueueStats
stat = CuminStat(self, "consumers", "int")
stat.title = "Consumers"
@@ -270,9 +271,9 @@
class CuminExchange(CuminClass):
def __init__(self, model):
- super(CuminExchange, self).__init__(model, "exchange", mint.Exchange)
+ super(CuminExchange, self).__init__(model, "exchange", Exchange)
- self.mint_stats_class = mint.ExchangeStats
+ self.mint_stats_class = ExchangeStats
stat = CuminStat(self, "producers", "int")
stat.title = "Producers"
@@ -324,794 +325,3 @@
self.write_stat_xml(exchange, writer)
writer.write("</exchange>")
-
-class DummyModel(Model):
- def __init__(self):
- super(DummyModel, self).__init__()
-
- self.broker = ModelClass(self, "broker")
- self.broker_cluster = ModelClass(self, "broker_cluster")
- self.broker_profile = ModelClass(self, "broker_profile")
- self.config_property = ModelClass(self, "config_property")
- self.broker_group = ModelClass(self, "broker_group")
- self.broker_group_type = ModelClass(self, "broker_group_type")
- self.virtual_host = ModelClass(self, "virtual_host")
- self.virtual_host_group = ModelClass(self, "virtual_host_group")
- self.queue = ModelClass(self, "queue")
- self.consumer = ModelClass(self, "consumer")
- self.exchange = ModelClass(self, "exchange")
- self.producer = ModelClass(self, "producer")
- self.client = ModelClass(self, "client")
- self.session = ModelClass(self, "session")
- self.realm = ModelClass(self, "realm")
- self.binding = ModelClass(self, "binding")
-
- assoc = ModelAssociation(self, "broker_cluster_to_brokers")
- assoc.add_endpoint(self.broker, "broker_cluster", "0..1")
- assoc.add_endpoint(self.broker_cluster, "broker", "0..n")
-
- assoc = ModelAssociation(self, "broker_profile_to_brokers")
- assoc.add_endpoint(self.broker, "broker_profile", "0..1")
- assoc.add_endpoint(self.broker_profile, "broker", "0..n")
-
- assoc = ModelAssociation(self, "broker_profile_to_config_properties")
- assoc.add_endpoint(self.config_property, "broker_profile", "0..1")
- assoc.add_endpoint(self.broker_profile, "config_property", "0..n")
-
- assoc = ModelAssociation(self, "broker_cluster_to_virtual_hosts")
- assoc.add_endpoint(self.virtual_host, "broker_cluster", "0..1")
- assoc.add_endpoint(self.broker_cluster, "virtual_host", "0..n")
-
- assoc = ModelAssociation(self, "broker_to_config_properties")
- assoc.add_endpoint(self.config_property, "broker", "0..1")
- assoc.add_endpoint(self.broker, "config_property", "0..n")
-
- assoc = ModelAssociation(self, "broker_to_virtual_hosts")
- assoc.add_endpoint(self.virtual_host, "broker", "0..1")
- assoc.add_endpoint(self.broker, "virtual_host", "0..n")
-
- assoc = ModelAssociation(self, "broker_groups_to_brokers")
- assoc.add_endpoint(self.broker, "broker_group", "0..n")
- assoc.add_endpoint(self.broker_group, "broker", "0..n")
-
- assoc = ModelAssociation(self, "broker_groups_to_broker_group_type")
- assoc.add_endpoint(self.broker_group_type, "broker_group", "0..n")
- assoc.add_endpoint(self.broker_group, "type", "0..1")
-
- assoc = ModelAssociation(self, "broker_groups_to_broker_groups")
- assoc.add_endpoint(self.broker_group, "parent", "0..n")
- assoc.add_endpoint(self.broker_group, "child", "0..n")
-
- assoc = ModelAssociation(self, "virtual_host_groups_to_virtual_hosts")
- assoc.add_endpoint(self.virtual_host, "virtual_host_group", "0..n")
- assoc.add_endpoint(self.virtual_host_group, "virtual_host", "0..n")
-
- assoc = ModelAssociation \
- (self, "virtual_host_groups_to_virtual_host_groups")
- assoc.add_endpoint(self.virtual_host_group, "parent", "0..n")
- assoc.add_endpoint(self.virtual_host_group, "child", "0..n")
-
- assoc = ModelAssociation(self, "virtual_host_to_queues")
- assoc.add_endpoint(self.virtual_host, "queue", "0..n")
- assoc.add_endpoint(self.queue, "virtual_host", "0..1")
-
- assoc = ModelAssociation(self, "queue_to_consumers")
- assoc.add_endpoint(self.queue, "consumer", "0..n")
- assoc.add_endpoint(self.consumer, "queue", "0..1")
-
- assoc = ModelAssociation(self, "virtual_host_to_exchanges")
- assoc.add_endpoint(self.virtual_host, "exchange", "0..n")
- assoc.add_endpoint(self.exchange, "virtual_host", "0..1")
-
- assoc = ModelAssociation(self, "exchange_to_producers")
- assoc.add_endpoint(self.exchange, "producer", "0..n")
- assoc.add_endpoint(self.producer, "exchange", "0..1")
-
- assoc = ModelAssociation(self, "virtual_host_to_clients")
- assoc.add_endpoint(self.virtual_host, "client", "0..n")
- assoc.add_endpoint(self.client, "virtual_host", "0..1")
-
- assoc = ModelAssociation(self, "client_to_sessions")
- assoc.add_endpoint(self.client, "session", "0..n")
- assoc.add_endpoint(self.session, "client", "0..1")
-
- assoc = ModelAssociation(self, "virtual_host_to_realms")
- assoc.add_endpoint(self.virtual_host, "realm", "0..n")
- assoc.add_endpoint(self.realm, "virtual_host", "0..1")
-
- assoc = ModelAssociation(self, "realms_to_queues")
- assoc.add_endpoint(self.realm, "queue", "0..n")
- assoc.add_endpoint(self.queue, "realm", "0..n")
-
- assoc = ModelAssociation(self, "realms_to_exchanges")
- assoc.add_endpoint(self.realm, "exchange", "0..n")
- assoc.add_endpoint(self.exchange, "realm", "0..n")
-
- assoc = ModelAssociation(self, "queue_to_bindings")
- assoc.add_endpoint(self.queue, "binding", "0..n")
- assoc.add_endpoint(self.binding, "queue", "0..1")
-
- assoc = ModelAssociation(self, "exchange_to_bindings")
- assoc.add_endpoint(self.exchange, "binding", "0..n")
- assoc.add_endpoint(self.binding, "exchange", "0..1")
-
- def get_broker_cluster(self, id):
- return self.get_index(self.broker_cluster).get(id)
-
- def get_broker_clusters(self):
- return self.get_index(self.broker_cluster).values()
-
- def get_broker(self, id):
- return self.get_index(self.broker).get(id)
-
- def get_brokers(self):
- return self.get_index(self.broker).values()
-
- def get_broker_profile(self, id):
- return self.get_index(self.broker_profile).get(id)
-
- def get_broker_profiles(self):
- return self.get_index(self.broker_profile).values()
-
- def get_broker_group(self, id):
- return self.get_index(self.broker_group).get(id)
-
- def get_broker_groups(self):
- return self.get_index(self.broker_group).values()
-
- def get_broker_group_type(self, id):
- return self.get_index(self.broker_group_type).get(id)
-
- def get_broker_group_types(self):
- return self.get_index(self.broker_group_type).values()
-
- def get_config_property(self, id):
- return self.get_index(self.config_property).get(id)
-
- def get_virtual_host(self, id):
- return self.get_index(self.virtual_host).get(id)
-
- def get_virtual_hosts(self):
- return self.get_index(self.virtual_host).values()
-
- def get_virtual_host_templates(self):
- return [i for i in self.get_virtual_hosts() \
- if not i.get_cluster() and not i.get_broker_cluster()]
-
- def get_virtual_host_group(self, id):
- return self.get_index(self.virtual_host_group).get(id)
-
- def get_virtual_host_groups(self):
- return self.get_index(self.virtual_host_group).values()
-
- def get_queue(self, id):
- return self.get_index(self.queue).get(id)
-
- def get_exchange(self, id):
- return self.get_index(self.exchange).get(id)
-
- def get_client(self, id):
- return self.get_index(self.client).get(id)
-
- def get_session(self, id):
- return self.get_index(self.session).get(id)
-
- def get_realm(self, id):
- return self.get_index(self.realm).get(id)
-
- def brokers(self):
- return list(mint.Broker.select())
-
-class DummyModelObject(ModelObject):
- def __init__(self, model, mclass):
- super(DummyModelObject, self).__init__(model, mclass)
-
- self.errors = list()
- self.warnings = list()
- self.measurements = list()
-
- def get_measurement(self, name):
- for measure in self.measurements:
- if measure.name == name:
- return measure
-
- def write_error_xml(self, writer):
- writer.write("<error-count>%i</error-count>" % len(self.errors))
- writer.write("<warning-count>%i</warning-count>" % len(self.warnings))
-
- def write_measurement_xml(self, writer):
- for measure in self.measurements:
- measure.write_xml(writer)
-
-class Broker(DummyModelObject):
- def __init__(self, model):
- super(Broker, self).__init__(model, model.broker)
-
- self.name = None
- self.default_virtual_host = None
-
- def write_xml(self, writer):
- writer.write("<broker id=\"broker-%i\">" % self.id)
- writer.write("<name>" + self.name + "</name>")
- writer.write("<default-virtual-host ref=\"virtual-host-%i\"/>" \
- % self.default_virtual_host.id)
-
- self.write_error_xml(writer)
-
- for vhost in self.virtual_host_items():
- vhost.write_xml(writer)
-
- writer.write("</broker>")
-
-class BrokerProfile(DummyModelObject):
- def __init__(self, model):
- super(BrokerProfile, self).__init__(model, model.broker_profile)
-
- self.name = None
-
-class ConfigProperty(ModelObject):
- def __init__(self, model):
- super(ConfigProperty, self).__init__(model, model.config_property)
-
- self.name = None
- self.value = None
- self.broker_value = None
- self.type = None # ("boolean", "integer", "string")
-
-class BrokerGroup(DummyModelObject):
- def __init__(self, model):
- super(BrokerGroup, self).__init__(model, model.broker_group)
-
- self.name = None
-
-class BrokerGroupType(ModelObject):
- def __init__(self, model):
- super(BrokerGroupType, self).__init__(model, model.broker_group_type)
-
- self.name = None
-
-class VirtualHost(DummyModelObject):
- def __init__(self, model):
- super(VirtualHost, self).__init__(model, model.virtual_host)
-
- self.name = None
-
- # XXX do this via associations? XXX this will leak a ref if
- # the default exchange is removed
-
- self.default_exchange = Exchange(model)
- self.default_exchange.name = "default"
- self.add_exchange(self.default_exchange)
-
- def add_queue(self, queue):
- self.do_add_queue(queue)
-
- # Default binding
-
- binding = Binding(self.model)
- binding.binding_key = queue.name
- binding.set_queue(queue)
- binding.set_exchange(self.default_exchange)
-
- def write_xml(self, writer):
- writer.write("<virtual-host id=\"virtual-host-%i\">" % self.id)
- writer.write("<name>%s</name>" % self.name)
- writer.write("<default-exchange ref=\"exchange-%i\"/>" \
- % self.default_exchange.id)
-
- self.write_error_xml(writer)
-
- for queue in self.queue_items():
- queue.write_xml(writer)
-
- for exchange in self.exchange_items():
- exchange.write_xml(writer)
-
- for realm in self.realm_items():
- realm.write_xml(writer)
-
- writer.write("</virtual-host>")
-
-class VirtualHostGroup(ModelObject):
- def __init__(self, model):
- super(VirtualHostGroup, self).__init__(model, model.virtual_host_group)
-
- self.name = None
-
-class Realm(DummyModelObject):
- def __init__(self, model):
- super(Realm, self).__init__(model, model.realm)
-
- self.name = None
-
- def write_xml(self, writer):
- writer.write("<realm id=\"realm-%i\">" % self.id)
- writer.write("<name>%s</name>" % self.name)
-
- self.write_error_xml(writer)
-
- for queue in self.queue_items():
- writer.write("<queue ref=\"queue-%i\"/>" % queue.id)
-
- for exchange in self.exchange_items():
- writer.write("<exchange ref=\"exchange-%i\"/>" % exchange.id)
-
- writer.write("</realm>")
-
-class Measurement(object):
- def __init__(self, name, type, class_=None):
- self.name = name
- self.type = type
- self.categories = ()
- self.title = None
- self.unit = None
- self.__value = None
- self.__values = list()
- self.class_ = class_
- self.link_cb = None
-
- self.highlow = False
- self.__high = None
- self.__low = None
-
- if type == "int":
- self.add_value(0)
-
- def add_value(self, value):
- if value == None:
- raise Exception()
-
- self.__value = value
- self.__values.append(value)
-
- if len(self.__values) > 1000:
- del self.__values[0]
-
- if self.highlow:
- if self.__high == None or self.__low == None:
- self.__high = value
- self.__low = value
- else:
- if self.__high < value:
- self.__high = value
-
- if self.__low > value:
- self.__low = value
-
- def get_value(self):
- return self.__value
-
- # Get recent values, with latest value at index 0
- def get_values(self, limit=100):
- values = self.__values[-limit:]
- values.reverse()
-
- # Pad the values if there are too few
- if len(values) < limit:
- for i in range(len(values), limit):
- values.append(0)
-
- return values
-
- def get_rate(self, interval=1):
- curr, prev = self.get_values(2)
- return (curr - prev) / float(interval)
-
- def get_high(self):
- return self.__high
-
- def get_low(self):
- return self.__low
-
- def write_xml(self, writer):
- hl = ""
-
- if self.highlow:
- hl = "high=\"%i\" low=\"%i\"" % (self.get_high(), self.get_low())
-
- writer.write("<measurement name=\"%s\" value=\"%i\" rate=\"%i\" %s/>" \
- % (self.name, self.get_value(), self.get_rate(), hl))
-
-class Queue(DummyModelObject):
- def __init__(self, model):
- super(Queue, self).__init__(model, model.queue)
-
- self.name = None
- self.is_passive = False
- self.is_durable = True
- self.is_exclusive = False
- self.is_auto_delete = False
- self.latency_priority = "m" # h, m, or l
-
- # General
-
- measure = Measurement("consumers", "int")
- measure.title = "Consumers"
- measure.unit = "consumer"
- measure.categories = ("general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("bindings", "int")
- measure.title = "Bindings"
- measure.unit = "binding"
- measure.categories = ("general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("msgDepth", "int")
- measure.title = "Message Depth"
- measure.unit = "message"
- measure.categories = ("message", "general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("msgTotalEnqueues", "int")
- measure.title = "Msgs. Enqueued"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("msgTotalDequeues", "int")
- measure.title = "Msgs. Dequeued"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("byteDepth", "int")
- measure.title = "Byte Depth"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("byteTotalEnqueues", "int")
- measure.title = "Bytes Enqueued"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("byteTotalDequeues", "int")
- measure.title = "Bytes Dequeued"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("unackedMessages", "int")
- measure.title = "Msgs. Unacked"
- measure.unit = "message"
- measure.categories = ("general")
- self.measurements.append(measure)
-
- # Disk
-
- #measure = Measurement("diskPageSize", "int")
- #measure.title = "Page size"
- #measure.categories = ("disk")
- #self.measurements.append(measure)
-
- measure = Measurement("diskPages", "int")
- measure.title = "Disk Pages"
- measure.unit = "page"
- measure.categories = ("general")
- self.measurements.append(measure)
-
- #measure = Measurement("diskAvailableSize", "int")
- #measure.title = "Available size"
- #measure.categories = ("disk")
- #self.measurements.append(measure)
-
- # Transactional
-
- measure = Measurement("msgTxEnqueues", "int")
- measure.title = "Msgs. Enqueued"
- measure.unit = "message"
- measure.categories = ("message", "transactional")
- self.measurements.append(measure)
-
- measure = Measurement("msgTxDequeues", "int")
- measure.title = "Msgs. Dequeued"
- measure.unit = "message"
- measure.categories = ("message", "transactional")
- self.measurements.append(measure)
-
- measure = Measurement("byteTxEnqueues", "int")
- measure.title = "Bytes Enqueued"
- measure.unit = "byte"
- measure.categories = ("byte", "transactional")
- self.measurements.append(measure)
-
- measure = Measurement("byteTxDequeues", "int")
- measure.title = "Bytes Dequeued"
- measure.unit = "byte"
- measure.categories = ("byte", "transactional")
- self.measurements.append(measure)
-
- measure = Measurement("enqueueTxStarts", "int")
- measure.title = "Enq. Trans. Started"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("enqueueTxCommits", "int")
- measure.title = "Enq. Trans. Committed"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("enqueueTxRejects", "int")
- measure.title = "Enq. Trans. Rejected"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("enqueueTxCount", "int")
- measure.title = "Enq. Trans. Pending"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("dequeueTxStarts", "int")
- measure.title = "Deq. Trans. Started"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("dequeueTxCommits", "int")
- measure.title = "Deq. Trans. Committed"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("dequeueTxRejects", "int")
- measure.title = "Deq. Trans. Rejected"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- self.measurements.append(measure)
-
- measure = Measurement("dequeueTxCount", "int")
- measure.title = "Deq. Trans. Pending"
- measure.unit = "transaction"
- measure.categories = ("transaction")
- measure.highlow = True
- self.measurements.append(measure)
-
- # Persistent
-
- measure = Measurement("msgPersistEnqueues", "int")
- measure.title = "Msgs. Enqueued"
- measure.unit = "message"
- measure.categories = ("message", "persistent")
- self.measurements.append(measure)
-
- measure = Measurement("msgPersistDequeues", "int")
- measure.title = "Msgs. Dequeued"
- measure.unit = "message"
- measure.categories = ("message", "persistent")
- self.measurements.append(measure)
-
- measure = Measurement("bytePersistEnqueues", "int")
- measure.title = "Bytes Enqueued"
- measure.unit = "byte"
- measure.categories = ("byte", "persistent")
- self.measurements.append(measure)
-
- measure = Measurement("bytePersistDequeues", "int")
- measure.title = "Bytes Dequeued"
- measure.unit = "byte"
- measure.categories = ("byte", "persistent")
- self.measurements.append(measure)
-
- def remove(self):
- for binding in self.binding_items().copy():
- binding.remove()
-
- super(Queue, self).remove()
-
- def purge(self):
- pass
-
- def write_xml(self, writer):
- writer.write("<queue id=\"queue-%i\">" % self.id)
- writer.write("<name>%s</name>" % self.name)
-
- self.write_error_xml(writer)
- self.write_measurement_xml(writer)
-
- writer.write("</queue>")
-
-class Consumer(DummyModelObject):
- def __init__(self, model):
- super(Consumer, self).__init__(model, model.consumer)
-
- self.name = None
-
- measure = Measurement("msgsConsumed", "int")
- measure.title = "Msgs. Consumed"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("bytesConsumed", "int")
- measure.title = "Bytes Consumed"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("unackedMessages", "int")
- measure.title = "Msgs. Unacked"
- measure.unit = "message"
- measure.categories = ("message", "general")
- measure.highlow = True
- self.measurements.append(measure)
-
-class Exchange(DummyModelObject):
- def __init__(self, model):
- super(Exchange, self).__init__(model, model.exchange)
-
- self.name = None
- self.type = "direct" # in ("direct", "topic", "fanout")
- self.is_passive = False
- self.is_durable = True
- self.is_auto_delete = False
- self.is_internal = False
-
- measure = Measurement("producers", "int")
- measure.title = "Producers"
- measure.unit = "producer"
- measure.categories = ("general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("bindings", "int")
- measure.title = "Bindings"
- measure.unit = "binding"
- measure.categories = ("general")
- measure.highlow = True
- self.measurements.append(measure)
-
- measure = Measurement("msgReceives", "int")
- measure.title = "Msgs. Received"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("msgDrops", "int")
- measure.title = "Msgs. Dropped"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("msgRoutes", "int")
- measure.title = "Msgs. Routed"
- measure.unit = "message"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("byteReceives", "int")
- measure.title = "Bytes Received"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("byteDrops", "int")
- measure.title = "Bytes Dropped"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("byteRoutes", "int")
- measure.title = "Bytes Routed"
- measure.unit = "byte"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- def remove(self):
- for binding in self.binding_items().copy():
- binding.remove()
-
- super(Exchange, self).remove()
-
- def write_xml(self, writer):
- writer.write("<exchange id=\"exchange-%i\">" % self.id)
- writer.write("<name>%s</name>" % self.name)
-
- self.write_error_xml(writer)
- self.write_measurement_xml(writer)
-
- writer.write("</exchange>")
-
-class Producer(DummyModelObject):
- def __init__(self, model):
- super(Producer, self).__init__(model, model.producer)
-
- self.name = None
-
- measure = Measurement("msgsProduced", "int")
- measure.title = "Msgs. Produced"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("bytesProduced", "int")
- measure.title = "Bytes Produced"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
-class Binding(DummyModelObject):
- def __init__(self, model):
- super(Binding, self).__init__(model, model.binding)
-
- self.binding_key = None
-
- measure = Measurement("msgMatched", "int")
- measure.title = "Msgs. Matched"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- def write_xml(self, writer):
- writer.write("<binding id=\"binding-%i\">" % self.id)
- writer.write("<exchange ref=\"exchange-%i\"/>" % self.exchange.id)
- writer.write("<queue ref=\"queue-%i\"/>" % self.queue.id)
- writer.write("<binding-key>%s</binding-key>" % self.binding_key)
-
- self.write_error_xml(writer)
- self.write_measurement_xml(writer)
-
- writer.write("</binding>")
-
-class Client(DummyModelObject):
- def __init__(self, model):
- super(Client, self).__init__(model, model.client)
-
- self.address = None
-
- measure = Measurement("msgsProduced", "int")
- measure.title = "Msgs. Produced"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("msgsConsumed", "int")
- measure.title = "Msgs. Consumed"
- measure.categories = ("message", "general")
- self.measurements.append(measure)
-
- measure = Measurement("bytesProduced", "int")
- measure.title = "Bytes Produced"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- measure = Measurement("bytesConsumed", "int")
- measure.title = "Bytes Consumed"
- measure.categories = ("byte", "general")
- self.measurements.append(measure)
-
- def write_xml(self, writer):
- writer.write("<client id=\"client-%i\">" % self.id)
- writer.write("<address>%s</address>" % self.address)
-
- self.write_error_xml(writer)
- self.write_measurement_xml(writer)
-
- writer.write("</client>")
-
-class Session(DummyModelObject):
- def __init__(self, model):
- super(Session, self).__init__(model, model.session)
-
- self.name = None
-
- measure = Measurement("attached", "bool")
- measure.title = "Attached"
- measure.categories = ("general")
- self.measurements.append(measure)
-
- measure = Measurement("remainingLifespan", "int")
- measure.title = "Remaining lifespan"
- measure.categories = ("general")
- self.measurements.append(measure)
-
- measure = Measurement("framesOutstanding", "int")
- measure.title = "Frames outstanding"
- measure.categories = ("general")
- self.measurements.append(measure)
Modified: mgmt/cumin/python/cumin/parameters.py
===================================================================
--- mgmt/cumin/python/cumin/parameters.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/parameters.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -38,7 +38,7 @@
class ConfigPropertyParameter(Parameter):
def do_unmarshal(self, string):
- return self.app.model.get_config_property(int(string))
+ return ConfigProperty.get(int(string))
def do_marshal(self, prop):
return str(prop.id)
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/queue.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -1,3 +1,4 @@
+from mint import *
from wooly import *
from wooly.widgets import *
from wooly.forms import *
@@ -58,23 +59,23 @@
def render_item_enqueued(self, session, queue):
unit = self.unit.get(session)
key = unit == "b" and "byteTotalEnqueues" or "msgTotalEnqueues"
- value = self.app.cmodel.queue.get_stat(key).rate(queue)
+ value = self.app.model.queue.get_stat(key).rate(queue)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_dequeued(self, session, queue):
unit = self.unit.get(session)
key = unit == "b" and "byteTotalDequeues" or "msgTotalDequeues"
- value = self.app.cmodel.queue.get_stat(key).rate(queue)
+ value = self.app.model.queue.get_stat(key).rate(queue)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_depth(self, session, queue):
key = self.unit.get(session) == "b" and "byteDepth" or "msgDepth"
- return self.app.cmodel.queue.get_stat(key).value(queue)
+ return self.app.model.queue.get_stat(key).value(queue)
def render_item_depth_accel(self, session, queue):
unit = self.unit.get(session)
key = unit == "b" and "byteDepth" or "msgDepth"
- value = self.app.cmodel.queue.get_stat(key).rate(queue)
+ value = self.app.model.queue.get_stat(key).rate(queue)
return fmt_rate(value, unit == "b" and "byte" or "msg", "sec")
def render_item_status(self, session, queue):
@@ -118,36 +119,36 @@
class QueueStatus(CuminStatus):
def render_consumers(self, session, queue):
- return self.app.cmodel.queue.get_stat("consumers").value(queue)
+ return self.app.model.queue.get_stat("consumers").value(queue)
def render_messages_enqueued(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("msgTotalEnqueues")
+ stat = self.app.model.queue.get_stat("msgTotalEnqueues")
return fmt_rate(stat.rate(queue), "msg", "sec")
def render_messages_dequeued(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("msgTotalDequeues")
+ stat = self.app.model.queue.get_stat("msgTotalDequeues")
return fmt_rate(stat.rate(queue), "msg", "sec")
def render_message_depth(self, session, queue):
- return self.app.cmodel.queue.get_stat("msgDepth").value(queue)
+ return self.app.model.queue.get_stat("msgDepth").value(queue)
def render_message_depth_accel(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("msgDepth")
+ stat = self.app.model.queue.get_stat("msgDepth")
return fmt_rate(stat.rate(queue), "msg", "sec")
def render_bytes_enqueued(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("byteTotalEnqueues")
+ stat = self.app.model.queue.get_stat("byteTotalEnqueues")
return fmt_rate(stat.rate(queue), "byte", "sec")
def render_bytes_dequeued(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("byteTotalDequeues")
+ stat = self.app.model.queue.get_stat("byteTotalDequeues")
return fmt_rate(stat.rate(queue), "byte", "sec")
def render_byte_depth(self, session, queue):
- return self.app.cmodel.queue.get_stat("byteDepth").value(queue)
+ return self.app.model.queue.get_stat("byteDepth").value(queue)
def render_byte_depth_accel(self, session, queue):
- stat = self.app.cmodel.queue.get_stat("byteDepth")
+ stat = self.app.model.queue.get_stat("byteDepth")
return fmt_rate(stat.rate(queue), "byte", "sec")
class QueueView(Widget):
@@ -271,21 +272,15 @@
class QueueAdd(QueueForm):
def process_cancel(self, session, vhost):
branch = session.branch()
- self.page().show_broker(branch, vhost.get_broker()).show_view(branch)
+ self.page().show_broker(branch, vhost.broker).show_view(branch)
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, vhost):
if self.validate(session):
- queue = Queue(self.app.model)
+ queue = Queue()
+ queue.name = self.queue_name.get(session)
- queue.lock()
- try:
- queue.name = self.queue_name.get(session)
- queue.latency_priority = self.latency_priority.get(session)
- finally:
- queue.unlock()
-
- vhost.add_queue(queue)
+ vhost.addQueue(queue)
branch = session.branch()
self.page().show_queue(branch, queue).show_view(branch)
@@ -359,7 +354,7 @@
def process_submit(self, session, queue):
print "open purge"
- queue.mintVhost.mintBroker.echo(self.app.mint, doit, 1, "dude!")
+ queue.vhost.broker.echo(self.app.model.data, doit, 1, "dude!")
print "close purge"
@@ -408,16 +403,14 @@
def process_submit(self, session, queue):
if self.validate(session):
- binding = Binding(self.app.model)
+ binding = Binding()
- binding.lock()
- try:
- binding.binding_key = self.binding_key.get(session)
- binding.set_queue(queue)
- binding.set_exchange(self.exchanges.get(session))
- finally:
- binding.unlock()
+ binding.binding_key = self.binding_key.get(session)
+ # XXX uh huh
+ binding.set_queue(queue)
+ binding.set_exchange(self.exchanges.get(session))
+
self.process_cancel(session, queue)
class Exchanges(ExchangeInputSet):
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-12-03 17:08:41 UTC (rev 1416)
+++ mgmt/cumin/python/cumin/widgets.py 2007-12-03 19:11:22 UTC (rev 1417)
@@ -174,7 +174,7 @@
def do_render(self, session, object):
chart = LineChart(600, 120)
- cls = self.app.cmodel.get_class(object)
+ cls = self.app.model.get_class(object)
stats = [cls.get_stat(x) for x in self.stats.get(session)]
samples = stats[0].samples(object, 121)
@@ -227,7 +227,7 @@
writer.write("<objects>");
for object in objects:
- cls = self.app.cmodel.get_class(object)
+ cls = self.app.model.get_class(object)
cls.write_xml(object, writer)
writer.write("</objects>");
18 years, 4 months