Message218763
As the title says, ThreadPoolExecutor does not use a default value for max_workers parameter, as ProcessPoolExecutor does. When the user does not care about the number of workers and wants only for something to run in background, he has to write code like this:
if processes:
executor = ProcessPoolExecutor()
elif threads:
executor = ThreadPoolExecutor(1) # or any other value
This situation can also occur when the class is passed as a factory function:
def create_pool(executor_factory):
if executor_factory is process pool:
executor = executor_factory()
else:
executor = executor_factory(1)
This patch proposes using the number of cores as the default value for max_workers.
For instance, multiprocessing.pool.ThreadPool uses the same value. |
|
Date |
User |
Action |
Args |
2014-05-18 22:47:47 | Claudiu.Popa | set | recipients:
+ Claudiu.Popa, bquinlan |
2014-05-18 22:47:47 | Claudiu.Popa | set | messageid: <1400453267.44.0.909455514702.issue21527@psf.upfronthosting.co.za> |
2014-05-18 22:47:47 | Claudiu.Popa | link | issue21527 messages |
2014-05-18 22:47:47 | Claudiu.Popa | create | |
|