moksha/api/streams/datastream.py | 8 +++++---
moksha/apps/feeds/moksha/apps/feeds/streams.py | 10 ++++++++--
moksha/hub/amqp/__init__.py | 9 +++------
start-moksha | 5 +++++
4 files changed, 21 insertions(+), 11 deletions(-)
New commits:
commit fd1d8f6ee71849bd76a80e8cf6bac409fe6d1189
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Mar 15 15:45:16 2011 -0400
Allow people to disable the moksha feed aggregation stream with the
moksha.feedaggregator variable in your ini
diff --git a/moksha/apps/feeds/moksha/apps/feeds/streams.py
b/moksha/apps/feeds/moksha/apps/feeds/streams.py
index f892da5..912f809 100644
--- a/moksha/apps/feeds/moksha/apps/feeds/streams.py
+++ b/moksha/apps/feeds/moksha/apps/feeds/streams.py
@@ -29,6 +29,7 @@ except ImportError:
from twisted.web import client
from twisted.web.client import HTTPPageGetter, HTTPClientFactory
from twisted.internet import reactor, protocol, defer
+from paste.deploy.converters import asbool
from datetime import timedelta
from feedcache import Cache
@@ -294,10 +295,15 @@ class MokshaFeedStream(PollingDataStream):
AMQP messages will be sent to the `feeds.$URL` queue.
"""
#frequency = timedelta(minutes=1)
- now = True
+ now = False
def __init__(self):
- self.frequency = int(config.get('feed.poll_frequency', 900))
+ enabled = asbool(config.get('moksha.feedaggregator', False))
+ if not enabled:
+ log.info('Moksha Feed Aggregator disabled')
+ return
+ else:
+ self.frequency = int(config.get('feed.poll_frequency', 900))
super(MokshaFeedStream, self).__init__()
def poll(self):
commit 1c1c3678b5cfae6ed189d28e3a5ee0b5276b52d3
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Mar 15 15:44:58 2011 -0400
Make our datastream shutdown procedures more robust
diff --git a/moksha/api/streams/datastream.py b/moksha/api/streams/datastream.py
index 5c10e0e..0de9514 100644
--- a/moksha/api/streams/datastream.py
+++ b/moksha/api/streams/datastream.py
@@ -46,8 +46,9 @@ class DataStream(object):
log.error('Cannot send message: %s' % e)
def stop(self):
- self.hub.close()
- if self.DBSession:
+ if hasattr(self, 'hub') and self.hub:
+ self.hub.close()
+ if hasattr(self, 'DBSession') and self.DBSession:
self.DBSession.close()
@@ -78,6 +79,7 @@ class PollingDataStream(DataStream):
def stop(self):
super(PollingDataStream, self).stop()
try:
- self.timer.stop()
+ if hasattr(self, 'timer'):
+ self.timer.stop()
except Exception, e:
self.log.warn(e)
commit d89e701c2cc9151b636642f7f3c4806a0e118c18
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Mar 15 13:14:15 2011 -0400
If we're using a virtualenv and have python-qpid installed, symlink it in
diff --git a/start-moksha b/start-moksha
index 1514fbe..0e9e847 100755
--- a/start-moksha
+++ b/start-moksha
@@ -59,6 +59,11 @@ if [ ! $VIRTUAL_ENV ]; then
#./pip.py install -E tg2env -r normal-reqs.txt
--extra-index-url=http://www.turbogears.org/2.0/downloads/current/index
#easy_install -i
http://www.turbogears.org/2.0/downloads/current/index
tg.devtools
#pushd moksha/widgetbrowser; python setup.py develop; popd
+
+ # Link the python-qpid modules into our virtualenv, if they exist
+ if [ -d /usr/lib/python*/site-packages/qpid ]; then
+ ln -s /usr/lib/python*/site-packages/qpid
tg2env/lib/python*/site-packages/
+ fi
else
source tg2env/bin/activate
fi
commit bf12bec884f8a27acef88b6f089efb13036483c8
Author: Luke Macken <lmacken(a)redhat.com>
Date: Tue Mar 15 13:13:55 2011 -0400
Warn if we are trying to use AMQP but can't import qpid
diff --git a/moksha/hub/amqp/__init__.py b/moksha/hub/amqp/__init__.py
index 98ada27..8bed9af 100644
--- a/moksha/hub/amqp/__init__.py
+++ b/moksha/hub/amqp/__init__.py
@@ -16,20 +16,17 @@
"""
Here is where we configure which AMQP hub implementation we are going to use.
"""
-import logging
-log = logging.getLogger(__name__)
-
try:
from qpid010 import QpidAMQPHub
AMQPHub = QpidAMQPHub
except ImportError:
- log.debug("Cannot find qpid python module")
+ print("Cannot find qpid python module. Make sure you have python-qpid
installed.")
try:
from pyamqplib import AMQPLibHub
AMQPHub = AMQPLibHub
except ImportError:
- log.debug("Cannot find pyamqplib")
- log.debug("Using FakeHub AMQP broker. Don't expect AMQP to work")
+ print("Cannot find pyamqplib")
+ print("Using FakeHub AMQP broker. Don't expect AMQP to work")
class FakeHub(object):
pass
AMQPHub = FakeHub