New submission from Zahari Dim:
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".
---------- assignee: docs@python components: Documentation messages: 245509 nosy: Zahari.Dim, docs@python priority: normal severity: normal status: open title: The docs never define what a pool "task" is versions: Python 2.7, Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Daniel Neuberger added the comment:
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.
---------- nosy: +Daniel Neuberger
Change by Irit Katriel firstname.lastname@example.org:
---------- components: +Library (Lib) versions: +Python 3.10, Python 3.11, Python 3.8, Python 3.9 -Python 2.7, Python 3.4, Python 3.5, Python 3.6