'How to store the variables output inside a function during concurrent.futures.ProcessPoolExecutor from concurrent.futures
I am currently trying to store the output obtained in a function during multiprocessing by using concurrent.futures.ProcessPoolExecutor from concurrent.futures built a library of python3 storing the variable as a global variable. But the variable output gets deleted once the process is over. Does anyone has faced the same issue?
Reference:
Solution 1:[1]
with concurrent.futures.ThreadPoolExecutor(max_workers=7) as executor:
fxReturn = executor.submit(your_function)
fxReturn.result()
fxReturn will store return value of your_function
but to access it you need to use result()
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | zircon |