tacker-conductor with oslo.service threading
Move the tacker-conductor entry point out of `tacker.cmd.eventlet` and select the oslo.service threading backend via `init_backend()` instead of monkey patching the process. `oslo.service` components used by the conductor (loopingcall, periodic_task, service.launch) are resolved through the backend, so they switch to native threads without code changes. The deprecated executor argument of `get_rpc_server()` is dropped: oslo.messaging auto-detects the executor, choosing `eventlet` when the process is monkey patched (tacker-server) and `threading` otherwise (tacker-conductor). The threading backend of `oslo.service` requires the cotyledon and futurist extras, so the requirement is bumped to oslo.service[threading]>=4.6.0. Guard the `init_backend()` call with `get_backend_type() is None` so that importing this module after `tacker.cmd.eventlet` in the same process does not raise BackendAlreadySelected. This happens when Sphinx apidoc imports every module under tacker/ in a single process to build the docs. Add pyproject.toml since openstack/requirements project-requirements-change.py check now requires master-branch projects to declare their build backend via pyproject.toml, following pbr 6.x's move to PEP 517 builds. Depends-On: I984006c155c4f18d005611dcb7b002d1c2fb355d Signed-off-by: Yasufumi Ogawa <yasufum.o@gmail.com> Change-Id: Ib8d82141314e931a7e7af0ea3cb686093e2d5f4e
This commit is contained in:
1 parent
628a240867
commit
d7d54b00e3
5 files changed
+22
-5
No files matched your search
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["pbr>=6.0.0", "setuptools>=64.0.0"]
|
||||
build-backend = "pbr.build"
|
||||
+1
-1
@@ -30,7 +30,7 @@ oslo.middleware>=3.31.0 # Apache-2.0
|
||||
oslo.policy>=4.5.0 # Apache-2.0
|
||||
oslo.reports>=1.18.0 # Apache-2.0
|
||||
oslo.serialization!=2.19.1,>=2.18.0 # Apache-2.0
|
||||
oslo.service>=2.5.0 # Apache-2.0
|
||||
oslo.service[threading]>=4.6.0 # Apache-2.0
|
||||
oslo.upgradecheck>=1.3.0 # Apache-2.0
|
||||
oslo.utils>=7.0.0 # Apache-2.0
|
||||
oslo.versionedobjects>=1.33.3 # Apache-2.0
|
||||
|
||||
@@ -38,7 +38,7 @@ setup-hooks =
|
||||
console_scripts =
|
||||
tacker-db-manage = tacker.db.migration.cli:main
|
||||
tacker-server = tacker.cmd.eventlet.tacker_server:main
|
||||
tacker-conductor = tacker.cmd.eventlet.conductor:main
|
||||
tacker-conductor = tacker.cmd.conductor:main
|
||||
tacker-status = tacker.cmd.status:main
|
||||
tacker.service_plugins =
|
||||
dummy = tacker.tests.unit.dummy_plugin:DummyServicePlugin
|
||||
|
||||
@@ -10,8 +10,19 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from tacker.conductor import conductor_server
|
||||
from tacker import objects
|
||||
# NOTE: init_backend() can be called only once per process and must run
|
||||
# before any other oslo.service module is imported, otherwise the default
|
||||
# eventlet backend is selected implicitly. The get_backend_type() guard
|
||||
# avoids BackendAlreadySelected when this module is imported alongside
|
||||
# tacker.cmd.eventlet in the same process, e.g. by Sphinx autodoc during
|
||||
# the docs build.
|
||||
from oslo_service import backend
|
||||
|
||||
if backend.get_backend_type() is None:
|
||||
backend.init_backend(backend.BackendType.THREADING)
|
||||
|
||||
from tacker.conductor import conductor_server # noqa: E402
|
||||
from tacker import objects # noqa: E402
|
||||
|
||||
|
||||
def main():
|
||||
@@ -206,8 +206,11 @@ def get_server(target, endpoints, serializer=None):
|
||||
assert TRANSPORT is not None
|
||||
serializer = RequestContextSerializer(serializer)
|
||||
access_policy = dispatcher.DefaultRPCAccessPolicy
|
||||
# NOTE: The executor is auto-detected by oslo.messaging: 'eventlet'
|
||||
# when the process is monkey patched (tacker-server), 'threading'
|
||||
# otherwise (tacker-conductor).
|
||||
return oslo_messaging.get_rpc_server(TRANSPORT, target, endpoints,
|
||||
'eventlet', serializer,
|
||||
serializer=serializer,
|
||||
access_policy=access_policy)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user