Esempio n. 1
0
def start_web_rest_server(models, rest_port):
    d = PathInfoDispatcher({'/': create_rest_api(models)})
    server = WSGIServer(('0.0.0.0', rest_port),
                        d,
                        numthreads=1,
                        request_queue_size=50)

    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()
def start_web_rest_server(models, rest_port, num_threads):
    d = PathInfoDispatcher({'/': create_rest_api(models)})
    server = WSGIServer(('0.0.0.0', rest_port), d,
                        numthreads=num_threads,
                        request_queue_size=GLOBAL_CONFIG[
                            'rest_requests_queue_size'])
    logger.info("REST server listens on port {port} and will be "
                "serving models: {models}".format(port=rest_port,
                                                  models=list(models.keys())))
    try:
        server.start()
    except KeyboardInterrupt:
        server.stop()
Esempio n. 3
0
def client(get_fake_model):
    rest_api = create_rest_api(models={"test": get_fake_model})
    return testing.TestClient(rest_api)