From 0a13fd79fc18a573e96cca85c13659194e967bab Mon Sep 17 00:00:00 2001 From: clearml <> Date: Mon, 24 Feb 2025 13:26:49 +0200 Subject: [PATCH] Make sure that if we fail to kill a child processes we continue to try the rest --- clearml_agent/helper/process.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/clearml_agent/helper/process.py b/clearml_agent/helper/process.py index 061d03e..0651e75 100644 --- a/clearml_agent/helper/process.py +++ b/clearml_agent/helper/process.py @@ -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): - child.kill() + try: + child.kill() + except: + print("ERROR: could not kill child process id {}".format(child)) if include_parent: - parent.kill() + 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):