rhmessaging commits: r1669 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-09 13:09:06 -0500 (Sat, 09 Feb 2008)
New Revision: 1669
Modified:
mgmt/cumin/python/cumin/util.py
Log:
Add a function to parse a broker address string.
Stop using non existent exception classes.
Modified: mgmt/cumin/python/cumin/util.py
===================================================================
--- mgmt/cumin/python/cumin/util.py 2008-02-09 18:07:59 UTC (rev 1668)
+++ mgmt/cumin/python/cumin/util.py 2008-02-09 18:09:06 UTC (rev 1669)
@@ -23,6 +23,16 @@
if dt is not None:
return mktime(dt.timetuple())
+def parse_broker_addr(string):
+ addr = string.split(":")
+
+ if len(addr) > 1:
+ host, port = addr[0], int(addr[1])
+ else:
+ host, port = addr[0], 5672
+
+ return host, port
+
class Identifiable(object):
def __init__(self, id=None):
self.id = id
@@ -53,13 +63,13 @@
elif type == "s":
value = string
else:
- raise Error("Invalid type '%s'" % type)
+ raise Exception("Invalid type '%s'" % type)
return value
def get(self, name):
if name not in self.__params:
- raise Error("Parameter '%s' not found" % name)
+ raise Exception("Parameter '%s' not found" % name)
type, default = self.__param_specs[name]
16 years, 11 months
rhmessaging commits: r1668 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-09 13:07:59 -0500 (Sat, 09 Feb 2008)
New Revision: 1668
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Quiet a print debug.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-02-09 18:06:18 UTC (rev 1667)
+++ mgmt/cumin/python/cumin/model.py 2008-02-09 18:07:59 UTC (rev 1668)
@@ -91,20 +91,20 @@
def completion(status, args=None):
invoc.status = status
invoc.args = args
- invoc.prt()
+ #invoc.prt()
try:
try:
self.do_invoke(object, args, completion)
except Exception, e:
invoc.status = "failed"
- invoc.exception = e;
+ invoc.exception = e
print_exc();
finally:
self.model.invocations.add(invoc)
- invoc.prt()
+ #invoc.prt()
return invoc
16 years, 11 months
rhmessaging commits: r1667 - in mgmt: cumin/python/cumin and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-09 13:06:18 -0500 (Sat, 09 Feb 2008)
New Revision: 1667
Added:
mgmt/cumin/python/cumin/quirk.py
Modified:
mgmt/bin/quirk
Log:
Moves the wrapper classes from quirk to cumin/quirk.py so I can use
them as library code.
Changes those classes to support static broker object configuration on
the client side.
Updates bin/quirk to the new interfaces.
Modified: mgmt/bin/quirk
===================================================================
--- mgmt/bin/quirk 2008-02-08 18:12:41 UTC (rev 1666)
+++ mgmt/bin/quirk 2008-02-09 18:06:18 UTC (rev 1667)
@@ -4,141 +4,34 @@
from time import sleep
from random import random, sample, randint
-class Exchange(object):
- def __init__(self, session, name):
- self.session = session
- self.name = name
- self.type = "direct"
+from cumin.quirk import *
- def declare(self):
- self.session.psession.exchange_declare(exchange=self.name,
- type=self.type)
-
- def exists(self):
- return False #XXX figure out how to do this
-
-class Queue(object):
- def __init__(self, session, name):
- self.session = session
- self.name = name
-
- def declare(self):
- self.session.psession.queue_declare(queue=self.name)
-
- def exists(self):
- return False #XXX figure out how to do this
-
- def bind(self, exchange, binding_key=None):
- if binding_key is None:
- binding_key = self.name
-
- self.session.psession.queue_bind(exchange=exchange.name,
- queue=self.name,
- routing_key=binding_key)
-
-class Subscription(object):
- def __init__(self, session, queue):
- self.session = session
- self.name = queue.name # XXX bad?
- self.queue = queue
-
- session.psession.message_subscribe(queue=queue.name,
- destination=self.name)
-
- session.psession.message_flow(self.name, 0, 0xFFFFFFFF)
- session.psession.message_flow(self.name, 1, 0xFFFFFFFF)
-
- self.client_queue = session.client.pclient.queue(self.name)
-
- def get(self):
- m = self.session.message()
- m.content = self.client_queue.get(timeout=10).content
- return m
-
-class Message(object):
- def __init__(self, session):
- self.session = session
-
- def set(self, payload):
- self.content = qpid.content.Content(payload)
- self.content["content_type"] = "text/plain"
-
- def send(self, dest, routing_key=None):
- if dest.__class__ is Queue:
- self.content["routing_key"] = dest.name
- self.session.psession.message_transfer(destination="",
- content=self.content)
- elif dest.__class__ is Exchange:
- if routing_key is None:
- raise Exception("Routing key not set")
-
- self.session.psession.message_transfer(destination=dest.name,
- content=self.content)
- else:
- raise Exception("Unknown destination object")
-
- def __str__(self):
- return self.content.body
-
-class Client(object):
- def __init__(self, host, port):
- self.pclient = qpid.client.Client(host, port)
-
- def session(self):
- return Session(self)
-
- def login(self, user, password):
- self.pclient.start({"LOGIN": user, "PASSWORD": password})
-
-class Session(object):
- def __init__(self, client):
- self.client = client
- self.psession = client.pclient.session()
-
- def open(self):
- self.psession.open()
-
- def close(self):
- self.psession.close()
-
- def exchange(self, name):
- return Exchange(self, name)
-
- def queue(self, name):
- return Queue(self, name)
-
- def subscribe(self, queue):
- return Subscription(self, queue)
-
- def message(self):
- return Message(self)
-
class TestCommand(object):
def __init__(self, name):
self.name = name
def run(self, client):
- session = client.session()
+ session = Session(client)
session.open()
try:
- q = session.queue("quirk.test")
+ q = Queue("quirk.test")
- if not q.exists():
- q.declare()
+ if not q.exists(session):
+ q.declare(session)
- s = session.subscribe(q)
+ s = Subscription(q)
+ s.init(session)
for i in range(0, 10):
print i,
- m = session.message()
- m.set("message %i" % i)
- m.send(q)
+ m = Message("message %i" % i)
+ m.send(session, q)
print "Sent", m
for i in range(0, 10):
print i,
- m = s.get()
+ m = s.get(session)
print "Received", m
finally:
session.close()
@@ -148,23 +41,22 @@
self.name = name
def run(self, client):
- session = client.session()
+ session = Session(client)
session.open()
try:
- q = session.queue("quirk.bench")
+ q = Queue("quirk.bench")
- if not q.exists():
- q.declare()
+ if not q.exists(session):
+ q.declare(session)
- s = session.subscribe(q)
+ s = Subscription(q)
i = 0
while True:
- m = session.message()
- m.set(str(i))
- m.send(q)
+ m = Message(str(i))
+ m.send(session, q)
if i % 1000 == 0:
print ".",
@@ -178,7 +70,7 @@
self.name = name
def run(self, client):
- session = client.session()
+ session = Session(client)
session.open()
qs = list()
@@ -188,13 +80,13 @@
for i in range(0, 30):
name = "demo%02i" % (i + 1)
- q = session.queue(name)
- q.declare()
+ q = Queue(name)
+ q.declare(session)
qs.append(q)
- e = session.exchange(name)
- e.declare()
+ e = Exchange(name)
+ e.declare(session)
es.append(e)
@@ -202,9 +94,8 @@
sqs = sample(qs, 5)
for q in sqs:
- m = session.message()
- m.set("test")
- m.send(q)
+ m = Message("test")
+ m.send(session, q)
sleep(1)
Added: mgmt/cumin/python/cumin/quirk.py
===================================================================
--- mgmt/cumin/python/cumin/quirk.py (rev 0)
+++ mgmt/cumin/python/cumin/quirk.py 2008-02-09 18:06:18 UTC (rev 1667)
@@ -0,0 +1,104 @@
+import sys, qpid
+from time import sleep
+from random import random, sample, randint
+
+class Exchange(object):
+ def __init__(self, name, type="direct"):
+ self.name = name
+ self.type = type
+
+ def declare(self, session):
+ session.psession.exchange_declare(exchange=self.name, type=self.type)
+
+ def exists(self, session):
+ return False #XXX figure out how to do this
+
+class Queue(object):
+ def __init__(self, name):
+ self.name = name
+
+ def declare(self, session):
+ session.psession.queue_declare(queue=self.name)
+
+ def exists(self, session):
+ return False #XXX figure out how to do this
+
+ def bind(self, session, exchange, key=None):
+ if key is None:
+ key = self.name
+
+ session.psession.queue_bind(exchange=exchange.name,
+ queue=self.name,
+ routing_key=key)
+
+class Subscription(object):
+ def __init__(self, queue):
+ self.name = queue.name # XXX bad?
+ self.queue = queue
+ self.client_queue = None
+
+ def init(self, session):
+ session.psession.message_subscribe(queue=self.queue.name,
+ destination=self.name)
+
+ session.psession.message_flow(self.name, 0, 0xFFFFFFFF)
+ session.psession.message_flow(self.name, 1, 0xFFFFFFFF)
+
+ self.client_queue = session.client.pclient.queue(self.name)
+
+ def get(self, session):
+ if self.client_queue is None:
+ raise Exception()
+
+ m = Message()
+ m.content = self.client_queue.get(timeout=10).content
+
+ return m
+
+class Message(object):
+ def __init__(self, payload=None):
+ self.content = qpid.content.Content()
+ self.content["content_type"] = "text/plain"
+
+ if payload is not None:
+ self.set_payload(payload)
+
+ def set_payload(self, payload):
+ self.content.body = payload
+
+ def send(self, session, dest, key=None):
+ if dest.__class__ is Queue:
+ self.content["routing_key"] = dest.name
+ session.psession.message_transfer(destination="",
+ content=self.content)
+ elif dest.__class__ is Exchange:
+ if routing_key is None:
+ raise Exception("Routing key not set")
+
+ session.psession.message_transfer(destination=dest.name,
+ content=self.content)
+ else:
+ raise Exception("Unknown destination object")
+
+ def __str__(self):
+ return self.content.body
+
+class Client(object):
+ def __init__(self, host, port):
+ self.host = host
+ self.port = port
+ self.pclient = qpid.client.Client(host, port)
+
+ def login(self, user, password):
+ self.pclient.start({"LOGIN": user, "PASSWORD": password})
+
+class Session(object):
+ def __init__(self, client):
+ self.client = client
+ self.psession = client.pclient.session()
+
+ def open(self):
+ self.psession.open()
+
+ def close(self):
+ self.psession.close()
16 years, 11 months
rhmessaging commits: r1666 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-08 13:12:41 -0500 (Fri, 08 Feb 2008)
New Revision: 1666
Added:
mgmt/cumin/python/cumin/test.py
Log:
Checkpoint commit of cumin tests.
Added: mgmt/cumin/python/cumin/test.py
===================================================================
--- mgmt/cumin/python/cumin/test.py (rev 0)
+++ mgmt/cumin/python/cumin/test.py 2008-02-08 18:12:41 UTC (rev 1666)
@@ -0,0 +1,166 @@
+import sys, os
+from mint import *
+from traceback import print_exc
+from datetime import datetime
+from wooly import Session
+
+from cumin import Cumin
+import time
+
+class TestEnvironment(object):
+ def __init__(self, app, broker_address):
+ self.app = app
+ self.broker_address = broker_address
+ self.broker = None
+
+class TestSession(object):
+ def __init__(self, env):
+ self.env = env
+
+ self.successes = list()
+ self.failures = list()
+
+ def add_success(self, test, message, exception):
+ result = TestResult(test, message, exception)
+ self.successes.append(result)
+
+ def add_failure(self, test, message, exception):
+ if exception:
+ print_exc()
+
+ result = TestResult(test, message, exception)
+ self.failures.append(result)
+
+ def report(self, out):
+ out.write("Succcesses (%i)\n" % len(self.successes))
+
+ for succcess in self.successes:
+ out.write(" %s\n" % success)
+
+ out.write("Failures (%i)\n" % len(self.failures))
+
+ for failure in self.failures:
+ out.write(" %s\n" % failure)
+
+class TestResult(object):
+ def __init__(self, test, message, exception):
+ self.test = test
+ self.message = message
+ self.exception = exception
+
+ def __repr__(self):
+ return "%s: %s" % (self.test, self.message)
+
+class Test(object):
+ def __init__(self, env, parent):
+ self.env = env
+ self.parent = parent
+ self.children = list()
+
+ if parent:
+ self.parent.children.append(self)
+
+ def run(self, session):
+ try:
+ self.do_run(session)
+ except Exception, e:
+ session.add_failure(self, e.message, e)
+
+ def do_run(self, session):
+ self.run_children(session)
+
+ def run_children(self, session):
+ for child in self.children:
+ child.run(session)
+
+ def __repr__(self):
+ return self.__class__.__name__
+
+class MainTest(Test):
+ def __init__(self, env):
+ super(MainTest, self).__init__(env, None)
+
+ BrokerTest(env, self)
+
+class BrokerTest(Test):
+ def __init__(self, env, parent):
+ super(BrokerTest, self).__init__(env, parent)
+
+ QueueTest(env, self)
+
+ def do_run(self, session):
+ app = self.env.app
+ page = app.main_page
+
+ s = Session(app)
+ s.set_page(page)
+
+ # navigate from ui top to broker set add
+
+ form = page.show_main(s).show_brokers_add(s)
+
+ name = "test-" + datetime.now().strftime("%Y-%m-%d-%H-%M")
+
+ form.names.get(s).append(name)
+ form.addrs.get(s).append(self.env.broker_address)
+ form.groups.get(s).append(None)
+ form.submit.set(s, True)
+
+ page.process(s, None)
+
+ redirect = page.get_redirect_url(s)
+
+ if redirect:
+ s = Session(app)
+ s.unmarshal(redirect)
+
+ page.process(s, None)
+
+ html = page.render(s, None)
+
+ file = open("BrokerTest.%s.html" % name, "w")
+ file.write(html)
+ file.close()
+
+ reg = BrokerRegistration.selectBy(name=name)[0]
+
+ wait(lambda: reg.broker)
+
+ self.env.broker = reg.broker
+
+ self.run_children(session)
+
+class QueueTest(Test):
+ def do_run(self, session):
+ print self.env.broker
+
+def wait(predicate, timeout=30):
+ start = time.time()
+
+ while True:
+ time.sleep(1)
+
+ if predicate():
+ return
+
+ if time.time() - start > timeout:
+ print "Operation timed out"
+ return
+
+def main():
+ home = os.environ["CUMIN_HOME"]
+ data = "postgresql://cumin@localhost/cumin"
+ app = Cumin(home, data)
+
+ app.init()
+
+ env = TestEnvironment(app, "qpid-test3.lab.boston.redhat.com")
+ session = TestSession(env)
+ main = MainTest(env)
+
+ main.run(session)
+
+ session.report(sys.stdout)
+
+if __name__ == "__main__":
+ main()
16 years, 11 months
rhmessaging commits: r1665 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: nunofsantos
Date: 2008-02-07 17:36:54 -0500 (Thu, 07 Feb 2008)
New Revision: 1665
Modified:
mgmt/mint/python/mint/schemaparser.py
Log:
fix managed broker lookup
Modified: mgmt/mint/python/mint/schemaparser.py
===================================================================
--- mgmt/mint/python/mint/schemaparser.py 2008-02-07 22:31:41 UTC (rev 1664)
+++ mgmt/mint/python/mint/schemaparser.py 2008-02-07 22:36:54 UTC (rev 1665)
@@ -130,7 +130,7 @@
self.pythonOutput += comment
self.pythonOutput += actualArgs
self.pythonOutput += " methodId = model.registerCallback(callbackMethod)\n"
- self.pythonOutput += " model.managedBroker.method(methodId, self.idOriginal, \\\n"
+ self.pythonOutput += " model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \\\n"
self.pythonOutput += " classToSchemaNameMap[self.__class__.__name__], \"%s\", " % (elem["@name"])
self.pythonOutput += "args=actualArgs, packageName=\"qpid\")\n"
16 years, 11 months
rhmessaging commits: r1664 - mgmt/mint/python/mint.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-07 17:31:41 -0500 (Thu, 07 Feb 2008)
New Revision: 1664
Modified:
mgmt/mint/python/mint/schema.py
Log:
Quick fix for method problem.
Modified: mgmt/mint/python/mint/schema.py
===================================================================
--- mgmt/mint/python/mint/schema.py 2008-02-07 21:17:30 UTC (rev 1663)
+++ mgmt/mint/python/mint/schema.py 2008-02-07 22:31:41 UTC (rev 1664)
@@ -54,13 +54,13 @@
actualArgs = dict()
actualArgs["clusterName"] = clusterName
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "joinCluster", args=actualArgs, packageName="qpid")
def leaveCluster(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "leaveCluster", args=actualArgs, packageName="qpid")
def echo(self, model, managedBroker, callbackMethod, sequence, body):
@@ -69,7 +69,7 @@
actualArgs["sequence"] = sequence
actualArgs["body"] = body
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "echo", args=actualArgs, packageName="qpid")
System.sqlmeta.addJoin(SQLMultipleJoin('Broker', joinMethodName='brokers'))
@@ -135,7 +135,7 @@
"""Discard all messages on queue"""
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "purge", args=actualArgs, packageName="qpid")
Vhost.sqlmeta.addJoin(SQLMultipleJoin('Queue', joinMethodName='queues'))
@@ -284,7 +284,7 @@
def close(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "close", args=actualArgs, packageName="qpid")
Vhost.sqlmeta.addJoin(SQLMultipleJoin('Client', joinMethodName='clients'))
@@ -327,25 +327,25 @@
def solicitAck(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "solicitAck", args=actualArgs, packageName="qpid")
def detach(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "detach", args=actualArgs, packageName="qpid")
def resetLifespan(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "resetLifespan", args=actualArgs, packageName="qpid")
def close(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "close", args=actualArgs, packageName="qpid")
Vhost.sqlmeta.addJoin(SQLMultipleJoin('Session', joinMethodName='sessions'))
@@ -386,19 +386,19 @@
actualArgs = dict()
actualArgs["strength"] = strength
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "throttle", args=actualArgs, packageName="qpid")
def stop(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "stop", args=actualArgs, packageName="qpid")
def start(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "start", args=actualArgs, packageName="qpid")
Session.sqlmeta.addJoin(SQLMultipleJoin('Destination', joinMethodName='destinations'))
@@ -469,7 +469,7 @@
def close(self, model, managedBroker, callbackMethod):
actualArgs = dict()
methodId = model.registerCallback(callbackMethod)
- model.managedBroker.method(methodId, self.idOriginal, \
+ model.connectedBrokers[managedBroker].managedBroker.method(methodId, self.idOriginal, \
classToSchemaNameMap[self.__class__.__name__], "close", args=actualArgs, packageName="qpid")
Destination.sqlmeta.addJoin(SQLMultipleJoin('Consumer', joinMethodName='consumers'))
16 years, 11 months
rhmessaging commits: r1663 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-07 16:17:30 -0500 (Thu, 07 Feb 2008)
New Revision: 1663
Modified:
mgmt/cumin/python/cumin/broker.py
Log:
Handle null values in group list.
Modified: mgmt/cumin/python/cumin/broker.py
===================================================================
--- mgmt/cumin/python/cumin/broker.py 2008-02-07 20:53:34 UTC (rev 1662)
+++ mgmt/cumin/python/cumin/broker.py 2008-02-07 21:17:30 UTC (rev 1663)
@@ -641,8 +641,6 @@
else:
host, port = elems[0], 5672
- group = groups[i]
-
args = {
"name": name,
"host": host,
@@ -651,9 +649,12 @@
reg = BrokerRegistration()
- if group:
- reg.addBrokerGroup(group)
+ if len(groups) > i:
+ group = groups[i]
+ if group:
+ reg.addBrokerGroup(group)
+
action.invoke(reg, args);
self.process_cancel(session, model)
16 years, 11 months
rhmessaging commits: r1662 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-07 15:53:34 -0500 (Thu, 07 Feb 2008)
New Revision: 1662
Modified:
mgmt/cumin/python/cumin/model.py
Log:
Print out more information on action invocations.
Mark invocs that except as failed.
Modified: mgmt/cumin/python/cumin/model.py
===================================================================
--- mgmt/cumin/python/cumin/model.py 2008-02-07 20:52:28 UTC (rev 1661)
+++ mgmt/cumin/python/cumin/model.py 2008-02-07 20:53:34 UTC (rev 1662)
@@ -4,6 +4,7 @@
from time import mktime
from datetime import datetime, timedelta
from types import *
+from traceback import print_exc
from util import *
from formats import *
@@ -90,16 +91,21 @@
def completion(status, args=None):
invoc.status = status
invoc.args = args
- #invoc.prt()
+ invoc.prt()
try:
try:
self.do_invoke(object, args, completion)
except Exception, e:
+ invoc.status = "failed"
invoc.exception = e;
+
+ print_exc();
finally:
self.model.invocations.add(invoc)
+ invoc.prt()
+
return invoc
def do_invoke(self, object, args, completion):
@@ -126,7 +132,8 @@
return "%s %s" % (verb, object)
def prt(self):
- print "action", self.action.name, self.when, self.status, self.args
+ print "action", self.action.name, self.object, self.when, \
+ self.status, self.args, self.exception
class CuminStat(object):
def __init__(self, cls, name, type):
16 years, 11 months
rhmessaging commits: r1661 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-07 15:52:28 -0500 (Thu, 07 Feb 2008)
New Revision: 1661
Modified:
mgmt/cumin/python/cumin/action.py
Log:
Fix exception handling in invocation status.
Modified: mgmt/cumin/python/cumin/action.py
===================================================================
--- mgmt/cumin/python/cumin/action.py 2008-02-07 20:50:55 UTC (rev 1660)
+++ mgmt/cumin/python/cumin/action.py 2008-02-07 20:52:28 UTC (rev 1661)
@@ -49,12 +49,12 @@
elif item.status == "OK":
text = "Completed"
else:
- text = "Failed"
+ if item.exception:
+ text = "Failed: " + \
+ item.exception.__class__.__name__
+ else:
+ text = "Failed: " + item.status
- if item.status.exception:
- text = text + ": " + \
- item.status.exception.__class__.__name__
-
return text
def do_get_items(self, session, object):
16 years, 11 months
rhmessaging commits: r1660 - mgmt/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-02-07 15:50:55 -0500 (Thu, 07 Feb 2008)
New Revision: 1660
Modified:
mgmt/cumin/python/cumin/queue.py
Log:
Make the single object queue purge use the generic actions framework.
Modified: mgmt/cumin/python/cumin/queue.py
===================================================================
--- mgmt/cumin/python/cumin/queue.py 2008-02-07 19:49:50 UTC (rev 1659)
+++ mgmt/cumin/python/cumin/queue.py 2008-02-07 20:50:55 UTC (rev 1660)
@@ -417,13 +417,11 @@
self.page().set_redirect_url(session, branch.marshal())
def process_submit(self, session, queue):
- try:
- queue.purge(self.app.model.data, queue.managedBroker, doit)
- except Exception, e:
- self.add_error(session, e)
- else:
- self.process_cancel(session, queue)
+ action = self.app.model.queue.purge
+ action.invoke(queue)
+ self.process_cancel(session, queue)
+
def render_submit_content(self, session, queue):
return "Yes, Purge Queue '%s'" % queue.name
16 years, 11 months