Merge "Make RPC implementation configurable"

This commit is contained in:
Jenkins 2016-07-05 11:13:01 +00:00 committed by Gerrit Code Review
commit 03a0a88d55
4 changed files with 44 additions and 1 deletions

View File

@ -231,7 +231,6 @@ def get_properly_ordered_parameters():
def main():
try:
config.parse_args(get_properly_ordered_parameters())
print_server_info()
logging.setup(CONF, 'Mistral')

View File

@ -46,6 +46,13 @@ api_opts = [
)
]
rpc_impl_opt = cfg.StrOpt(
'rpc_implementation',
default='oslo',
choices=['oslo', 'kombu'],
help='Specifies RPC implementation for RPC client and server.'
)
pecan_opts = [
cfg.StrOpt(
'root',
@ -188,6 +195,7 @@ CONF.register_opts(execution_expiration_policy_opts,
CONF.register_opt(wf_trace_log_name_opt)
CONF.register_opts(coordination_opts, group=COORDINATION_GROUP)
CONF.register_opts(profiler_opts, group=PROFILER_GROUP)
CONF.register_opt(rpc_impl_opt)
CLI_OPTS = [
@ -224,6 +232,7 @@ def list_opts():
CLI_OPTS,
[
wf_trace_log_name_opt,
rpc_impl_opt
]
))
]

View File

@ -19,6 +19,7 @@ import oslo_messaging as messaging
from oslo_messaging.rpc import client
from oslo_messaging.rpc import dispatcher
from oslo_messaging.rpc import server
from stevedore import driver
from mistral import context as auth_ctx
from mistral.engine import base
@ -29,6 +30,8 @@ from mistral.workflow import utils as wf_utils
LOG = logging.getLogger(__name__)
_IMPL_CLIENT = None
_IMPL_SERVER = None
_TRANSPORT = None
_ENGINE_CLIENT = None
@ -84,6 +87,32 @@ def get_executor_client():
return _EXECUTOR_CLIENT
def get_rpc_server_driver():
rpc_impl = cfg.CONF.rpc_implementation
global _IMPL_SERVER
if not _IMPL_SERVER:
_IMPL_SERVER = driver.DriverManager(
'mistral.engine.rpc',
'%s_server' % rpc_impl
).driver
return _IMPL_SERVER
def get_rpc_client_driver():
rpc_impl = cfg.CONF.rpc_implementation
global _IMPL_CLIENT
if not _IMPL_CLIENT:
_IMPL_CLIENT = driver.DriverManager(
'mistral.engine.rpc',
'%s_client' % rpc_impl
).driver
return _IMPL_CLIENT
class EngineServer(object):
"""RPC Engine server."""

View File

@ -40,6 +40,12 @@ console_scripts =
mistral-server = mistral.cmd.launch:main
mistral-db-manage = mistral.db.sqlalchemy.migration.cli:main
mistral.engine.rpc =
oslo_client = mistral.engine.rpc.oslo.oslo_client:OsloRPCClient
oslo_server = mistral.engine.rpc.oslo.oslo_server:OsloRPCServer
kombu_client = mistral.engine.rpc.kombu.kombu_client:KombuRPCClient
kombu_server = mistral.engine.rpc.kombu.kombu_server:KombuRPCServer
oslo.config.opts =
mistral.config = mistral.config:list_opts