INNER CODE UNIT · Python
run_worker
erikbern/ann-benchmarks · ann_benchmarks/main.py:51
def run_worker(cpu: int, mem_limit: int, args: argparse.Namespace, queue: multiprocessing.Queue) -> None:
"""
Executes the algorithm based on the provided parameters.
The algorithm is either executed directly or through a Docker container based on the `args.local`
argument. The function runs until the queue is emptied. When running in a docker container, it
executes the algorithm in a Docker container.
Args:
cpu (int): The CPU number to be used in the execution.
mem_limit (int): The memory to be used in the execution.
args (argparse.Namespace): User provided arguments for running workers.
queue (multiprocessing.Queue): The multiprocessing queue that contains the algorithm definitions.
Returns:
None
"""
while not queue.empty():