Make RPC implementation configurable
Partially implements blueprint mistral-alternative-rpc Co-Authored-By: Dawid Deja <dawid.deja@intel.com> Change-Id: I7308e75625e108b5b1395b6cfa6dc1d6321fe253
This commit is contained in:
parent
2cdd95aa29
commit
fc6d712840
|
@ -231,7 +231,6 @@ def get_properly_ordered_parameters():
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
config.parse_args(get_properly_ordered_parameters())
|
config.parse_args(get_properly_ordered_parameters())
|
||||||
|
|
||||||
print_server_info()
|
print_server_info()
|
||||||
|
|
||||||
logging.setup(CONF, 'Mistral')
|
logging.setup(CONF, 'Mistral')
|
||||||
|
|
|
@ -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 = [
|
pecan_opts = [
|
||||||
cfg.StrOpt(
|
cfg.StrOpt(
|
||||||
'root',
|
'root',
|
||||||
|
@ -188,6 +195,7 @@ CONF.register_opts(execution_expiration_policy_opts,
|
||||||
CONF.register_opt(wf_trace_log_name_opt)
|
CONF.register_opt(wf_trace_log_name_opt)
|
||||||
CONF.register_opts(coordination_opts, group=COORDINATION_GROUP)
|
CONF.register_opts(coordination_opts, group=COORDINATION_GROUP)
|
||||||
CONF.register_opts(profiler_opts, group=PROFILER_GROUP)
|
CONF.register_opts(profiler_opts, group=PROFILER_GROUP)
|
||||||
|
CONF.register_opt(rpc_impl_opt)
|
||||||
|
|
||||||
|
|
||||||
CLI_OPTS = [
|
CLI_OPTS = [
|
||||||
|
@ -224,6 +232,7 @@ def list_opts():
|
||||||
CLI_OPTS,
|
CLI_OPTS,
|
||||||
[
|
[
|
||||||
wf_trace_log_name_opt,
|
wf_trace_log_name_opt,
|
||||||
|
rpc_impl_opt
|
||||||
]
|
]
|
||||||
))
|
))
|
||||||
]
|
]
|
||||||
|
|
|
@ -19,6 +19,7 @@ import oslo_messaging as messaging
|
||||||
from oslo_messaging.rpc import client
|
from oslo_messaging.rpc import client
|
||||||
from oslo_messaging.rpc import dispatcher
|
from oslo_messaging.rpc import dispatcher
|
||||||
from oslo_messaging.rpc import server
|
from oslo_messaging.rpc import server
|
||||||
|
from stevedore import driver
|
||||||
|
|
||||||
from mistral import context as auth_ctx
|
from mistral import context as auth_ctx
|
||||||
from mistral.engine import base
|
from mistral.engine import base
|
||||||
|
@ -29,6 +30,8 @@ from mistral.workflow import utils as wf_utils
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
|
_IMPL_CLIENT = None
|
||||||
|
_IMPL_SERVER = None
|
||||||
_TRANSPORT = None
|
_TRANSPORT = None
|
||||||
|
|
||||||
_ENGINE_CLIENT = None
|
_ENGINE_CLIENT = None
|
||||||
|
@ -84,6 +87,32 @@ def get_executor_client():
|
||||||
return _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):
|
class EngineServer(object):
|
||||||
"""RPC Engine server."""
|
"""RPC Engine server."""
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,12 @@ console_scripts =
|
||||||
mistral-server = mistral.cmd.launch:main
|
mistral-server = mistral.cmd.launch:main
|
||||||
mistral-db-manage = mistral.db.sqlalchemy.migration.cli: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 =
|
oslo.config.opts =
|
||||||
mistral.config = mistral.config:list_opts
|
mistral.config = mistral.config:list_opts
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue