Commit Graph

28 Commits

Author SHA1 Message Date
Doug Hellmann 03265410e0 Remove oslo namespace package
Blueprint remove-namespace-packages

Depends-on: I2eeef93ee2e61a721c69f62add819f93f62f077d
for openstack/ceilometer
Depends-on: I26390dd908769be5f1a5b70be22d3b98e3a45563
for openstack/ceilometermiddleware
Depends-on: Ifa8baab33cdb3e606cf175a8c29c3a4ef6c44480
for openstack/glance
Depends-on: I029c3260051aa48cfaae428c096c1ac7b43b2bd2
for openstack/ceilometermiddleware

Change-Id: I8c5595bbafa82db33f62fa47d214f5cb756a2639
2015-07-16 17:47:16 +00:00
Doug Hellmann 76808973c3 Add more private symbols to the old namespace package
This patch exposes some private symbols used by the tests in nova and
heat.

Change-Id: Ide40b293c9b9c76aae094950720cead4179ea883
Partial-Bug: #1412812
Partial-Bug: #1412841
2015-01-20 22:22:14 +00:00
Doug Hellmann e55a83e832 Move files out of the namespace package
Move the public API out of oslo.messaging to oslo_messaging. Retain
the ability to import from the old namespace package for backwards
compatibility for this release cycle.

bp/drop-namespace-packages

Co-authored-by: Mehdi Abaakouk <mehdi.abaakouk@enovance.com>
Change-Id: Ia562010c152a214f1c0fed767c82022c7c2c52e7
2015-01-12 12:50:41 -05:00
Joshua Harlow 372bc4947e Add a thread + futures executor based executor
The concurrent.futures module is one of the ways
that async activities can be done in the future,
so we should try to work on getting to that future
by using more futures. To enable this (as well as
to enable getting off eventlet), add a thread pool
based executor which will process incoming messages
using the pool.

Also begins adding according docs as well for the
different types of executors that are available.

Change-Id: I1482fd70abbf69f4e2994597c5e95d91fecb815e
2014-12-18 23:49:53 -08:00
Jenkins f6be71c503 Merge "Warns user if thread monkeypatch is not done" 2014-12-10 16:54:22 +00:00
Mehdi Abaakouk d3e6ea1788 Warns user if thread monkeypatch is not done
This change warns the user that it does have monkeypatched the
oslo.messaging library correclty.

Change-Id: Ice80ffc6cbc39919eac4bc0809992daea51b5922
Closes-bug: #1288878
2014-12-10 15:59:59 +01:00
Mehdi Abaakouk 15aa5cbda8 The executor doesn't need to set the timeout
It's up to the driver to set a suitable timeout for polling the broker,
this one can be different that the one requested by the driver
caller as long as the caller timeout is respected.

This change also adds a new driver listener API, to be able
to stop it cleanly, specially in case of timeout=None.

Closes bug: #1400268
Closes bug: #1399257
Change-Id: I674c0def1efb420c293897d49683593a0b10e291
2014-12-08 12:59:33 +01:00
Mehdi Abaakouk 7bce31a2d1 Always use a poll timeout in the executor
This change allows to stop the eventlet executor without
using eventlet.kill.

And also, the kombu docs actually recommend that drain_events
by default have a 1 timeout.

Co-Authored-by: Joshua Harlow <harlowja@yahoo-inc.com>

Change-Id: I3a3919e38d08267439843a127346300fd2131540
2014-11-28 08:39:28 +01:00
Mehdi Abaakouk 30e0aea877 Notification listener pools
We can now set the pool name of a notification listener
to create multiple groups/pools of listeners consuming notifications
and that each group/pool only receives one copy of each notification.

The AMQP implementation of that is to set queue_name with the pool name.

Implements blueprint notification-listener-pools
Closes-bug: #1356226

Change-Id: I8dc0549f5550f684a261c78c58737b798fcdd656
2014-11-14 10:20:18 +01:00
Julien Danjou a9ec73f38d Switch to oslo.utils
Change-Id: I262e98d8d03acbe2ff8fee5d607279a669a89e34
2014-08-27 14:14:00 +02:00
Christian Berendt 5be1b6a6a9 Enabled hacking checks H305 and H307
* H305  imports not grouped correctly
* H307  like imports should be grouped together

Change-Id: I08dafc4fa150d2213b2bb002da7c9ee0ee517fac
2014-07-17 12:41:21 +02:00
Ihar Hrachyshka d4c04255f4 Fixed inconsistent EventletContextManagerSpawnTest failures
The test spawns a greenthread and expects it to complete after
eventlet.sleep(0) call. The problem is that if there are other
greenthreads currently running, sleep(0) may switch to unexpected
thread, which may result in test thread not being invoked at all.
Instead of assuming no other green threads are running at the moment
of test execution, explicitly wait() for the test thread.

Change-Id: Id45307860733658638b74ed3a713493df8c1080d
Closes-Bug: #1282706
2014-03-28 14:55:10 +01:00
Jenkins e9821fe602 Merge "Improve help strings" 2014-02-25 12:40:18 +00:00
Mehdi Abaakouk 8a644c1166 Don't reply to notification message
The notification listener doesn't have anything to send to the notifier
and the notifier doesn't attend to receive something.

So this patch remove the message reply when the listener is a
notification
listener.

Partial implements blueprint notification-subscriber-server

Change-Id: Ic989947ba3b6894cde788422842fca19159ea261
2014-02-18 08:31:30 +01:00
Andreas Jaeger 5a860beb87 Improve help strings
Follow oslo.config style guide for help strings better to create
consistent help strings:
* Capitalize first word of each help string
* Finish help strings with "."

Change-Id: Ia08fa09593661e6e5b834d98bbd92689c2674075
2014-02-07 22:25:09 +01:00
Doug Hellmann 7b13bc1888 Update ExpectedException handling
Catch expected exceptions in a way that supports subclasses also being
seen as "expected."

Log a little more detail about unexpected exceptions in the ExecutorBase
so it is easier to add them to the list of expected exceptions.

Change-Id: I1bdd628eba717308f0afe1a889efd8711bad6296
Closes-bug: #1276163
2014-02-05 09:32:42 -08:00
Eric Guo 84d5786f1a Remove copyright from empty files
According to policy change in HACKING:
http://docs.openstack.org/developer/hacking/#openstack-licensing
empty files should no longer contain copyright notices.

Closes-Bug: #1262424
Change-Id: I22d5881537cff120ae10b2fb3141c427d621214b
2014-01-04 10:33:58 +08:00
Chang Bo Guo 0b078b6062 Fix some typos and adjust capitalization
Change-Id: I61cf108f9746fc44a08d83e11d44ed1007a6a1fa
2013-11-03 07:07:51 -08:00
Davanum Srinivas 5f760096d6 Apply six for metaclass
__metaclass__ cannot be used in python3.six be used in general
for python 3 compatibility.

Porting Change-Id I9fc7a59df3af29b4cc1287c40fa4e883d994a961
from oslo-incubator

Change-Id: Icdacdcf5556b6d3b8450d1350c6f62b4f5a9690b
2013-10-14 14:10:31 -04:00
Mark McLoughlin 59299dc202 Fix error message if message handler fails
There are a number of situations in which we log a message if an
exception occurs during the handling of a message:

  1) Something goes wrong pulling the message from the queue and
     de-serializing it - here we print "Failed to process message"

  2) An RPC endpoint method raises an expected exception - here we
     print an 'Expected exception during message handling' debug
     message

  3) An RPC endpoint method raises any other exception - here we
     should print an 'Exception during message handling' error message

However, in the latter case, we are currently printing out the 'Failed
to process' error message.

Change-Id: I4f7042b8ec978aaff8f4e20e62ba1ac765fe6ba5
2013-08-26 10:38:35 +01:00
Mark McLoughlin 747e1a4099 Fix handling of None, etc. replies
A rather embarassing and obvious bug - we're currently not allowing
endpoint methods to send replies of None, '', False, [], {}, etc.

Change-Id: Ifc5ff8f308f526197559a4df7bed244cff6ed3c1
2013-08-15 21:11:38 +01:00
Mark McLoughlin f6df32d943 Add API for expected endpoint exceptions
Review I4e7b19dc730342091fd70a717065741d56da4555 gives a lot of the
background here, but the idea is that some exceptions raised by an RPC
endpoint method do not indicate any sort of failure and should not be
logged by the server as an error.

The classic example of this is conductor's instance_get() method raising
InstanceNotFound. This is perfectly normal and should not be considered
an error.

The new API is a decorator which you can use with RPC endpoints methods
to indicate which exceptions are expected:

    @messaging.expected_exceptions(InstanceNotFound)
    def instance_get(self, context, instance_id):
        ...

but we also need to expose the ExpectedException type itself so that
direct "local" users of the endpoint class know what type will be used
to wrap expected exceptions. For example, Nova has an ExceptionHelper
class which unwraps the original exception from an ExpectedException and
re-raises it.

I've changed from client_exceptions() and ClientException to make it
more clear it's intent. I felt that the "client" naming gave the
impression it was intended for use on the client side.

Change-Id: Ieec4600bd6b70cf31ac7925a98a517b84acada4d
2013-08-07 12:52:54 +01:00
Mark McLoughlin 84a0693737 Remove unused IncomingMessage.done()
We appear to not have a use for this. I had originally thought we might
use this to ack messages one they've been processed and replied to, but
we actually have always acked messages as soon as they have been
deserialized and queued for dispatching.

Change-Id: I8e1fd565814f3b5e3ba0f1bc77e62ed52ff08661
2013-08-07 06:51:24 +01:00
Mark McLoughlin 43ab36d1a1 Make executor threads more robust
See bug #1189711

Prevent the executor thread getting killed by exceptions.

Change-Id: I0787fa619a6a8a35a303627f8ce119c93f2c8765
2013-07-23 18:34:42 +01:00
Mark McLoughlin e67f409b87 Don't use common logging
It appears we don't actually need this - we don't, for example, use any
of the special formatting supported by ContextAdaptor.
2013-06-16 15:24:41 +01:00
Mark McLoughlin d821999629 Don't translate exception messages 2013-06-16 11:55:47 +01:00
Mark McLoughlin 0fc785267f Add docstrings for base executor class
Avoiding spurious missed lines in coverage report.
2013-06-15 21:20:26 +01:00
Mark McLoughlin cbfb1452a4 Move files to new locations for oslo.messaging 2013-06-15 08:43:54 +01:00