Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to stop a running process in concurrent.futures?

How can I terminate a running process, started using concurrent.futures? As I understand, the cancel() method is there to remove a process from the queue if it is not running. But what about killing a running process? For example, if I have a long running process, and I want to stop it when I press a Cancel button in a GUI.

like image 560
Charles Brunet Avatar asked Apr 17 '13 02:04

Charles Brunet


1 Answers

You may want to look at my answer to a related StackOverflow question here.

In short, there does not appear to be a simple way to cancel a running process inside a concurrent.futures.ProcessPoolExecutor. But you can accomplish it in a hacky way by killing the child processes manually.

like image 156
ostrokach Avatar answered Oct 13 '22 23:10

ostrokach