Exemplo n.º 1
0
 async def serve() -> None:
     server = grpc.aio.server(options=_GRPC_CHANNEL_OPTIONS)
     servicer = ProviderServicer(provider, args, engine_address=engine_address)
     provider_pb2_grpc.add_ResourceProviderServicer_to_server(servicer, server)
     port = server.add_insecure_port(address='0.0.0.0:0')
     await server.start()
     sys.stdout.buffer.write(f'{port}\n'.encode())
     sys.stdout.buffer.flush()
     await server.wait_for_termination()
Exemplo n.º 2
0
def main():
    monitor = DynamicResourceProviderServicer()
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=4))
    provider_pb2_grpc.add_ResourceProviderServicer_to_server(monitor, server)
    port = server.add_insecure_port(address="0.0.0.0:0")
    server.start()
    print(port)
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)
Exemplo n.º 3
0
def main():
    monitor = DynamicResourceProviderServicer()
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=4),
                         options=_GRPC_CHANNEL_OPTIONS)
    provider_pb2_grpc.add_ResourceProviderServicer_to_server(monitor, server)
    port = server.add_insecure_port(address="0.0.0.0:0")
    server.start()
    sys.stdout.buffer.write(f"{port}\n".encode())
    try:
        while True:
            time.sleep(_ONE_DAY_IN_SECONDS)
    except KeyboardInterrupt:
        server.stop(0)