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
This commit is contained in:
parent
836f16f3fe
commit
d3e6ea1788
@ -7,3 +7,8 @@ Notification Listener
|
|||||||
.. currentmodule:: oslo.messaging
|
.. currentmodule:: oslo.messaging
|
||||||
|
|
||||||
.. autofunction:: get_notification_listener
|
.. autofunction:: get_notification_listener
|
||||||
|
|
||||||
|
.. autoclass:: MessageHandlingServer
|
||||||
|
:members:
|
||||||
|
|
||||||
|
.. autofunction:: get_local_context
|
||||||
|
@ -13,16 +13,21 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
|
from eventlet.green import threading as greenthreading
|
||||||
from eventlet import greenpool
|
from eventlet import greenpool
|
||||||
import greenlet
|
import greenlet
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo.messaging._executors import base
|
from oslo.messaging._executors import base
|
||||||
|
from oslo.messaging import localcontext
|
||||||
from oslo.utils import excutils
|
from oslo.utils import excutils
|
||||||
|
|
||||||
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
_eventlet_opts = [
|
_eventlet_opts = [
|
||||||
cfg.IntOpt('rpc_thread_pool_size',
|
cfg.IntOpt('rpc_thread_pool_size',
|
||||||
default=64,
|
default=64,
|
||||||
@ -77,6 +82,14 @@ class EventletExecutor(base.ExecutorBase):
|
|||||||
self._greenpool = greenpool.GreenPool(self.conf.rpc_thread_pool_size)
|
self._greenpool = greenpool.GreenPool(self.conf.rpc_thread_pool_size)
|
||||||
self._running = False
|
self._running = False
|
||||||
|
|
||||||
|
if not isinstance(localcontext._STORE, greenthreading.local):
|
||||||
|
LOG.debug('eventlet executor in use but the threading module '
|
||||||
|
'has not been monkeypatched or has been '
|
||||||
|
'monkeypatched after the oslo.messaging library '
|
||||||
|
'have been loaded. This will results in unpredictable '
|
||||||
|
'behavior. In the future, we will raise a '
|
||||||
|
'RuntimeException in this case.')
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
if self._thread is not None:
|
if self._thread is not None:
|
||||||
return
|
return
|
||||||
|
@ -110,6 +110,9 @@ def get_notification_listener(transport, targets, endpoints,
|
|||||||
dispatched. By default, the most simple executor is used - the blocking
|
dispatched. By default, the most simple executor is used - the blocking
|
||||||
executor.
|
executor.
|
||||||
|
|
||||||
|
If the eventlet executor is used, the threading and time library need to be
|
||||||
|
monkeypatched.
|
||||||
|
|
||||||
:param transport: the messaging transport
|
:param transport: the messaging transport
|
||||||
:type transport: Transport
|
:type transport: Transport
|
||||||
:param targets: the exchanges and topics to listen on
|
:param targets: the exchanges and topics to listen on
|
||||||
|
@ -106,6 +106,9 @@ def get_rpc_server(transport, target, endpoints,
|
|||||||
dispatched. By default, the most simple executor is used - the blocking
|
dispatched. By default, the most simple executor is used - the blocking
|
||||||
executor.
|
executor.
|
||||||
|
|
||||||
|
If the eventlet executor is used, the threading and time library need to be
|
||||||
|
monkeypatched.
|
||||||
|
|
||||||
:param transport: the messaging transport
|
:param transport: the messaging transport
|
||||||
:type transport: Transport
|
:type transport: Transport
|
||||||
:param target: the exchange, topic and server to listen on
|
:param target: the exchange, topic and server to listen on
|
||||||
|
Loading…
Reference in New Issue
Block a user