예제 #1
0
def launch_executor():
    profiler.setup('mistral-executor', cfg.CONF.executor.host)

    executor_v2 = def_executor.DefaultExecutor(rpc.get_engine_client())
    executor_endpoint = rpc.ExecutorServer(executor_v2)

    executor_server = rpc.get_rpc_server_driver()(
        rpc_utils.get_rpc_info_from_oslo(CONF.executor))
    executor_server.register_endpoint(executor_endpoint)

    executor_v2.register_membership()

    try:
        executor_server.run(executor='threading')
    except (KeyboardInterrupt, SystemExit):
        pass
    finally:
        print("Stopping executor service...")
예제 #2
0
def launch_executor_server(transport, executor):
    target = messaging.Target(topic=cfg.CONF.executor.topic,
                              server=cfg.CONF.executor.host)

    server = messaging.get_rpc_server(transport,
                                      target, [rpc.ExecutorServer(executor)],
                                      executor='blocking',
                                      serializer=ctx.RpcContextSerializer(
                                          ctx.JsonPayloadSerializer()))

    try:
        server.start()
        while True:
            eventlet.sleep(604800)
    except (KeyboardInterrupt, SystemExit):
        LOG.info("Stopping executor service...")
    finally:
        server.stop()
        server.wait()