I have a simple setup to test parallel execution, but it fails no matter what I’ve tried.
Here is a model example:
from concurrent.futures import ProcessPoolExecutor
def worker(i):
print(f"TASK: {i}")
result = i * i
print(f"RESULT: {result}")
return result
futures = []
if __name__ == "__main__":
with ProcessPoolExecutor(max_workers=4) as executor:
for i in range(10):
futures.append(executor.submit(worker, i))
for i, future in enumerate(futures):
try:
result = future.result()
print(result)
except Exception as e:
print(f"Error in future {i}: {e}")
I have way more than 4 cores available, no memory issues, but it fails no matter what I try.
Error in future 0: A process in the process pool was terminated abruptly while the future was running or pending.
(and so on for the other futures)