Issue 31144: add initializer to concurrent.futures.ProcessPoolExecutor (original) (raw)

Created on 2017-08-08 14:02 by nvdv, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg299921 - (view) Author: nvdv (nvdv) Date: 2017-08-08 14:02
Unfortunately concurrent.futures.ProcessPoolExecutor does not provide any means to interact with worker processes (like initializer function in multiprocessing.Pool constructor). This problem has been mentioned at least once: https://mail.python.org/pipermail/python-dev/2014-March/133697.html. It's not hard to work around this issue by subclassing ProcessPoolExecutor and adding all necessary methods, but IMO solution can be more generic.
msg300615 - (view) Author: nvdv (nvdv) Date: 2017-08-21 09:00
I can make a PR if it makes any sense for stdlib maintainer.
msg301166 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-02 18:05
That would sound like a reasonable addition, yes.
msg301167 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2017-09-02 18:09
Actually, looks like this was already proposed in issue 21423. Closing as duplicate.
History
Date User Action Args
2022-04-11 14:58:49 admin set github: 75327
2017-09-02 18:09:21 pitrou set status: open -> closedsuperseder: concurrent.futures.ThreadPoolExecutor/ProcessPoolExecutor should accept an initializer argumentmessages: + resolution: duplicatestage: resolved
2017-09-02 18:05:24 pitrou set nosy: + pitroumessages: + versions: + Python 3.7, - Python 3.6
2017-08-21 09:00:21 nvdv set messages: +
2017-08-08 14:02:29 nvdv create