Can't put Future in Manager().Queue in Python

筅森魡賤 提交于 2019-12-24 09:28:26

问题


I have a bunch of client processes which make queries to a single worker process (which then processes them in batches) using a shared queue. However the clients need to know when the results are ready, so I tried putting a tuple with a concurrent.futures.Future along with the request in the queue, but Python throws a "cannot pickle" exception (this only happens with the future object).

Is there a picklable version of Future that I can use for this purpose, or a better design altogether?

来源:https://stackoverflow.com/questions/47890254/cant-put-future-in-manager-queue-in-python

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!