简体   繁体   中英

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:

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()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM