mirror of
https://github.com/clearml/clearml-agent
synced 2025-02-26 05:59:24 +00:00
Make sure that if we fail to kill a child processes we continue to try the rest
This commit is contained in:
parent
c9f5b3d19a
commit
0a13fd79fc
@ -91,11 +91,18 @@ def kill_all_child_processes(pid=None, include_parent=True):
|
||||
parent = psutil.Process(pid)
|
||||
except psutil.Error:
|
||||
# could not find parent process id
|
||||
print("ERROR: could not find parent process id {}".format(pid))
|
||||
return
|
||||
for child in parent.children(recursive=True):
|
||||
try:
|
||||
child.kill()
|
||||
except:
|
||||
print("ERROR: could not kill child process id {}".format(child))
|
||||
if include_parent:
|
||||
try:
|
||||
parent.kill()
|
||||
except:
|
||||
print("ERROR: could not kill parent process id {}".format(parent))
|
||||
|
||||
|
||||
def terminate_all_child_processes(pid=None, timeout=10., include_parent=True):
|
||||
|
Loading…
Reference in New Issue
Block a user