Deprecate the Eventlet executor
The removal of Eventlet is planned[1]. Services should start migrating there RPC server to the threading executor. The Eventlet executor will be removed in G. The executor parameter is now planned for removal. [1] https://governance.openstack.org/tc//goals/proposed/remove-eventlet.html Change-Id: I9dc3fe42931c84ad2aef35cb663ba019e3bf26b7
This commit is contained in:
parent
5994f3ca95
commit
27d833e374
@ -50,7 +50,8 @@ dispatched. Refer to the Executor documentation for descriptions of the types
|
|||||||
of executors.
|
of executors.
|
||||||
|
|
||||||
*Note:* If the "eventlet" executor is used, the threading and time library need
|
*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
|
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
|
containing the reply successfully sent once it is accepted by the messaging
|
||||||
@ -124,6 +125,7 @@ import logging
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
import debtcollector
|
||||||
from oslo_messaging import exceptions
|
from oslo_messaging import exceptions
|
||||||
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
from oslo_messaging.rpc import dispatcher as rpc_dispatcher
|
||||||
from oslo_messaging import server as msg_server
|
from oslo_messaging import server as msg_server
|
||||||
@ -217,6 +219,10 @@ class RPCServer(msg_server.MessageHandlingServer):
|
|||||||
del failure
|
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,
|
def get_rpc_server(transport, target, endpoints,
|
||||||
executor=None, serializer=None, access_policy=None,
|
executor=None, serializer=None, access_policy=None,
|
||||||
server_cls=RPCServer):
|
server_cls=RPCServer):
|
||||||
@ -228,8 +234,9 @@ def get_rpc_server(transport, target, endpoints,
|
|||||||
:type target: Target
|
:type target: Target
|
||||||
:param endpoints: a list of endpoint objects
|
:param endpoints: a list of endpoint objects
|
||||||
:type endpoints: list
|
:type endpoints: list
|
||||||
:param executor: name of message executor - available values are
|
:param executor: (DEPRECATED) name of message executor -
|
||||||
'eventlet' and 'threading'
|
available values are 'eventlet' and 'threading'.
|
||||||
|
The Eventlet executor is also deprecated.
|
||||||
:type executor: str
|
:type executor: str
|
||||||
:param serializer: an optional entity serializer
|
:param serializer: an optional entity serializer
|
||||||
:type serializer: Serializer
|
:type serializer: Serializer
|
||||||
|
@ -23,6 +23,7 @@ import logging
|
|||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
|
|
||||||
|
import debtcollector
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
from oslo_service import service
|
from oslo_service import service
|
||||||
from oslo_utils import eventletutils
|
from oslo_utils import eventletutils
|
||||||
@ -305,6 +306,10 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner,
|
|||||||
new tasks.
|
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):
|
def __init__(self, transport, dispatcher, executor=None):
|
||||||
"""Construct a message handling server.
|
"""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
|
:param dispatcher: has a dispatch() method which is invoked for each
|
||||||
incoming request
|
incoming request
|
||||||
:type dispatcher: DispatcherBase
|
:type dispatcher: DispatcherBase
|
||||||
:param executor: name of message executor - available values are
|
:param executor: (DEPRECATED) name of message executor -
|
||||||
'eventlet' and 'threading'
|
available values are 'eventlet' and 'threading'.
|
||||||
|
The Eventlet executor is also deprecated.
|
||||||
:type executor: str
|
:type executor: str
|
||||||
"""
|
"""
|
||||||
if executor and executor not in ("threading", "eventlet"):
|
if executor and executor not in ("threading", "eventlet"):
|
||||||
@ -339,11 +345,23 @@ class MessageHandlingServer(service.ServiceBase, _OrderedTaskRunner,
|
|||||||
self.transport = transport
|
self.transport = transport
|
||||||
self.dispatcher = dispatcher
|
self.dispatcher = dispatcher
|
||||||
self.executor_type = executor
|
self.executor_type = executor
|
||||||
|
|
||||||
if self.executor_type == "eventlet":
|
if self.executor_type == "eventlet":
|
||||||
eventletutils.warn_eventlet_not_patched(
|
eventletutils.warn_eventlet_not_patched(
|
||||||
expected_patched_modules=['thread'],
|
expected_patched_modules=['thread'],
|
||||||
what="the 'oslo.messaging eventlet executor'")
|
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
|
self.listener = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
|
|
||||||
import threading
|
import threading
|
||||||
from unittest import mock
|
from unittest import mock
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
import eventlet
|
import eventlet
|
||||||
@ -140,13 +141,15 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
|
|||||||
self.assertIs(server.dispatcher.serializer, serializer)
|
self.assertIs(server.dispatcher.serializer, serializer)
|
||||||
self.assertEqual('threading', server.executor_type)
|
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:')
|
transport = oslo_messaging.get_rpc_transport(self.conf, url='fake:')
|
||||||
target = oslo_messaging.Target(topic='foo', server='bar')
|
target = oslo_messaging.Target(topic='foo', server='bar')
|
||||||
endpoints = [object()]
|
endpoints = [object()]
|
||||||
serializer = object()
|
serializer = object()
|
||||||
access_policy = dispatcher.DefaultRPCAccessPolicy
|
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||||
|
|
||||||
|
warnings.simplefilter("always", DeprecationWarning)
|
||||||
server = oslo_messaging.get_rpc_server(transport,
|
server = oslo_messaging.get_rpc_server(transport,
|
||||||
target,
|
target,
|
||||||
endpoints,
|
endpoints,
|
||||||
@ -159,6 +162,22 @@ class TestRPCServer(test_utils.BaseTestCase, ServerSetupMixin):
|
|||||||
self.assertIs(server.dispatcher.endpoints, endpoints)
|
self.assertIs(server.dispatcher.endpoints, endpoints)
|
||||||
self.assertIs(server.dispatcher.serializer, serializer)
|
self.assertIs(server.dispatcher.serializer, serializer)
|
||||||
self.assertEqual('eventlet', server.executor_type)
|
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):
|
def test_constructor_with_unrecognized_executor(self):
|
||||||
transport = oslo_messaging.get_rpc_transport(self.conf, url='fake:')
|
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