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.

Author aeros
Recipients aeros, asvetlov, primal, yselivanov
Date 2019-11-02.06:30:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1572676256.75.0.635023305072.issue32309@roundup.psfhosted.org>
In-reply-to
Content
> And that's why I like it. If we add ProcessPool it will have the same argument: concurrency.

> max_workers isn't correct, as we want to spawn all threads and all processes when we start. Thus btw makes me think that initializing threads/processes in __init__ is a bad idea, as spawning can be asynchronous.

Ah, I see, that would make sense then if we're considering adding a ProcessPool at some point and want to make the argument name the same. Based on your ideas so far, it seems that it will likely not be compatible with the existing ThreadPoolExecutor. 

From my understanding, the executor classes are designed around spawning the threads (or processes in the case of ProcessPoolExecutor) as needed up to max_workers, rather than spawning them upon startup. The asynchronous spawning of threads or processes would also not be compatible with the executor subclasses as far as I can tell. 

I can start working on a draft/prototype for a design. It will likely take more time to implement this, but it will give us the chance to have a native asyncio ThreadPool that doesn't directly rely upon the API in concurrent.futures. 

Also, would you prefer for there to be an abstract asyncio.AbstractPool class that ThreadPool inherits from? I think this would make it more streamlined to implement a similar ProcessPool at some point in the future. This would be similar to the relationship between the Executor class and ThreadPoolExecutor, or AbstractEventLoop and BaseEventLoop.

Let me know if you approve of this idea Yury and Andrew. It's quite a bit more involved than implementing a simple high level version of loop.run_in_executor(), but I think it would prove to be worthwhile in the long term.
History
Date User Action Args
2019-11-02 06:30:56aerossetrecipients: + aeros, asvetlov, yselivanov, primal
2019-11-02 06:30:56aerossetmessageid: <1572676256.75.0.635023305072.issue32309@roundup.psfhosted.org>
2019-11-02 06:30:56aeroslinkissue32309 messages
2019-11-02 06:30:56aeroscreate