Created
August 8, 2021 10:40
-
-
Save fpaupier/a6555a4956f8959c1a58acbe0add97a4 to your computer and use it in GitHub Desktop.
A non working gRPC server init
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def main(): | |
""" | |
Inspired from https://github.com/grpc/grpc/blob/master/examples/python/multiprocessing/server.py | |
""" | |
logger.info(f'Initializing server with {NUM_WORKERS} workers') | |
with _reserve_port() as port: | |
bind_address = f"[::]:{port}" | |
logger.info(f"Binding to {bind_address}") | |
sys.stdout.flush() | |
workers = [] | |
for _ in range(NUM_WORKERS): | |
worker = multiprocessing.Process(target=_run_server, | |
args=(bind_address,)) | |
worker.start() | |
workers.append(worker) | |
for worker in workers: | |
worker.join() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment