Author: justi9
Date: 2008-12-12 15:22:53 -0500 (Fri, 12 Dec 2008)
New Revision: 2995
Modified:
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/sql.py
mgmt/trunk/mint/python/mint/update.py
Log:
Add some more debug logging and __repr__ impls to clarify what's going on
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-12 20:00:28 UTC (rev 2994)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-12 20:22:53 UTC (rev 2995)
@@ -312,6 +312,9 @@
self.connected = False
+ def __repr__(self):
+ return "%s(%s)" % (self.__class__.__name__, self.url)
+
def getAmqpSession(self):
return self.qmfBroker.getAmqpSession()
@@ -368,6 +371,15 @@
raise e
def init(self):
+ log.info("Object updates are %s",
+ self.updateObjects and "enabled" or "disabled")
+
+ log.info("QMF server polling is %s",
+ self.pollRegistrations and "enabled" or "disabled")
+
+ log.info("Object expiration is %s",
+ self.dbExpiration and "enabled" or "disabled")
+
sqlhub.processConnection = self.dbConn = connectionForURI(self.dataUri)
assert self.qmfSession is None
@@ -506,6 +518,10 @@
def objectProps(self, broker, record):
""" Invoked when an object is updated. """
+ if not self.updateObjects:
+ log.debug("Received an unexpected update")
+ return
+
mbroker = self.getMintBrokerByQmfBroker(broker)
up = update.PropertyUpdate(self, mbroker, record)
@@ -518,6 +534,10 @@
def objectStats(self, broker, record):
""" Invoked when an object is updated. """
+ if not self.updateObjects:
+ log.debug("Received an unexpected update")
+ return
+
mbroker = self.getMintBrokerByQmfBroker(broker)
up = update.StatisticUpdate(self, mbroker, record)
Modified: mgmt/trunk/mint/python/mint/sql.py
===================================================================
--- mgmt/trunk/mint/python/mint/sql.py 2008-12-12 20:00:28 UTC (rev 2994)
+++ mgmt/trunk/mint/python/mint/sql.py 2008-12-12 20:22:53 UTC (rev 2995)
@@ -37,6 +37,9 @@
else:
return self.name
+ def __repr__(self):
+ return self.key()
+
def generate(self):
pass
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-12 20:00:28 UTC (rev 2994)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-12 20:22:53 UTC (rev 2995)
@@ -42,6 +42,8 @@
try:
update = self.updates.get(True, 1)
+ log.debug("Processing %s", update)
+
self.dequeueCount += 1
if self.stopRequested:
@@ -82,7 +84,7 @@
broker.objectDatabaseIds.rollback()
log.exception("Update failed")
-
+
class ReferenceException(Exception):
def __init__(self, sought):
self.sought = sought
@@ -97,6 +99,13 @@
self.object = object
self.priority = 0
+ def __repr__(self):
+ return "%s(%s, %s, %s, %i)" % (self.__class__.__name__,
+ self.broker,
+ self.object and self.object.getClassKey(),
+ self.object,
+ self.priority)
+
def getClass(self):
# XXX this is unfortunate
name = self.object.getClassKey().getClassName()
@@ -117,7 +126,7 @@
for key, value in attrs:
name = key.__repr__()
name = mint.schema.schemaReservedWordsMap.get(name, name)
-
+
if key.type == 10:
self.processReference(name, value, results)
elif key.type == 8:
@@ -248,7 +257,7 @@
# Case 3
attrs["id"] = id
-
+
op = SqlUpdate(cls, attrs)
op.execute(cursor, attrs)
@@ -342,13 +351,20 @@
def process(self, conn):
cursor = conn.cursor()
- rowcount = 0
attrs = self.model.dbExpireThread.attrs
+ total = 0
+
for op in self.model.dbExpireThread.ops:
- rowcount += op.execute(cursor, attrs)
- log.debug("%d records expired" % (rowcount))
+ log.debug("Running expire op %s", op)
+ count = op.execute(cursor, attrs)
+ log.debug("%i records expired", count)
+
+ total += count
+
+ log.debug("%i total records expired", total)
+
class UpdateQueue(ConcurrentQueue):
def __init__(self, maxsize=0, slotCount=1):
self.slotCount = slotCount