[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-14 Thread Andreas van Cranenburgh
Andreas van Cranenburgh added the comment: Giampaolo, this patch is for ProcessPoolExecutor as well. About keyboard interrupts, if my tests are correct, they work in Python 3.3+ with both multiprocessing and concurrent.futures. (Although for the latter I have to hit ctrl-c twice

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-07 Thread Andreas van Cranenburgh
Andreas van Cranenburgh added the comment: Here's a patch. I have added initializer and initargs keywords to both ThreadPoolExecutor and ProcessPoolExecutor, with the same semantics as multiprocessing.Pool. I couldn't figure out what to do if the initializer fails with a ProcessPoolExecutor

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-07 Thread Andreas van Cranenburgh
Andreas van Cranenburgh added the comment: Here's a version with tests. Detecting an execption in the initializer works with ProcessPoolExecutor, but not with ThreadPoolExecutor. -- Added file: http://bugs.python.org/file35181/pool_initializer_tests.patch

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-06 Thread Andreas van Cranenburgh
Andreas van Cranenburgh added the comment: Yes I did mean ProcessPoolExecutor, but indeed, it's good to have for threads as well. I could try to make a patch if it is likely that it would be accepted. -- ___ Python tracker rep...@bugs.python.org

[issue21423] concurrent.futures.ThreadPoolExecutor should accept an initializer argument

2014-05-03 Thread Andreas van Cranenburgh
New submission from Andreas van Cranenburgh: It would be useful if concurrent.futures.ThreadPoolExecutor took an initializer argument, like multiprocessing.Pool. This is useful for example to load a large dataset once upon initialization of each worker process, without have to pass