Feb-07-2023, 05:02 PM
Hi,
I'm not sure if I understand your question correctly, but the concurent.futures module is not meant for a "fire and forgot" mode. The executors wait until tasks are finished. As the documentation for the ThreadPoolExecutor says: "All threads enqueued to ThreadPoolExecutor will be joined before the interpreter can exit.". Which means your problem blocks at one point.
If you are looking for background processing where new task can be fed any time, you may build something yourself using two threads or processes connected by a queue or you use an asyncronous task queue like e.g. Celery (or one of the lighter options).
Gruß, noisefloor
I'm not sure if I understand your question correctly, but the concurent.futures module is not meant for a "fire and forgot" mode. The executors wait until tasks are finished. As the documentation for the ThreadPoolExecutor says: "All threads enqueued to ThreadPoolExecutor will be joined before the interpreter can exit.". Which means your problem blocks at one point.
If you are looking for background processing where new task can be fed any time, you may build something yourself using two threads or processes connected by a queue or you use an asyncronous task queue like e.g. Celery (or one of the lighter options).
Gruß, noisefloor