Author: justi9
Date: 2010-01-11 15:39:58 -0500 (Mon, 11 Jan 2010)
New Revision: 3784
Modified:
mgmt/trunk/cumin/python/cumin/main.py
mgmt/trunk/cumin/python/cumin/messaging/model.py
mgmt/trunk/mint/python/mint/model.py
mgmt/trunk/mint/python/mint/tools.py
Log:
More pythonic naming
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2010-01-11 20:07:58 UTC (rev 3783)
+++ mgmt/trunk/cumin/python/cumin/main.py 2010-01-11 20:39:58 UTC (rev 3784)
@@ -133,7 +133,7 @@
def do_process(self, session):
super(OverviewFrame, self).do_process(session)
- count = len(self.app.model.mint.model.qmfBrokers)
+ count = len(self.app.model.mint.model.qmf_brokers)
if count == 0:
self.mode.set(session, self.notice)
Modified: mgmt/trunk/cumin/python/cumin/messaging/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/messaging/model.py 2010-01-11 20:07:58 UTC (rev 3783)
+++ mgmt/trunk/cumin/python/cumin/messaging/model.py 2010-01-11 20:39:58 UTC (rev 3784)
@@ -26,7 +26,7 @@
session_ids = set()
- for broker in self.app.model.mint.model.qmfBrokers:
+ for broker in self.app.model.mint.model.qmf_brokers:
session_ids.add(broker.getSessionId())
for sess in conn.sessions:
Modified: mgmt/trunk/mint/python/mint/model.py
===================================================================
--- mgmt/trunk/mint/python/mint/model.py 2010-01-11 20:07:58 UTC (rev 3783)
+++ mgmt/trunk/mint/python/mint/model.py 2010-01-11 20:39:58 UTC (rev 3784)
@@ -27,10 +27,10 @@
self.agents = dict()
# int seq => callable
- self.outstandingMethodCalls = dict()
+ self.outstanding_method_calls = dict()
- self.qmfSession = None
- self.qmfBrokers = list()
+ self.qmf_session = None
+ self.qmf_brokers = list()
self.lock = RLock()
@@ -38,11 +38,11 @@
pass
def do_init(self):
- assert self.qmfSession is None
+ assert self.qmf_session is None
- self.qmfSession = Session(MintConsole(self),
- manageConnections=True,
- rcvObjects=self.app.updateEnabled)
+ self.qmf_session = Session(MintConsole(self),
+ manageConnections=True,
+ rcvObjects=self.app.updateEnabled)
def do_start(self):
# Clean up any transient objects that a previous instance may have
@@ -55,19 +55,19 @@
uris = [x.strip() for x in self.app.config.qmf.split(",")]
for uri in uris:
- self.addBroker(uri)
+ self.add_broker(uri)
def do_stop(self):
- for qbroker in self.qmfBrokers:
- self.qmfSession.delBroker(qbroker)
+ for qbroker in self.qmf_brokers:
+ self.qmf_session.delBroker(qbroker)
- def addBroker(self, url):
+ def add_broker(self, url):
log.info("Adding qmf broker at %s", url)
self.lock.acquire()
try:
- qbroker = self.qmfSession.addBroker(url)
- self.qmfBrokers.append(qbroker)
+ qbroker = self.qmf_session.addBroker(url)
+ self.qmf_brokers.append(qbroker)
finally:
self.lock.release()
@@ -105,11 +105,11 @@
try:
broker = self.agent.getBroker()
- seq = self.model.qmfSession._sendMethodRequest \
+ seq = self.model.qmf_session._sendMethodRequest \
(broker, classKey, objectId, methodName, args)
if seq is not None:
- self.model.outstandingMethodCalls[seq] = callback
+ self.model.outstanding_method_calls[seq] = callback
return seq
finally:
@@ -118,7 +118,7 @@
def delete(self):
self.model.lock.acquire()
try:
- del self.model.agents[agent.id]
+ del self.model.agents[self.id]
finally:
self.model.lock.release()
@@ -131,8 +131,8 @@
def __init__(self, model):
self.model = model
- self.deferredObjectPropCalls = defaultdict(list)
- self.deferredObjectStatCalls = defaultdict(list)
+ self.deferred_object_prop_calls = defaultdict(list)
+ self.deferred_object_stat_calls = defaultdict(list)
def brokerConnected(self, qbroker):
log.info("Broker at %s:%i is connected", qbroker.host, qbroker.port)
@@ -160,12 +160,12 @@
# XXX This business is to handle an agent-vs-agent-data ordering
# problem
- objectPropCalls = self.deferredObjectPropCalls[agent.id]
+ objectPropCalls = self.deferred_object_prop_calls[agent.id]
for broker, object in objectPropCalls:
self.objectProps(broker, object)
- objectStatCalls = self.deferredObjectStatCalls[agent.id]
+ objectStatCalls = self.deferred_object_stat_calls[agent.id]
for broker, object in objectStatCalls:
self.objectStats(broker, object)
@@ -177,7 +177,7 @@
agent.delete()
up = AgentDisconnectUpdate(agent)
- self.app.updateThread.enqueue(up)
+ self.model.app.updateThread.enqueue(up)
def heartbeat(self, qagent, timestamp):
timestamp = timestamp / 1000000000
@@ -202,7 +202,7 @@
try:
agent = self.model.agents[id]
except KeyError:
- self.deferredObjectPropCalls[id].append((broker, object))
+ self.deferred_object_prop_calls[id].append((broker, object))
return
finally:
self.model.lock.release()
@@ -223,7 +223,7 @@
try:
agent = self.model.agents[id]
except KeyError:
- self.deferredObjectStatCalls[id].append((broker, object))
+ self.deferred_object_stat_calls[id].append((broker, object))
return
finally:
self.model.lock.release()
@@ -241,7 +241,7 @@
self.model.lock.acquire()
try:
- methodCallback = self.model.outstandingMethodCalls.pop(seq)
- methodCallback(response.text, response.outArgs)
+ callback = self.model.outstanding_method_calls.pop(seq)
+ callback(response.text, response.outArgs)
finally:
self.model.lock.release()
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2010-01-11 20:07:58 UTC (rev 3783)
+++ mgmt/trunk/mint/python/mint/tools.py 2010-01-11 20:39:58 UTC (rev 3784)
@@ -395,7 +395,7 @@
try:
for arg in args[1:]:
- app.model.addBroker(arg)
+ app.model.add_broker(arg)
while True:
sleep(2)
@@ -415,7 +415,7 @@
try:
for arg in args[1:]:
- app.model.addBroker(arg)
+ app.model.add_broker(arg)
while True:
sleep(2)
@@ -447,7 +447,7 @@
try:
for arg in args[1:]:
try:
- app.model.addBroker(arg)
+ app.model.add_broker(arg)
except socket.error, e:
print "Warning: Failed connecting to broker at
'%s'" % arg