开发者

Python multiprocessing : progress report from processes

I have some tasks in an application that are CPU bound and I want to use the multiprocessing module to use the multi-cores processors. I take a big task (a video file analysis) and I split it into several smaller tasks which are put in a queue and done by worker processes. 开发者_JAVA技巧What I want to know is how to report progress to the main process from these worker processes. For example I need them to send "I am at 1000ms of my analysis of file 1". What is the best way to do such progress reports ?


I would recommend a multiprocessing.Queue: nothing easier than for the worker processes to post their updates (presumably as tuples with the various aspect of their progress updates) there, while the main process just wait for such messages and when they come updates the GUI (or textual UI;-) to keep the user appraised of progress.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜