Beispiel #1
0
def init_wsgi():
    # By default, oslo.config parses the CLI args if no args is provided.
    # As a result, invoking this wsgi script from gunicorn leads to the error
    # with argparse complaining that the CLI options have already been parsed.
    m_config.parse_args(args=[])

    return setup_app()
Beispiel #2
0
def main():
    try:
        config.parse_args()
        logging.setup('Mistral')

        # Map cli options to appropriate functions. The cli options are
        # registered in mistral's config.py.
        launch_options = {
            'all': launch_all,
            'api': launch_api,
            'engine': launch_engine,
            'executor': launch_executor
        }

        # Please refer to the oslo.messaging documentation for transport
        # configuration. The default transport for oslo.messaging is rabbitMQ.
        # The available transport drivers are listed under oslo.messaging at
        # ./oslo/messaging/rpc/_drivers.  The drivers are prefixed with "impl".
        # The transport driver is specified using the rpc_backend option in the
        # default section of the oslo configuration file. The expected value
        # for rpc_backend is the last part of the driver name. For example,
        # the driver for rabbit is impl_rabbit and for the fake driver is
        # impl_fake. The rpc_backend value for these are "rabbit" and "fake"
        # respectively. There are additional options such as ssl and credential
        # that can be specified depending on the driver.  Please refer to the
        # driver implementation for those additional options.
        transport = messaging.get_transport(cfg.CONF)

        # Launch server(s).
        launch_options[cfg.CONF.server](transport)

    except RuntimeError, e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #3
0
def main():
    try:
        config.parse_args()
        logging.setup('Mistral')

        # TODO(rakhmerov): This is a temporary hack.
        # We have to initialize engine in executor process because
        # executor now calls engine.convey_task_result() directly.
        engine.load_engine()

        # Please refer to the oslo.messaging documentation for transport
        # configuration. The default transport for oslo.messaging is rabbitMQ.
        # The available transport drivers are listed under oslo.messaging at
        # ./oslo/messaging/rpc/_drivers.  The drivers are prefixed with "impl".
        # The transport driver is specified using the rpc_backend option in the
        # default section of the oslo configuration file. The expected value
        # for rpc_backend is the last part of the driver name. For example,
        # the driver for rabbit is impl_rabbit and for the fake driver is
        # impl_fake. The rpc_backend value for these are "rabbit" and "fake"
        # respectively. There are additional options such as ssl and credential
        # that can be specified depending on the driver.  Please refer to the
        # driver implementation for those additional options.
        transport = messaging.get_transport(cfg.CONF)
        target = messaging.Target(topic=cfg.CONF.executor.topic,
                                  server=cfg.CONF.executor.host)
        endpoints = [server.Executor()]

        ex_server = messaging.get_rpc_server(transport, target, endpoints)
        ex_server.start()
        ex_server.wait()
    except RuntimeError, e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #4
0
def init_wsgi():
    # By default, oslo.config parses the CLI args if no args is provided.
    # As a result, invoking this wsgi script from gunicorn leads to the error
    # with argparse complaining that the CLI options have already been parsed.
    m_config.parse_args(args=[])

    return setup_app()
Beispiel #5
0
def main():
    # NOTE(jaosorior): This is needed in order for db-sync to also register the
    # keystonemiddleware options. Those options are used by clients that need a
    # keystone session in order to be able to register their actions.
    # This can be removed when mistral moves out of using keystonemiddleware in
    # favor of keystoneauth1.
    for group, opts in keystonemw_opts.list_auth_token_opts():
        CONF.register_opts(opts, group=group)

    CONF.register_cli_opt(config.os_actions_mapping_path)

    logging.register_options(CONF)

    config.parse_args()

    if len(CONF.config_file) == 0:
        print("Usage: sync_db --config-file <path-to-config-file>")
        return exit(1)
    logging.setup(CONF, 'Mistral')

    LOG.info("Starting db_sync")

    LOG.debug("Setting up db")
    db_api.setup_db()

    LOG.debug("populating db")
    action_manager.sync_db()
    workflows.sync_db()
Beispiel #6
0
def main():
    try:
        config.parse_args()
        logging.setup('Mistral')

        # Map cli options to appropriate functions. The cli options are
        # registered in mistral's config.py.
        launch_options = {
            'all': launch_all,
            'api': launch_api,
            'engine': launch_engine,
            'executor': launch_executor
        }

        # Please refer to the oslo.messaging documentation for transport
        # configuration. The default transport for oslo.messaging is rabbitMQ.
        # The available transport drivers are listed under oslo.messaging at
        # ./oslo/messaging/rpc/_drivers.  The drivers are prefixed with "impl".
        # The transport driver is specified using the rpc_backend option in the
        # default section of the oslo configuration file. The expected value
        # for rpc_backend is the last part of the driver name. For example,
        # the driver for rabbit is impl_rabbit and for the fake driver is
        # impl_fake. The rpc_backend value for these are "rabbit" and "fake"
        # respectively. There are additional options such as ssl and credential
        # that can be specified depending on the driver.  Please refer to the
        # driver implementation for those additional options.
        transport = messaging.get_transport(cfg.CONF)

        # Launch server(s).
        launch_options[cfg.CONF.server](transport)

    except RuntimeError, e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #7
0
def main():
    config.parse_args()

    if len(CONF.config_file) == 0:
        print("Usage: sync_db --config-file <path-to-config-file>")
        return exit(1)

    logging.setup(CONF, 'Mistral')

    db_api.setup_db()

    action_manager.sync_db()
    workflows.sync_db()
Beispiel #8
0
def main():
    config.parse_args()

    if len(CONF.config_file) == 0:
        print "Usage: sync_db --config-file <path-to-config-file>"
        return exit(1)

    logging.setup('Mistral')

    db_api.setup_db()

    action_manager.sync_db()
    workflows.sync_db()
Beispiel #9
0
def main():
    try:
        config.parse_args()
        logging.setup('Mistral')

        host = cfg.CONF.api.host
        port = cfg.CONF.api.port

        server = simple_server.make_server(host, port, app.setup_app())

        LOG.info("Mistral API is serving on http://%s:%s (PID=%s)" %
                 (host, port, os.getpid()))

        server.serve_forever()
    except RuntimeError, e:
        sys.stderr.write("ERROR: %s\n" % e)
        sys.exit(1)
Beispiel #10
0
def main():
    try:
        CONF.register_cli_opts(config.CLI_OPTS)

        config.parse_args(get_properly_ordered_parameters())

        print_server_info()

        logging.setup(CONF, 'Mistral')

        override_keystone_options()

        # Please refer to the oslo.messaging documentation for transport
        # configuration. The default transport for oslo.messaging is
        # rabbitMQ. The available transport drivers are listed in the
        # setup.cfg file in oslo.messaging under the entry_points section for
        # oslo.messaging.drivers. The transport driver is specified using the
        # rpc_backend option in the default section of the oslo configuration
        # file. The expected value for the rpc_backend is one of the key
        # values available for the oslo.messaging.drivers (i.e. rabbit, fake).
        # There are additional options such as ssl and credential that can be
        # specified depending on the driver.  Please refer to the driver
        # implementation for those additional options. It's important to note
        # that the "fake" transport should only be used if "all" the Mistral
        # servers are launched on the same process. Otherwise, messages do not
        # get delivered if the Mistral servers are launched on different
        # processes because the "fake" transport is using an in process queue.
        rpc.get_transport()

        if cfg.CONF.server == ['all']:
            # Launch all servers.
            launch_any(LAUNCH_OPTIONS.keys())
        else:
            # Validate launch option.
            if set(cfg.CONF.server) - set(LAUNCH_OPTIONS.keys()):
                raise Exception(
                    "Valid options are 'all' or any combination of [%s]" %
                    ', '.join(LAUNCH_OPTIONS.keys()))

            # Launch distinct set of server(s).
            launch_any(set(cfg.CONF.server))

    except RuntimeError as excp:
        sys.stderr.write("ERROR: %s\n" % excp)
        sys.exit(1)
Beispiel #11
0
def main():
    try:
        config.parse_args(get_properly_ordered_parameters())

        print_server_info()

        logging.setup(CONF, 'Mistral')

        # Please refer to the oslo.messaging documentation for transport
        # configuration. The default transport for oslo.messaging is
        # rabbitMQ. The available transport drivers are listed in the
        # setup.cfg file in oslo.messaging under the entry_points section for
        # oslo.messaging.drivers. The transport driver is specified using the
        # rpc_backend option in the default section of the oslo configuration
        # file. The expected value for the rpc_backend is one of the key
        # values available for the oslo.messaging.drivers (i.e. rabbit, fake).
        # There are additional options such as ssl and credential that can be
        # specified depending on the driver.  Please refer to the driver
        # implementation for those additional options. It's important to note
        # that the "fake" transport should only be used if "all" the Mistral
        # servers are launched on the same process. Otherwise, messages do not
        # get delivered if the Mistral servers are launched on different
        # processes because the "fake" transport is using an in process queue.
        transport = rpc.get_transport()

        if cfg.CONF.server == ['all']:
            # Launch all servers.
            launch_any(transport, LAUNCH_OPTIONS.keys())
        else:
            # Validate launch option.
            if set(cfg.CONF.server) - set(LAUNCH_OPTIONS.keys()):
                raise Exception('Valid options are all or any combination of '
                                'api, engine, and executor.')

            # Launch distinct set of server(s).
            launch_any(transport, set(cfg.CONF.server))

    except RuntimeError as excp:
        sys.stderr.write("ERROR: %s\n" % excp)
        sys.exit(1)
Beispiel #12
0
# Copyright 2015 - StackStorm, Inc.
#
#    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.

from mistral.api import app
from mistral import config

config.parse_args()
application = app.setup_app()
Beispiel #13
0
# Copyright 2015 - StackStorm, Inc.
#
#    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.

from mistral.api import app
from mistral import config

# By default, oslo.config parses the CLI args if no args is provided.
# As a result, invoking this wsgi script from gunicorn leads to the error
# with argparse complaining that the CLI options have already been parsed.
config.parse_args(args=[])

application = app.setup_app()