사용자 도구

사이트 도구


python:parallel_processing

Python: parallel processing

Multiprocessing

자식 프로세스 다 죽이기

def killtree(pid, including_parent=True):
    parent = psutil.Process(pid)
    for child in parent.children(recursive=True):
        print "child", child
        child.kill()
 
    if including_parent:
        parent.kill()
 
## get the pid of this program
pid=os.getpid()
 
## when you want to kill everything, including this program
killtree(pid)
python/parallel_processing.txt · 마지막으로 수정됨: 2024/03/23 02:42 저자 127.0.0.1