Merge "Deprecate the Eventlet executor"
This commit is contained in:
commit
60f7bc2012
@ -50,7 +50,8 @@ dispatched. Refer to the Executor documentation for descriptions of the types
|
||||
of executors.
|
||||
|
||||
*Note:* If the "eventlet" executor is used, the threading and time library need
|
||||
to be monkeypatched.
|
||||
to be monkeypatched. The Eventlet executor is deprecated and the threading
|
||||
executor will be the only available executor.
|
||||
|
||||
The RPC reply operation is best-effort: the server will consider the message
|
||||
containing the reply successfully sent once it is accepted by the messaging
|
||||
@ -124,6 +125,7 @@ import logging
|
||||
import sys
|
||||
import time
|
||||
|
||||
import debtcollector
|
||||
from oslo_messaging import exceptions
|
||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
||||
from oslo_messaging import server as msg_server
|
||||
@ -217,6 +219,10 @@ class RPCServer(msg_server.MessageHandlingServer):
|
||||
del failure
|
||||
|
||||
|
||||
@debtcollector.removals.removed_kwarg(
|
||||
'executor',
|
||||
message="the eventlet executor is now deprecated. Threading "
|
||||
"will be the only execution model available.")
|
||||
def get_rpc_server(transport, target, endpoints,
|
||||
executor=None, serializer=None, access_policy=None,
|
||||
server_cls=RPCServer):
|
||||
@ -228,8 +234,9 @@ def get_rpc_server(transport, target, endpoints,
|
||||
:type target: Target
|
||||
:param endpoints: a list of endpoint objects
|
||||
:type endpoints: list
|
||||
:param executor: name of message executor - available values are
|
||||
'eventlet' and 'threading'
|
||||
:param executor: (DEPRECATED) name of message executor -
|
||||
available values are 'eventlet' and 'threading'.
|
||||
The Eventlet executor is also deprecated.
|
||||
:type executor: str
|
||||
:param serializer: an optional entity serializer
|
||||
:type serializer: Serializer
|
||||
|
@ -23,6 +23,7 @@ import logging
|
||||
import threading
|
||||
import traceback
|
||||
|
||||
import debtcollector
|
||||
from oslo_config import cfg
|
||||
from oslo_service import service
|
||||
from oslo_utils import eventletutils
|
||||
@ -305,6 +306,10 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner,
|
||||
new tasks.
|
||||
"""
|
||||
|
||||
@debtcollector.removals.removed_kwarg(
|
||||
'executor',
|
||||
message="the eventlet executor is now deprecated. Threading "
|
||||
"will be the only execution model available.")
|
||||
def __init__(self, transport, dispatcher, executor=None):
|
||||
"""Construct a message handling server.
|
||||
|
||||
@ -322,8 +327,9 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner,
|
||||
:param dispatcher: has a dispatch() method which is invoked for each
|
||||
incoming request
|
||||
:type dispatcher: DispatcherBase
|
||||
:param executor: name of message executor - available values are
|
||||
'eventlet' and 'threading'
|
||||
:param executor: (DEPRECATED) name of message executor -
|
||||
available values are 'eventlet' and 'threading'.
|
||||
The Eventlet executor is also deprecated.
|
||||
:type executor: str
|
||||
"""
|
||||
if executor and executor not in ("threading", "eventlet"):
|
||||
@ -339,11 +345,23 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner,
|
||||
self.transport = transport
|
||||
self.dispatcher = dispatcher
|
||||
self.executor_type = executor
|
||||
|
||||
if self.executor_type == "eventlet":
|
||||
eventletutils.warn_eventlet_not_patched(
|
||||
expected_patched_modules=['thread'],
|
||||
what="the 'oslo.messaging eventlet executor'")
|
||||
|
||||
debtcollector.deprecate(
|
||||
'Eventlet usages are deprecated and the removal '
|
||||
'of Eventlet from OpenStack is planned, for this reason '
|
||||
'the Eventlet executor is deprecated. '
|
||||
'Start migrating your stack to the '
|
||||
'threading executor. Please also start considering '
|
||||
'removing your internal Eventlet usages.',
|
||||
version="2025.1", removal_version="2026.1",
|
||||
category=DeprecationWarning
|
||||
)
|
||||
|
||||
self.listener = None
|
||||
|
||||
try:
|
||||
|
@ -14,6 +14,7 @@
|
||||
|
||||
import threading
|
||||
from unittest import mock
|
||||
import warnings
|
||||
|
||||
|
||||
import eventlet
|
||||
@ -139,13 +140,15 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
|
||||
self.assertIs(server.dispatcher.serializer, serializer)
|
||||
self.assertEqual('threading', server.executor_type)
|
||||
|
||||
def test_constructor_with_eventlet_executor(self):
|
||||
@mock.patch('warnings.warn')
|
||||
def test_constructor_with_eventlet_executor(self, warn):
|
||||
transport = oslo_messaging.get_rpc_transport(self.conf, url='fake:')
|
||||
target = oslo_messaging.Target(topic='foo', server='bar')
|
||||
endpoints = [object()]
|
||||
serializer = object()
|
||||
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||
|
||||
warnings.simplefilter("always", DeprecationWarning)
|
||||
server = oslo_messaging.get_rpc_server(transport,
|
||||
target,
|
||||
endpoints,
|
||||
@ -158,6 +161,22 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
|
||||
self.assertIs(server.dispatcher.endpoints, endpoints)
|
||||
self.assertIs(server.dispatcher.serializer, serializer)
|
||||
self.assertEqual('eventlet', server.executor_type)
|
||||
self.assertEqual([
|
||||
mock.call(
|
||||
"Using the 'executor' argument is deprecated: "
|
||||
"the eventlet executor is now deprecated. "
|
||||
"Threading will be the only execution model available.",
|
||||
category=DeprecationWarning, stacklevel=3),
|
||||
mock.call(
|
||||
"Eventlet usages are deprecated and the removal "
|
||||
"of Eventlet from OpenStack is planned, for this "
|
||||
"reason the Eventlet executor is deprecated. "
|
||||
"Start migrating your stack to the threading executor. "
|
||||
"Please also start considering removing your internal "
|
||||
"Eventlet usages. in version '2025.1' and will be "
|
||||
"removed in version '2026.1'",
|
||||
category=DeprecationWarning, stacklevel=3)
|
||||
], warn.mock_calls)
|
||||
|
||||
def test_constructor_with_unrecognized_executor(self):
|
||||
transport = oslo_messaging.get_rpc_transport(self.conf, url='fake:')
|
||||
|
@ -0,0 +1,12 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
Eventlet usages are deprecated and the removal of Eventlet from
|
||||
OpenStack `is planned <https://governance.openstack.org/tc//goals/proposed/remove-eventlet.html>`_, for this reason the Eventlet executor is
|
||||
deprecated. Start migrating your stack to the threading executor.
|
||||
Please also start considering removing your internal Eventlet usages.
|
||||
- |
|
||||
The `executor` parameter of the `MessageHandlingServer` class is now
|
||||
deprecated and planned for removal. The Eventlet executor is deprecated.
|
||||
Only the threading executor will remains available so the `executor`
|
||||
parameter is useless.
|
Loading…
Reference in New Issue
Block a user