Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does SimpleQueue's put method freeze?

I'm using the SimpleQueue class from multiprocessing.queues. My program was working fine until I had an abnormal termination. Now whenever I run it, it freezes at a put call, before any get calls are performed. My guess is that SimpleQueue uses a file or something similar as the underlying method of communication and it got corrupted.

Any ideas on how I can get SimpleQueue to work again? Preferably without restarting the computer, it's a shared machine with multiple people working on it at the same time.

like image 926
Paul Baltescu Avatar asked Feb 20 '26 08:02

Paul Baltescu


1 Answers

For me, SimpleQueue.put() seems to freeze when I make a lot of put calls, could that be the problem? (OS X, Anaconda, 2.7.10)

In [1]: from multiprocessing.queues import SimpleQueue
   ...: from time import time
   ...: 
   ...: def put_jobs(n):
   ...:     q = SimpleQueue()
   ...:     t0 = time()
   ...:     for i in xrange(n):
   ...:         q.put((i, (42, 0)))
   ...:     print '%.3f' % (time() - t0)
   ...: 

In [6]: put_jobs(1000)
0.004

In [7]: put_jobs(1000)
0.004

In [8]: put_jobs(2000)
0.007

In [9]: put_jobs(3000)
0.010

In [10]: put_jobs(4000)

(not returning for minutes)

like image 91
christianbrodbeck Avatar answered Feb 25 '26 01:02

christianbrodbeck