[英]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.我目前正在尝试通过使用 concurrent.futures 中的 concurrent.futures.ProcessPoolExecutor 在多处理期间存储在 function 中获得的 output 构建了一个 python3 库,将变量存储为全局变量。 But the variable output gets deleted once the process is over.但是一旦过程结束,变量 output 就会被删除。 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()
fxReturn 将存储your_function
的返回值,但要访问它,您需要使用result()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.