Exemplo n.º 1
0
def launch(app_name,
           port,
           paste_config_file,
           data={},
           host='0.0.0.0',
           backlog=128,
           threads=1000,
           workers=None):
    """Launches a wsgi server based on the passed in paste_config_file.

      Launch provides a easy way to create a paste app from the config
      file and launch it via the service launcher. It takes care of
      all of the plumbing. The only caveat is that the paste_config_file
      must be a file that paste.deploy can find and handle. There is
      a helper method in cfg.py that finds files.

      Example:
        conf_file = CONF.find_file(CONF.api_paste_config)
        launcher = wsgi.launch('myapp', CONF.bind_port, conf_file)
        launcher.wait()

    """
    LOG.debug("Trove started on %s", host)
    app = pastedeploy.paste_deploy_app(paste_config_file, app_name, data)
    server = base_wsgi.Service(app,
                               port,
                               host=host,
                               backlog=backlog,
                               threads=threads)
    return service.launch(CONF, server, workers)
Exemplo n.º 2
0
def initialize_trove(config_file):
    from trove.common import pastedeploy

    root_logger.DefaultRootLogger()

    cfg.CONF(args=[], project="trove", default_config_files=[config_file])
    logging.setup(CONF, None)
    topic = CONF.taskmanager_queue
    rpc.init(CONF)

    taskman_service = rpc_service.RpcService(
        None, topic=topic, rpc_api_version=rpc_version.RPC_API_VERSION, manager="trove.taskmanager.manager.Manager"
    )
    taskman_service.start()

    return pastedeploy.paste_deploy_app(config_file, "trove", {})
Exemplo n.º 3
0
def initialize_trove(config_file):
    from trove.common import pastedeploy

    cfg.CONF(args=[], project='trove', default_config_files=[config_file])
    logging.setup(CONF, None)
    topic = CONF.taskmanager_queue
    rpc.init(CONF)

    taskman_service = rpc_service.RpcService(
        None,
        topic=topic,
        rpc_api_version=rpc_version.RPC_API_VERSION,
        manager='trove.taskmanager.manager.Manager')
    taskman_service.start()

    return pastedeploy.paste_deploy_app(config_file, 'trove', {})
Exemplo n.º 4
0
def launch(app_name, port, paste_config_file, data={},
           host='0.0.0.0', backlog=128, threads=1000, workers=None):
    """Launches a wsgi server based on the passed in paste_config_file.

      Launch provides a easy way to create a paste app from the config
      file and launch it via the service launcher. It takes care of
      all of the plumbing. The only caveat is that the paste_config_file
      must be a file that paste.deploy can find and handle. There is
      a helper method in cfg.py that finds files.

      Example:
        conf_file = CONF.find_file(CONF.api_paste_config)
        launcher = wsgi.launch('myapp', CONF.bind_port, conf_file)
        launcher.wait()

    """
    LOG.debug("Trove started on %s", host)
    app = pastedeploy.paste_deploy_app(paste_config_file, app_name, data)
    server = base_wsgi.Service(app, port, host=host,
                               backlog=backlog, threads=threads)
    return service.launch(CONF, server, workers)