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 oslo_config import cfg
25 from oslo_log import log
26 # from oslo_policy import opts as policy_opts
27 from oslo_reports import guru_meditation_report as gmr
29 from conductor.conf import defaults
30 # from conductor import keystone_client
31 from conductor import messaging
32 from conductor import version
36 # default=socket.gethostname(),
37 # sample_default='<your_hostname>',
38 # help='Name of this node, which must be valid in an AMQP '
39 # 'key. Can be an opaque identifier. For ZeroMQ only, must '
40 # 'be a valid host name, FQDN, or IP address.'),
41 # cfg.IntOpt('http_timeout',
43 # help='Timeout seconds for HTTP requests. Set it to None to '
44 # 'disable timeout.'),
45 cfg.StrOpt('keyspace',
47 help='Music keyspace for content'),
48 cfg.IntOpt('delay_time',
50 help='Delay time (Seconds) for MUSIC requests. Set it to 2 seconds '
52 #TODO(larry): move to a new section [feature_supported] in config file
53 cfg.BoolOpt('HPA_enabled',
56 cfg.CONF.register_opts(OPTS)
58 # DATA_OPT = cfg.IntOpt('workers',
61 # help='Number of workers for data service, '
62 # 'default value is 1.')
63 # cfg.CONF.register_opt(DATA_OPT, 'data')
65 # PARSER_OPT = cfg.IntOpt('workers',
68 # help='Number of workers for parser service. '
69 # 'default value is 1.')
70 # cfg.CONF.register_opt(PARSER_OPT, 'parser')
72 # SOLVER_OPT = cfg.IntOpt('workers',
75 # help='Number of workers for solver service. '
76 # 'default value is 1.')
77 # cfg.CONF.register_opt(SOLVER_OPT, 'solver')
79 # keystone_client.register_keystoneauth_opts(cfg.CONF)
82 def prepare_service(argv=None, config_files=None):
86 # FIXME(sileht): Use ConfigOpts() instead
89 oslo_i18n.enable_lazy()
90 log.register_options(conf)
91 log_levels = (conf.default_log_levels +
93 log.set_defaults(default_log_levels=log_levels)
94 defaults.set_cors_middleware_defaults()
95 # policy_opts.set_defaults(conf)
97 conf(argv[1:], project='conductor', validate_default_values=True,
98 version=version.version_info.version_string(),
99 default_config_files=config_files)
101 # ka_loading.load_auth_from_conf_options(conf, "service_credentials")
103 log.setup(conf, 'conductor')
104 # NOTE(liusheng): guru cannot run with service under apache daemon, so when
105 # conductor-api running with mod_wsgi, the argv is [], we don't start
108 gmr.TextGuruMeditation.setup_autorun(version)