revert to processes
This commit is contained in:
parent
c85cdc91ca
commit
c5000c7bb4
1 changed files with 2 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from multiprocessing.pool import ThreadPool
|
from multiprocessing.pool import Pool
|
||||||
from typing import Callable, TypeVar
|
from typing import Callable, TypeVar
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class RunStrategy:
|
||||||
class Parallel(RunStrategy):
|
class Parallel(RunStrategy):
|
||||||
procs: None | int = None
|
procs: None | int = None
|
||||||
def run_all(self, items: list[T], oper: Callable[[T], O]) -> list[O]:
|
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):
|
class Sequential(RunStrategy):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue