Author: justi9
Date: 2008-12-15 17:40:16 -0500 (Mon, 15 Dec 2008)
New Revision: 3003
Modified:
mgmt/trunk/cumin/python/cumin/tools.py
mgmt/trunk/mint/python/mint/__init__.py
mgmt/trunk/mint/python/mint/tools.py
mgmt/trunk/mint/python/mint/update.py
Log:
Add opt-in psyco native compilation.
Add some logic to the update processing thread to yield if the work
queue is deep enough.
Modified: mgmt/trunk/cumin/python/cumin/tools.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/tools.py 2008-12-15 19:42:27 UTC (rev 3002)
+++ mgmt/trunk/cumin/python/cumin/tools.py 2008-12-15 22:40:16 UTC (rev 3003)
@@ -59,6 +59,12 @@
self.config.init()
+ try:
+ import psyco
+ psyco.full()
+ except ImportError:
+ pass
+
def run(self):
try:
opts, args = self.parse(sys.argv)
Modified: mgmt/trunk/mint/python/mint/__init__.py
===================================================================
--- mgmt/trunk/mint/python/mint/__init__.py 2008-12-15 19:42:27 UTC (rev 3002)
+++ mgmt/trunk/mint/python/mint/__init__.py 2008-12-15 22:40:16 UTC (rev 3003)
@@ -32,7 +32,7 @@
pass
# get better thread switching performance
-sys.setcheckinterval(50)
+sys.setcheckinterval(25)
Broker.sqlmeta.addColumn(ForeignKey("BrokerRegistration",
Modified: mgmt/trunk/mint/python/mint/tools.py
===================================================================
--- mgmt/trunk/mint/python/mint/tools.py 2008-12-15 19:42:27 UTC (rev 3002)
+++ mgmt/trunk/mint/python/mint/tools.py 2008-12-15 22:40:16 UTC (rev 3003)
@@ -45,6 +45,12 @@
#self.config.init()
+ try:
+ import psyco
+ psyco.full()
+ except ImportError:
+ pass
+
def run(self):
try:
opts, args = self.parse(sys.argv)
Modified: mgmt/trunk/mint/python/mint/update.py
===================================================================
--- mgmt/trunk/mint/python/mint/update.py 2008-12-15 19:42:27 UTC (rev 3002)
+++ mgmt/trunk/mint/python/mint/update.py 2008-12-15 22:40:16 UTC (rev 3003)
@@ -9,7 +9,7 @@
from traceback import print_exc
from qpid.datatypes import UUID
from mint.schema import *
-from time import clock
+from time import clock, sleep
from sql import *
from collections import deque
from util import *
@@ -35,6 +35,10 @@
except Full:
log.exception("Queue is full")
+ if self.updates.qsize() > 1000:
+ # This is an attempt to yield
+ sleep(0.1)
+
def run(self):
conn = self.model.dbConn.getConnection()
Show replies by date