launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #22486
[Merge] lp:~cjwatson/launchpad/amqp-port into lp:launchpad
Colin Watson has proposed merging lp:~cjwatson/launchpad/amqp-port into lp:launchpad.
Commit message:
Upgrade to Python 3-compatible versions of rabbitfixture and oops-amqp.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/amqp-port/+merge/345305
These also involved porting from amqplib to the better-maintained amqp, so this keeps up with that.
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad/amqp-port into lp:launchpad.
=== modified file 'constraints.txt'
--- constraints.txt 2018-05-05 11:28:14 +0000
+++ constraints.txt 2018-05-09 16:52:27 +0000
@@ -217,8 +217,7 @@
# post1 Don't add a process back to the ready set if it received an error
# such as a timeout.
ampoule==0.2.0.post1
-amqp==1.4.9
-amqplib==1.0.2
+amqp==2.2.2
anyjson==0.3.3
appdirs==1.4.3
asn1crypto==0.23.0
@@ -295,7 +294,7 @@
netaddr==0.7.19
oauth==1.0
oops==0.0.13
-oops-amqp==0.0.8b1
+oops-amqp==0.1.0
oops-datedir-repo==0.0.23
oops-timeline==0.0.1
oops-twisted==0.0.7
@@ -329,7 +328,7 @@
python-openid==2.2.5-fix1034376
python-swiftclient==2.0.3
PyYAML==3.10
-rabbitfixture==0.3.6
+rabbitfixture==0.4.0
requests==2.7.0
requests-toolbelt==0.6.2
scandir==1.7
@@ -358,6 +357,7 @@
typing==3.6.2
unittest2==1.1.0
van.testing==3.0.0
+vine==1.1.4
virtualenv-tools3==2.0.0
wadllib==1.3.2
wheel==0.29.0
=== modified file 'lib/lp/services/messaging/rabbit.py'
--- lib/lp/services/messaging/rabbit.py 2015-07-08 16:05:11 +0000
+++ lib/lp/services/messaging/rabbit.py 2018-05-09 16:52:27 +0000
@@ -19,7 +19,7 @@
import threading
import time
-from amqplib import client_0_8 as amqp
+import amqp
import transaction
from transaction._transaction import Status as TransactionStatus
from zope.interface import implementer
@@ -73,10 +73,12 @@
"""
if not is_configured():
raise MessagingUnavailable("Incomplete configuration")
- return amqp.Connection(
+ connection = amqp.Connection(
host=config.rabbitmq.host, userid=config.rabbitmq.userid,
password=config.rabbitmq.password,
- virtual_host=config.rabbitmq.virtual_host, insist=False)
+ virtual_host=config.rabbitmq.virtual_host)
+ connection.connect()
+ return connection
@implementer(IMessageSession)
@@ -97,9 +99,7 @@
@property
def is_connected(self):
"""See `IMessageSession`."""
- return (
- self._connection is not None and
- self._connection.transport is not None)
+ return self._connection is not None and self._connection.connected
def connect(self):
"""See `IMessageSession`.
@@ -107,7 +107,7 @@
Open a connection for this thread if necessary. Connections cannot be
shared between threads.
"""
- if self._connection is None or self._connection.transport is None:
+ if self._connection is None or not self._connection.connected:
self._connection = connect()
return self._connection
@@ -281,8 +281,8 @@
else:
self.channel.basic_ack(message.delivery_tag)
return json.loads(message.body)
- except amqp.AMQPChannelException as error:
- if error.amqp_reply_code == 404:
+ except amqp.ChannelError as error:
+ if error.reply_code == 404:
raise QueueNotFound()
else:
raise
=== modified file 'lib/lp/testing/fixture.py'
--- lib/lp/testing/fixture.py 2018-02-14 01:27:28 +0000
+++ lib/lp/testing/fixture.py 2018-05-09 16:52:27 +0000
@@ -21,7 +21,7 @@
import socket
import time
-import amqplib.client_0_8 as amqp
+import amqp
from fixtures import (
EnvironmentVariableFixture,
Fixture,
=== modified file 'lib/lp/testing/tests/test_layers_functional.py'
--- lib/lp/testing/tests/test_layers_functional.py 2018-02-14 01:27:28 +0000
+++ lib/lp/testing/tests/test_layers_functional.py 2018-05-09 16:52:27 +0000
@@ -19,7 +19,7 @@
from urllib import urlopen
import uuid
-from amqplib import client_0_8 as amqp
+import amqp
from fixtures import (
EnvironmentVariableFixture,
Fixture,
@@ -277,8 +277,8 @@
host=rabbitmq.host,
userid=rabbitmq.userid,
password=rabbitmq.password,
- virtual_host=rabbitmq.virtual_host,
- insist=False)
+ virtual_host=rabbitmq.virtual_host)
+ conn.connect()
conn.close()
=== modified file 'lib/lp_sitecustomize.py'
--- lib/lp_sitecustomize.py 2018-02-13 16:25:57 +0000
+++ lib/lp_sitecustomize.py 2018-05-09 16:52:27 +0000
@@ -70,11 +70,11 @@
logger.parent = new_root
-def silence_amqplib_logger():
- """Install the NullHandler on the amqplib logger to silence logs."""
- amqplib_logger = logging.getLogger('amqplib')
- amqplib_logger.addHandler(logging.NullHandler())
- amqplib_logger.propagate = False
+def silence_amqp_logger():
+ """Install the NullHandler on the amqp logger to silence logs."""
+ amqp_logger = logging.getLogger('amqp')
+ amqp_logger.addHandler(logging.NullHandler())
+ amqp_logger.propagate = False
def silence_bzr_logger():
@@ -153,7 +153,7 @@
This function is also invoked by the test infrastructure to reset
logging between tests.
"""
- silence_amqplib_logger()
+ silence_amqp_logger()
silence_bzr_logger()
silence_zcml_logger()
silence_transaction_logger()
Follow ups