Ejemplo n.º 1
0
def main(argv):
    if len(argv) > 1:
        raise app.UsageError('Unrecognized arguments')
    harness_config = services.ServiceConfigFromFlag(
        'harness_config', harness_pb2.CldriveHarness())
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    services.AssertLocalServiceHostname(harness_config.service)
    service = CldriveHarness(harness_config)
    harness_pb2_grpc.add_HarnessServiceServicer_to_server(service, server)
    server.add_insecure_port(f'[::]:{harness_config.service.port}')
    logging.info('%s listening on %s:%s',
                 type(service).__name__, harness_config.service.hostname,
                 harness_config.service.port)
    server.start()
    try:
        while True:
            time.sleep(3600 * 24)
    except KeyboardInterrupt:
        server.stop(0)
Ejemplo n.º 2
0
def main(argv):
    """Main entry point."""
    if len(argv) > 1:
        raise app.UsageError("Unrecognized arguments")
    config = services.ServiceConfigFromFlag("harness_config",
                                            harness_pb2.ClLauncherHarness())
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=10))
    services.AssertLocalServiceHostname(config.service)
    service = ClLauncherHarness(config)
    harness_pb2_grpc.add_HarnessServiceServicer_to_server(service, server)
    server.add_insecure_port(f"[::]:{config.service.port}")
    app.Log(
        1,
        "%s listening on %s:%s",
        type(service).__name__,
        config.service.hostname,
        config.service.port,
    )
    server.start()
    try:
        while True:
            time.sleep(3600 * 24)
    except KeyboardInterrupt:
        server.stop(0)