2 # -------------------------------------------------------------------------
3 # Copyright (c) 2015-2017 AT&T Intellectual Property
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # -------------------------------------------------------------------------
22 # from keystoneauth1 import loading as ka_loading
23 from conductor.common import sms
24 from oslo_config import cfg
26 from oslo_log import log
27 # from oslo_policy import opts as policy_opts
28 from oslo_reports import guru_meditation_report as gmr
30 from conductor.conf import defaults
31 # from conductor import keystone_client
32 from conductor import messaging
33 from conductor import version
37 # default=socket.gethostname(),
38 # sample_default='<your_hostname>',
39 # help='Name of this node, which must be valid in an AMQP '
40 # 'key. Can be an opaque identifier. For ZeroMQ only, must '
41 # 'be a valid host name, FQDN, or IP address.'),
42 # cfg.IntOpt('http_timeout',
44 # help='Timeout seconds for HTTP requests. Set it to None to '
45 # 'disable timeout.'),
46 cfg.StrOpt('keyspace',
48 help='Music keyspace for content'),
49 cfg.IntOpt('delay_time',
51 help='Delay time (Seconds) for MUSIC requests. Set it to 2 seconds '
53 #TODO(larry): move to a new section [feature_supported] in config file
54 cfg.BoolOpt('HPA_enabled',
57 cfg.CONF.register_opts(OPTS)
59 # DATA_OPT = cfg.IntOpt('workers',
62 # help='Number of workers for data service, '
63 # 'default value is 1.')
64 # cfg.CONF.register_opt(DATA_OPT, 'data')
66 # PARSER_OPT = cfg.IntOpt('workers',
69 # help='Number of workers for parser service. '
70 # 'default value is 1.')
71 # cfg.CONF.register_opt(PARSER_OPT, 'parser')
73 # SOLVER_OPT = cfg.IntOpt('workers',
76 # help='Number of workers for solver service. '
77 # 'default value is 1.')
78 # cfg.CONF.register_opt(SOLVER_OPT, 'solver')
80 # keystone_client.register_keystoneauth_opts(cfg.CONF)
83 def prepare_service(argv=None, config_files=None):
87 # FIXME(sileht): Use ConfigOpts() instead
90 oslo_i18n.enable_lazy()
91 log.register_options(conf)
92 log_levels = (conf.default_log_levels +
94 log.set_defaults(default_log_levels=log_levels)
95 defaults.set_cors_middleware_defaults()
96 # policy_opts.set_defaults(conf)
98 conf(argv[1:], project='conductor', validate_default_values=True,
99 version=version.version_info.version_string(),
100 default_config_files=config_files)
102 # ka_loading.load_auth_from_conf_options(conf, "service_credentials")
104 log.setup(conf, 'conductor')
105 # NOTE(liusheng): guru cannot run with service under apache daemon, so when
106 # conductor-api running with mod_wsgi, the argv is [], we don't start
109 gmr.TextGuruMeditation.setup_autorun(version)
111 # Load secrets from SMS
112 if conf.aaf_sms.is_enabled: