This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Chris.Curvey
Recipients Chris.Curvey, docs@python
Date 2013-08-01.20:30:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1375389044.82.0.349700607179.issue18620@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-08-01 20:30:44Chris.Curveysetrecipients: + Chris.Curvey, docs@python
2013-08-01 20:30:44Chris.Curveysetmessageid: <1375389044.82.0.349700607179.issue18620@psf.upfronthosting.co.za>
2013-08-01 20:30:44Chris.Curveylinkissue18620 messages
2013-08-01 20:30:44Chris.Curveycreate