How to use the alephclient.services.geoextract_pb2_grpc.add_GeoExtractServicer_to_server function in alephclient

To help you get started, we’ve selected a few alephclient examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alephdata / aleph / services / extract-countries / service.py View on Github external
def serve(port):
    corpus_path = '/tmp/allCountries.filtered.txt'
    server = grpc.server(futures.ThreadPoolExecutor(max_workers=20))
    add_GeoExtractServicer_to_server(GeoExtractServicer(corpus_path), server)
    server.add_insecure_port(port)
    server.start()
    log.info("Server started: %s", port)
    try:
        while True:
            time.sleep(84600)
    except KeyboardInterrupt:
        server.stop(60)