<commit_before>#!/usr/bin/env python
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Senlin API Server.
"""
import sys

from oslo_config import cfg
from oslo_i18n import _lazy
from oslo_log import log as logging
from oslo_service import systemd
import six

from senlin.api.common import wsgi
from senlin.common.i18n import _LI
from senlin.common import messaging
from senlin.common import profiler
from senlin import version

_lazy.enable_lazy()

LOG = logging.getLogger('senlin.api')


def main():
    try:
        logging.register_options(cfg.CONF)
        cfg.CONF(project='senlin', prog='senlin-api',
                 version=version.version_info.version_string())
        logging.setup(cfg.CONF, 'senlin-api')
        messaging.setup()

        app = wsgi.load_paste_app()

        host = cfg.CONF.senlin_api.bind_host
        port = cfg.CONF.senlin_api.bind_port
        LOG.info(_LI('Starting Senlin API on %(host)s:%(port)s'),
                 {'host': host, 'port': port})
        profiler.setup('senlin-api', host)
        server = wsgi.Server('senlin-api', cfg.CONF.senlin_api)
        server.start(app, default_port=port)
        systemd.notify_once()
        server.wait()
    except RuntimeError as ex:
        sys.exit("ERROR: %s" % six.text_type(ex))<commit_msg>Ensure objects are registered in api process<commit_after>#!/usr/bin/env python
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Senlin API Server.
"""
import sys

from oslo_config import cfg
from oslo_i18n import _lazy
from oslo_log import log as logging
from oslo_service import systemd
import six

from senlin.api.common import wsgi
from senlin.common.i18n import _LI
from senlin.common import messaging
from senlin.common import profiler
from senlin import objects
from senlin import version

_lazy.enable_lazy()

LOG = logging.getLogger('senlin.api')


def main():
    try:
        logging.register_options(cfg.CONF)
        cfg.CONF(project='senlin', prog='senlin-api',
                 version=version.version_info.version_string())
        logging.setup(cfg.CONF, 'senlin-api')
        objects.register_all()
        messaging.setup()

        app = wsgi.load_paste_app()

        host = cfg.CONF.senlin_api.bind_host
        port = cfg.CONF.senlin_api.bind_port
        LOG.info(_LI('Starting Senlin API on %(host)s:%(port)s'),
                 {'host': host, 'port': port})
        profiler.setup('senlin-api', host)
        server = wsgi.Server('senlin-api', cfg.CONF.senlin_api)
        server.start(app, default_port=port)
        systemd.notify_once()
        server.wait()
    except RuntimeError as ex:
        sys.exit("ERROR: %s" % six.text_type(ex))
{'fraction_non_alphanumeric': 0.09738332883733478, 'fraction_numerical': 0.004316158618829242, 'mean_word_length': 3.143016759776536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '609866', 'n_tokens_mistral': 1124, 'n_tokens_neox': 1102, 'n_words': 348}