Esempio n. 1
0
def serve():
    parser = argparse.ArgumentParser(description="DaMainServer DA")
    parser.add_argument("-p", "--port",
                        nargs="?",
                        dest="port",
                        required=True,
                        type=int,
                        help="port to access server")
    args = parser.parse_args()
    data = [
        ('grpc.max_connection_idle_ms', 10000),
        ('grpc.max_connection_age_ms', 10000)
    ]
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), None, data, None)

    talk_pb2_grpc.add_DialogAgentProviderServicer_to_server(DaMainServer(), server)
    listen = "[::]" + ":" + str(args.port)
    server.add_insecure_port(listen)
    server.start()

    try:
        while True:
            time.sleep(__ONE_DAY_IN_SECONDS__)
    except KeyboardInterrupt:
        server.stop(0)
Esempio n. 2
0
def serve():
    parser = argparse.ArgumentParser(description='CMS DA')
    parser.add_argument('-p', '--port',
                        nargs='?',
                        dest='port',
                        required=True,
                        type=int,
                        help='port to access server')
    args = parser.parse_args()

    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    talk_pb2_grpc.add_DialogAgentProviderServicer_to_server(
        EchoDa(), server)

    listen = '[::]' + ':' + str(args.port)
    server.add_insecure_port(listen)

    server.start()
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)