I'm trying to optimise an expensive operation in some existing code using parallel processing. I've used concurrent.futures
to do so in the past but only when they didn’t return anything.
This time I want to marshall the results, but when printing my collection I'm getting every future's status as something like <Future at 0x... state=finished raised TypeError>
. Can anyone explain what I'm doing wrong?
import concurrent.futures
with concurrent.futures.ProcessPoolExecutor() as executor:
def _future(self) -> None:
print("here")
futures = []
for number in list(range(0,100)):
future = executor.submit(_future)
futures.append(future)
finished = concurrent.futures.wait(futures, 5)
print(finished)