Skip to content Skip to sidebar Skip to footer

Auto Kill Process And Child Process Of Multiprocessing Pool

I am using multiprocessing module for parallel processing. Bellow code snippet search the string filename in X location and return the file name where the string found. But in some

Solution 1:

I am able to solve my Issue using psutil module

Found solution on bellow post:

import psutil, os

defkill_proc_tree(pid, including_parent=True):    
    parent = psutil.Process(pid)
    for child in parent.get_children(recursive=True):
        child.kill()
    if including_parent:
        parent.kill()

me = os.getpid()
kill_proc_tree(me)

https://stackoverflow.com/a/4229404/420557

Post a Comment for "Auto Kill Process And Child Process Of Multiprocessing Pool"