【发布时间】:2015-10-11 17:07:39
【问题描述】:
我正在使用 concurrent.futures 来实现多处理。我收到一个 queue.Full 错误,这很奇怪,因为我只分配了 10 个作业。
A_list = [np.random.rand(2000, 2000) for i in range(10)]
with ProcessPoolExecutor() as pool:
pool.map(np.linalg.svd, A_list)
错误:
Exception in thread Thread-9:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 921, in _bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/threading.py", line 869, in run
self._target(*self._args, **self._kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py", line 251, in _queue_management_worker
shutdown_worker()
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/concurrent/futures/process.py", line 209, in shutdown_worker
call_queue.put_nowait(None)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/queues.py", line 131, in put_nowait
return self.put(obj, False)
File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/multiprocessing/queues.py", line 82, in put
raise Full
queue.Full
【问题讨论】:
-
如果你使用一个小得多的数组,你会得到同样的错误吗?
-
我在较小的阵列上没有得到错误。我能走的最大的是~200x200。
-
只有当
Pool因工作进程崩溃而中断时才会运行失败的对shutdown_worker的调用 - 所以您需要追查的真正问题是为什么会发生这种情况。
标签: python parallel-processing multiprocessing concurrent.futures