I am submitting executors from a ProcessPoolExecutor inside my class by passing a class method:
class BackwardEnrichmentService:
def __init__(
self,
...
) -> None:
...
async def enrich_claim(self, claim_number: str) -> bool:
...
futures = []
with ProcessPoolExecutor(mp_context=mp.get_context('spawn')) as executor:
futures = [
executor.submit(
self._enrich_peril,
)
for key in indicators_dict
]
for f in as_completed(futures):
indicator_results.append(f.result())
return all(indicator_results)
def _enrich_peril(
self,
) -> bool:
return True
As long the passed function is not from my class the executor works correctly without throwing.
Any clues?