10 Commits

Author SHA1 Message Date
Mehdi Abaakouk
4dd644ac20 batch notification listener
Gnocchi performs better if measurements are write in batch
When Ceilometer is used with Gnocchi, this is not possible.

This change introduce a new notification listener that allows that.

On the driver side, a default batch implementation is provided.
It's just call the legacy poll method many times.

Driver can override it to provide a better implementation.
For example, kafka handles batch natively and take benefit of this.

Change-Id: I16184da24b8661aff7f4fba6196ecf33165f1a77
2015-12-08 09:14:20 +01:00
Joshua Harlow
e7873550d0 Some executors are not async so update docstring to reflect that
Change-Id: I84db5adf5af0372d521e05f7c4277e1fb570f881
2015-10-16 10:44:16 -07:00
Joshua Harlow
123a0371c4 Provide the executor 'wait' function a timeout and use it
To make sure that waiting can be limited by some value, and
will not block forever add and use a timeout keyword argument
to the wait method so that waiting can be limited to some time
duration.

Change-Id: I2529e7bdc2ad449ab9de935c6bc4c6ea144e4f87
2015-09-08 15:53:31 +00:00
Joshua Harlow
93eb0febc7 Fully use futurist code-base to abstract concurrent.futures away
Change-Id: Iafa789f20d1ac365fe9da2ede2b2fa03a3b8720f
2015-07-23 11:58:49 -07:00
Mehdi Abaakouk
d94d6d6892 Allows to change defaults opts
This change introduces to possibility for the consumer application
to change the default oslo.messaging config options.

Same API interface as oslo.db have been taken.
The first option is executor_thread_pool_size.

This option was called rpc_thread_pool_size, but because it's used by
notification and rpc 'executor_thread_pool_size' looks a better name.

Changing executor_thread_pool_size default will be useful for ceilometer
the default of 64 is really to small to consume many notifications at
once for batching them. When is clearly sufficient for rpc stuffs.

Change-Id: Iea0d7a72e38d27c600403c815258aa5eee0d0c8c
2015-07-20 15:37:16 +02:00
Joshua Harlow
02a3a39814 Ensure callback variable capture + cleanup is done correctly
It appears the the callback variable that was being called on
future done was not the right one, due to the lambda capture
mechanism referring to a lazy variable which would potentially
be a different callback by the time the future would finish so
make sure we capture the right one and ensure the future has access
to it.

This adds a helper method that submission will go through
to ensure that the callback variable is correctly captured
in the created lambda and also ensures that the incomplete futures
list is cleaned up (when the future is done).

The notification listener tests use now eventlet to show up this
issue that doesn't occur with blocking executor.

Closes-bug: #1474943

Closes-bug: #1475307

Change-Id: I23e393d504662532572b5b344b87387be6d7bcb1
2015-07-16 22:05:58 +00:00
Jenkins
8a9b5d44ae Merge "Executor docstring & attribute tweaks" 2015-07-15 00:56:55 +00:00
Joshua Harlow
c5389bebce Executor docstring & attribute tweaks
Adjust some docstrings to better align with the class
they are attached to. Also changes some docstrings for
the pooled executor (as it is an abstraction on-top of
async executors, and is not tied to threads anymore) and
correctly denote this on its attributes that others can
and are overriding. 

Change-Id: I2eaaeed3aa0ae64eb5c82843381b7518ac508ac1
2015-07-14 15:43:04 +00:00
Doug Hellmann
857ccabc9c Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names. It also adds a local
hacking check to prevent regressions, while disabling style checks in
the "tests" directory, which will be deleted in a subsequent patch.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: Iad2ae13c771c99861ca9493c6ab10edcfbd8684a
2015-07-13 21:12:35 +00:00
Mehdi Abaakouk
c49594a62f Remove usage of contentmanager for executors
The context manager in the executor fit only for the blocking executor.
Even the dispatcher needs to run code before and after the application
callback, eventlet and future executors have to run the pre/post code
into the main thread and can run the callback into an other thread,
and that force them to run __enter__ and __exit__ manually and deal
the exception path.

This change adds a helper object instead of the context manager.
It is designed to be explicit on what must be executed
before and after the callback and what can be done in a thread or not.

All the executor code is now in the impl_pooledexecutor.py
and use the futures "PoolExecutor" API.

This use futurist to provide a eventlet and aioeventlet futures friendly
object.

Change-Id: I8cd7640f36beeda47560e3c82671bad3530e38d1
2015-07-08 13:42:10 +02:00