revert to processes

This commit is contained in:
Matthieu Jolimaitre 2024-11-07 11:11:07 +01:00
parent c85cdc91ca
commit c5000c7bb4

View file

@ -1,5 +1,5 @@
from dataclasses import dataclass
from multiprocessing.pool import ThreadPool
from multiprocessing.pool import Pool
from typing import Callable, TypeVar
@ -17,7 +17,7 @@ class RunStrategy:
class Parallel(RunStrategy):
procs: None | int = None
def run_all(self, items: list[T], oper: Callable[[T], O]) -> list[O]:
return ThreadPool(self.procs).map(oper, items)
return Pool(self.procs).map(oper, items)
class Sequential(RunStrategy):