homepage

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.

classification
Title: The docs never define what a pool "task" is
Type: enhancement Stage:
Components: Documentation, Library (Lib) Versions: Python 3.11, Python 3.10, Python 3.9, Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Daniel Neuberger, Zahari.Dim, davin, docs@python, sbt
Priority: normal Keywords:

Created on 2015年06月19日 17:05 by Zahari.Dim, last changed 2022年04月11日 14:58 by admin.

Messages (2)
msg245509 - (view) Author: Zahari Dim (Zahari.Dim) Date: 2015年06月19日 17:05
See:
http://stackoverflow.com/questions/30943161/multiprocessing-pool-with-maxtasksperchild-produces-equal-pids
The documentation never makes clear what a "task" in the context of Pool.map. At best, it says:
"This method chops the iterable into a number of chunks which it submits to the process pool as separate tasks. The (approximate) size of these chunks can be specified by setting chunksize to a positive integer."
in the map documentation. However it does not say how this chunks are calculated by default, making the maxtasksperchild argument not very useful. The fact that a function evaluated by map is not a "task" should be much clearer in the documentation.
Also, in the examples, such as:
 with multiprocessing.Pool(PROCESSES) as pool:
 #
 # Tests
 #
 TASKS = [(mul, (i, 7)) for i in range(10)] + \
 [(plus, (i, 8)) for i in range(10)]
 results = [pool.apply_async(calculate, t) for t in TASKS]
 imap_it = pool.imap(calculatestar, TASKS)
 imap_unordered_it = pool.imap_unordered(calculatestar, TASKS)
TASKS are not actually "tasks" but rather "task groups".
msg245966 - (view) Author: Daniel Neuberger (Daniel Neuberger) Date: 2015年06月29日 20:41
I second this. I was definitely confused at first and it took me a little while of googling to realize that jobs are not what one (at least me) would intuitively think they are.
History
Date User Action Args
2022年04月11日 14:58:18adminsetgithub: 68663
2021年04月28日 18:03:55iritkatrielsetcomponents: + Library (Lib)
versions: + Python 3.8, Python 3.9, Python 3.10, Python 3.11, - Python 2.7, Python 3.4, Python 3.5, Python 3.6
2015年09月07日 23:04:00davinsettype: enhancement
2015年06月29日 20:41:47Daniel Neubergersetnosy: + Daniel Neuberger
messages: + msg245966
2015年06月19日 20:15:39ned.deilysetnosy: + sbt, davin

versions: - Python 3.2, Python 3.3
2015年06月19日 17:05:37Zahari.Dimcreate

AltStyle によって変換されたページ (->オリジナル) /