Python: parallel processing

AWS lambda

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)