Kyle Stanley <[email protected]> added the comment:
> 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. ---------- _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue32309> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
