Repository navigation
Expose max_queue_size in ThreadPoolExecutor #73781
Description
Activity
prayerslayer commented
on Feb 17, 2017 prayerslayermannequinMannequinAuthorMore actionsHi!
I think the ThreadPoolExecutor should allow to set the maximum size of the underlying queue.
The situation I ran into recently was that I used ThreadPoolExecutor to parallelize AWS API calls; I had to move data from one S3 bucket to another (~150M objects). Contrary to what I expected the maximum size of the underlying queue doesn't have a non-zero value by default. Thus my process ended up consuming gigabytes of memory, because it put more items into the queue than the threads were able to work off: The queue just kept growing. (It ran on K8s and the pod was rightfully killed eventually.)
Of course there ways to work around this. One could use more threads, to some extent. Or you could use your own queue with a defined maximum size. But I think it's more work for users of Python than necessary.
- addedtype-featureA feature request or enhancementA feature request or enhancement
on Feb 17, 2017 - addedstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directory3.7 (EOL)end of lifeend of life
on Feb 18, 2017 prayerslayer commented
on Mar 6, 2017 prayerslayermannequinMannequinAuthorMore actionsHello again, there's a reviewed PR open for this issue and it hasn't even received authoritative feedback yet (ie whether or not you intend to support this feature at all). I would be very happy if a core dev could look over this change before everyone forgets about it :)
prayerslayer commented
on Mar 24, 2017 prayerslayermannequinMannequinAuthorMore actionsPing. That's really a two-line change, can be easily reviewed in 15 minutes :)
Prayslayer, please don't shove. Your PR request was responded to by Mariatta so it wasn't ignored.
Making decisions about API expansions takes a while (making sure it fits the intended use, that it isn't a bug factory itself, that it is broadly useful, that it is the best solution to the problem, that is doesn't complicate the implementation or limit future opportunities, that there are unforeseen problems). Among the core developers, there are only a couple part-time contributors who are qualified to make these assessments for the multi-processing module (those devs don't include me).
My project we're going into the underlying _work_queue and blocking adding more elements based on unfinished_tasks to accomplish this, bubbling this up to the API would be a welcome addition.
Please note the PR here has some review comments that need addressing.
Also, it needs its conflicts with git master resolved.I'm cc'ing Thomas Moreau, who has done a lot of work recently on the concurrent.futures internals.
Metadata
Metadata
Assignees
Labels
Projects
- StatusShow more project fieldsNo status
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: