Beispiel #1
0
def serve():
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
    segmentation_pb2_grpc.add_SegmentationServicer_to_server(
        Classificator(), server)
    server.add_insecure_port('[::]:50052')
    server.start()
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
Beispiel #2
0
def main(host, port, max_workers):
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=max_workers))
    servicer = SegmentationServicer()
    segmentation_pb2_grpc.add_SegmentationServicer_to_server(servicer, server)

    address = '{}:{}'.format(host, port)
    server.add_insecure_port(address)
    server.start()
    print("Listening at {}".format(address))
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
def serve():
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=1))
    segmentation_pb2_grpc.add_SegmentationServicer_to_server(
        Segmentation(), server)
    server.add_insecure_port('[::]:50052')
    server.start()

    try:
        callback_command = sys.argv[1]
        subprocess.call(callback_command, shell=True)
    except:
        pass

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