[docs] [issue18620] multiprocessing page leaves out important part of Pool example
Chris Curvey
report at bugs.python.org
Thu Aug 1 22:30:44 CEST 2013
New submission from Chris Curvey:
on http://docs.python.org/2/library/multiprocessing.html, there is a bit about how to use a Pool properly, which looks like this
pool = Pool(processes=4) # start 4 worker processes
result = pool.apply_async(f, [10])
What this neglects to mention is that only one process will get any of the work. If you really want four processes in the pool to work, you have to call apply_async four times. For example:
results = []
pool = Pool(processes=4)
for i in xrange(4):
results.append(pool.apply_async(f, [10]))
hat tip to http://stackoverflow.com/questions/12483512/python-multiprocessing-apply-async-only-uses-one-process
----------
assignee: docs at python
components: Documentation
messages: 194115
nosy: Chris.Curvey, docs at python
priority: normal
severity: normal
status: open
title: multiprocessing page leaves out important part of Pool example
type: enhancement
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue18620>
_______________________________________
More information about the docs
mailing list