You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/04/01 23:10:43 UTC

[26/45] allura git commit: [#7862] remove amqp/rabbitmq references, and async.py which could occasionally cause import issues from gitdb looking for another async package

[#7862] remove amqp/rabbitmq references, and async.py which could occasionally cause import issues from gitdb looking for another async package


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/ffc64c39
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/ffc64c39
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/ffc64c39

Branch: refs/heads/hss/7072
Commit: ffc64c39ea5bc6185c53b5fb1272d3b4343077fd
Parents: b42fa1a
Author: Dave Brondsema <db...@slashdotmedia.com>
Authored: Thu Mar 26 21:54:06 2015 +0000
Committer: Dave Brondsema <db...@slashdotmedia.com>
Committed: Mon Mar 30 14:57:47 2015 +0000

----------------------------------------------------------------------
 Allura/allura/command/smtp_server.py         |  2 +-
 Allura/allura/command/taskd.py               | 13 +-----
 Allura/allura/lib/app_globals.py             | 20 ---------
 Allura/allura/lib/async.py                   | 49 -----------------------
 Allura/allura/model/monq_model.py            |  5 ---
 Allura/allura/tests/test_commands.py         |  1 -
 Allura/development.ini                       | 15 +------
 Allura/docs/getting_started/installation.rst | 23 -----------
 Allura/docs/platform/email.rst               |  3 --
 Allura/docs/platform/platform.rst            |  9 +----
 10 files changed, 5 insertions(+), 135 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/command/smtp_server.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/smtp_server.py b/Allura/allura/command/smtp_server.py
index eb2a98f..40008d7 100644
--- a/Allura/allura/command/smtp_server.py
+++ b/Allura/allura/command/smtp_server.py
@@ -33,7 +33,7 @@ class SMTPServerCommand(base.Command):
     min_args = 1
     max_args = 1
     usage = '<ini file>'
-    summary = 'Handle incoming emails, routing them to RabbitMQ'
+    summary = 'Handle incoming emails, routing them to taskd'
     parser = command.Command.standard_parser(verbose=True)
     parser.add_option('-c', '--context', dest='context',
                       help=('The context of the message (path to the project'

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/command/taskd.py
----------------------------------------------------------------------
diff --git a/Allura/allura/command/taskd.py b/Allura/allura/command/taskd.py
index 40d795a..409e701 100644
--- a/Allura/allura/command/taskd.py
+++ b/Allura/allura/command/taskd.py
@@ -114,12 +114,6 @@ class TaskdCommand(base.Command):
                     'Unexpected http response from taskd request: %s.  Headers: %s',
                     status, headers)
 
-        def waitfunc_amqp():
-            try:
-                return pylons.app_globals.amq_conn.queue.get(timeout=poll_interval)
-            except Queue.Empty:
-                return None
-
         def waitfunc_noq():
             time.sleep(poll_interval)
 
@@ -131,14 +125,9 @@ class TaskdCommand(base.Command):
                     raise StopIteration
             return waitfunc_checks_running
 
-        if pylons.app_globals.amq_conn:
-            waitfunc = waitfunc_amqp
-        else:
-            waitfunc = waitfunc_noq
+        waitfunc = waitfunc_noq
         waitfunc = check_running(waitfunc)
         while self.keep_running:
-            if pylons.app_globals.amq_conn:
-                pylons.app_globals.amq_conn.reset()
             try:
                 while self.keep_running:
                     self.task = M.MonQTask.get(

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index fc49749..30bfbf3 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -61,7 +61,6 @@ from allura.lib import gravatar, plugin, utils
 from allura.lib import helpers as h
 from allura.lib.widgets import analytics
 from allura.lib.security import Credentials
-from allura.lib.async import Connection, MockAMQ
 from allura.lib.solr import MockSOLR, make_solr_from_config
 from allura.lib.zarkov_helpers import ZarkovClient
 
@@ -339,21 +338,6 @@ class Globals(object):
                     return []
             return NullActivityStreamDirector()
 
-    @LazyProperty
-    def amq_conn(self):
-        if asbool(config.get('amqp.enabled', 'true')):
-            if asbool(config.get('amqp.mock')):
-                return MockAMQ(self)
-            else:
-                return Connection(
-                    hostname=config.get('amqp.hostname', 'localhost'),
-                    port=asint(config.get('amqp.port', 5672)),
-                    userid=config.get('amqp.userid', 'testuser'),
-                    password=config.get('amqp.password', 'testpw'),
-                    vhost=config.get('amqp.vhost', 'testvhost'))
-        else:
-            return None
-
     def post_event(self, topic, *args, **kwargs):
         allura.tasks.event_tasks.event.post(topic, *args, **kwargs)
 
@@ -634,7 +618,3 @@ class Icon(object):
     def __init__(self, char, css):
         self.char = char
         self.css = css
-
-
-def connect_amqp(config):
-    return

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/lib/async.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/async.py b/Allura/allura/lib/async.py
deleted file mode 100644
index d299160..0000000
--- a/Allura/allura/lib/async.py
+++ /dev/null
@@ -1,49 +0,0 @@
-#       Licensed to the Apache Software Foundation (ASF) under one
-#       or more contributor license agreements.  See the NOTICE file
-#       distributed with this work for additional information
-#       regarding copyright ownership.  The ASF licenses this file
-#       to you under the Apache License, Version 2.0 (the
-#       "License"); you may not use this file except in compliance
-#       with the License.  You may obtain a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#       Unless required by applicable law or agreed to in writing,
-#       software distributed under the License is distributed on an
-#       "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-#       KIND, either express or implied.  See the License for the
-#       specific language governing permissions and limitations
-#       under the License.
-
-import logging
-from Queue import Queue
-
-log = logging.getLogger(__name__)
-
-
-class Connection(object):
-
-    def __init__(self, hostname, port, userid, password, vhost):
-        import kombu
-        self._conn_proto = kombu.BrokerConnection(
-            hostname=hostname,
-            port=port,
-            userid=userid,
-            password=password,
-            virtual_host=vhost)
-        self._connection_pool = self._conn_proto.Pool(preload=1, limit=None)
-        self.reset()
-
-    def reset(self):
-        self._conn = self._connection_pool.acquire()
-        self.queue = self._conn.SimpleQueue('task')
-
-
-class MockAMQ(object):
-
-    def __init__(self, globals):
-        self.globals = globals
-        self.reset()
-
-    def reset(self):
-        self.queue = Queue()

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/model/monq_model.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/monq_model.py b/Allura/allura/model/monq_model.py
index be22769..7f25a4f 100644
--- a/Allura/allura/model/monq_model.py
+++ b/Allura/allura/model/monq_model.py
@@ -169,11 +169,6 @@ class MonQTask(MappedClass):
             context=context,
             time_queue=datetime.utcnow() + timedelta(seconds=delay))
         session(obj).flush(obj)
-        try:
-            if g.amq_conn:
-                g.amq_conn.queue.put('')
-        except:
-            log.warning('Error putting to amq_conn', exc_info=True)
         return obj
 
     @classmethod

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/allura/tests/test_commands.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/test_commands.py b/Allura/allura/tests/test_commands.py
index 73b419a..1c298c5 100644
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -39,7 +39,6 @@ class EmptyClass(object):
 
 def setUp(self):
     """Method called by nose before running each test"""
-    # setup_basic_test(app_name='main_with_amqp')
     setup_basic_test()
     setup_global_objects()
 

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 2f60f2f..bda8d37 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -289,14 +289,8 @@ ming.zarkov.auto_ensure_indexes = False
 
 stats.sample_rate = 1
 
-# Async setup
+; Taskd setup
 monq.poll_interval=2
-amqp.enabled = false
-# amqp.hostname = localhost
-# amqp.port = 5672
-# amqp.userid = testuser
-# amqp.password = testpw
-# amqp.vhost = testvhost
 
 # SOLR setup
 solr.server = http://localhost:8983/solr
@@ -399,7 +393,7 @@ override_root = task ; TurboGears will use controllers/task.py as root controlle
 # http://docs.python.org/lib/logging-config-fileformat.html
 
 [loggers]
-keys = root, allura, sqlalchemy, paste, amqp, pylons, taskdstatus, timermiddleware, tmw_details
+keys = root, allura, sqlalchemy, paste, pylons, taskdstatus, timermiddleware, tmw_details
 
 [handlers]
 keys = console, stats, taskdstatus, timermiddleware
@@ -430,11 +424,6 @@ level = INFO
 qualname = paste
 handlers =
 
-[logger_amqp]
-level = INFO
-qualname = amqplib
-handlers =
-
 [logger_pylons]
 level = INFO
 qualname = pylons

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/docs/getting_started/installation.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/getting_started/installation.rst b/Allura/docs/getting_started/installation.rst
index 3d3321a..9c08692 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -82,26 +82,3 @@ Allura records will be automatically created the first time they log in.
 
 Note: if you want users to register new accounts into your LDAP system via Allura, you should turn
 off :samp:`autoregister` and turn on :samp:`allow_user_registration`
-
-Enabling RabbitMQ
-^^^^^^^^^^^^^^^^^
-
-For faster notification of background jobs, you can use RabbitMQ.  Assuming a base setup from the INSTALL, run these commands
-to install rabbitmq and set it up:
-
-.. code-block:: bash
-
-    sudo aptitude install rabbitmq-server
-    sudo rabbitmqctl add_user testuser testpw
-    sudo rabbitmqctl add_vhost testvhost
-    sudo rabbitmqctl set_permissions -p testvhost testuser ""  ".*" ".*"
-    pip install amqplib==0.6.1 kombu==1.0.4
-
-Then edit Allura/development.ini and change `amqp.enabled = false` to `amqp.enabled = true` and uncomment the other `amqp` settings.
-
-If your `paster taskd` process is still running, restart it:
-
-.. code-block:: bash
-
-    pkill -f taskd
-    nohup paster taskd development.ini > /var/log/allura/taskd.log &
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/docs/platform/email.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/platform/email.rst b/Allura/docs/platform/email.rst
index 754a278..59f5e94 100644
--- a/Allura/docs/platform/email.rst
+++ b/Allura/docs/platform/email.rst
@@ -46,9 +46,6 @@ If you were working with the bug tracker directly on the TurboGears project::
 
     bug.142@turbogears.sf.net
 
-The Allura platform allows you to setup other message types, such as commit
-messages, to go into amqp with the same routing information, and turn into
-"messages" just like e-mail.
 
 Email Content Handling
 ----------------------

http://git-wip-us.apache.org/repos/asf/allura/blob/ffc64c39/Allura/docs/platform/platform.rst
----------------------------------------------------------------------
diff --git a/Allura/docs/platform/platform.rst b/Allura/docs/platform/platform.rst
index 7e64755..f12299c 100644
--- a/Allura/docs/platform/platform.rst
+++ b/Allura/docs/platform/platform.rst
@@ -40,8 +40,7 @@ complex requirements for data storage and extensibility.  So, we needed a
 
 We were very impressed by the general message architecture of Roundup, but we
 wanted to extend it from just email messages to include scm commits, and we
-added a message bus (RabbitMQ which we'll talk about in a second), to make
-it fast.
+added a message bus, to make it fast.
 
 .. image:: ../_static/images/messages.png
    :alt: Message Architecture
@@ -74,12 +73,6 @@ Not only that but Rick Copeland had built a couple of custom Object
 and he whipped up Ming, which backed on MongoDB and gave us exactly
 what we needed.
 
-As I mentioned before we also needed a fast, flexible message bus and queuing
-system. RabbitMQ was (lightning) fast, (shockingly) flexible, but not super
-easy to use. Fortunately we didn't have to roll our own wrapper here, as
-the Python community already whipped up Carrot, and Celery, which made
-working with the RabbitMQ based AMQP bus a LOT easer.
-
 
 Application Tools
 -----------------