Python Multiprocessing queue

前端 未结 2 378
一个人的身影
一个人的身影 2021-01-13 03:23

I am populating a queue with a set of jobs that I want to run in parallel and using python\'s multiprocessing module for doing that. Code snippet below:

impo         


        
2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-13 03:51

    The queue is getting populated with all your jobs. queue.get() will

    Remove and return an item from the queue.

    An item is singular. If you want to drain the queue, then just put your .get() in a loop, but be sure to catch the Empty exception.

提交回复
热议问题