[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-04-16 Thread fireattack
fireattack added the comment: >Yes, you are right. This is a feature of the ThreadPoolExecutor. So is there any way to make the Executor actually wait and accept new job(s) after a while? I tried as_completed(), wait(), none seem to work. -- ___ P

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge
gaoxinge added the comment: > I assume what you mean is that while shutdown will wait, it won't accept any > new job/future after it is called. Yes, you are right. This is a feature of the ThreadPoolExecutor. -- ___ Python tracker

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread fireattack
fireattack added the comment: Here is another more bizarre showcase of the issue I come up with. If you do: ``` import concurrent.futures import time def test(): time.sleep(3) print('test') ex = concurrent.futures.ThreadPoolExecutor(max_workers=10) ex.submit(test) ``` This

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread fireattack
fireattack added the comment: Hi gaoxinge, thanks for the reply. I assume what you mean is that while shutdown will wait, it won't accept any new job/future after it is called. That makes sense, but this still doesn't work: ``` from concurrent.futures import ThreadPoolExecutor from time imp

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge
gaoxinge added the comment: The workflow is like below: - executor submit wait_on_future, and return the future f - executor call shutdown - executor submit pow (because executor already call shutdown, this submit will fail and raise a runtime error) - then fail above will cause work thread f

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-29 Thread gaoxinge
gaoxinge added the comment: ``` from concurrent.futures import ThreadPoolExecutor from time import sleep def wait_on_future(): sleep(1) print(f.done()) # f is not done obviously f2 = executor.submit(pow, 5, 2) print(f2.result()) sleep(1) executor = ThreadPoolExecu

[issue40093] ThreadPoolExecutor with wait=True shuts down too early

2020-03-27 Thread fireattack
New submission from fireattack : Example ``` from concurrent.futures import ThreadPoolExecutor from time import sleep def wait_on_future(): sleep(1) print(f.done()) # f is not done obviously f2 = executor.submit(pow, 5, 2) print(f2.result()) sleep(1) executor = Th