summaryrefslogtreecommitdiff
path: root/Lib/concurrent/futures/_base.py
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2014-10-04 20:20:10 +0200
committerAntoine Pitrou <solipsis@pitrou.net>2014-10-04 20:20:10 +0200
commit4aae276eca9a9213ad45158d30ae2f15843dd463 (patch)
treee3ec365b19f7eb88212595c3ea47f3362bfe75e3 /Lib/concurrent/futures/_base.py
parente4f47088af0040d73449d0cb0fe1e6d863f3ad07 (diff)
downloadcpython-git-4aae276eca9a9213ad45158d30ae2f15843dd463.tar.gz
Issue #11271: concurrent.futures.Executor.map() now takes a *chunksize*
argument to allow batching of tasks in child processes and improve performance of ProcessPoolExecutor. Patch by Dan O'Reilly.
Diffstat (limited to 'Lib/concurrent/futures/_base.py')
-rw-r--r--Lib/concurrent/futures/_base.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/concurrent/futures/_base.py b/Lib/concurrent/futures/_base.py
index c13b3b6b29..9e447137ad 100644
--- a/Lib/concurrent/futures/_base.py
+++ b/Lib/concurrent/futures/_base.py
@@ -520,7 +520,7 @@ class Executor(object):
"""
raise NotImplementedError()
- def map(self, fn, *iterables, timeout=None):
+ def map(self, fn, *iterables, timeout=None, chunksize=1):
"""Returns a iterator equivalent to map(fn, iter).
Args:
@@ -528,6 +528,10 @@ class Executor(object):
passed iterables.
timeout: The maximum number of seconds to wait. If None, then there
is no limit on the wait time.
+ chunksize: The size of the chunks the iterable will be broken into
+ before being passed to a child process. This argument is only
+ used by ProcessPoolExecutor; it is ignored by
+ ThreadPoolExecutor.
Returns:
An iterator equivalent to: map(func, *iterables) but the calls may