hpcflow.sdk.helper.helper.kill_proc_tree#

hpcflow.sdk.helper.helper.kill_proc_tree(pid, sig=Signals.SIGTERM, include_parent=True, timeout=None, on_terminate=None)#

Kill a process tree (including grandchildren) with signal sig and return a (gone, still_alive) tuple. on_terminate, if specified, is a callback function which is called as soon as a child terminates.

Returns:

  • list[Process] – The process and subprocesses that have died.

  • list[Process] – The process and subprocesses that are still alive.

Parameters:
  • pid (int) –

  • include_parent (bool) –

  • timeout (float | None) –

  • on_terminate (Callable[[psutil.Process], object] | None) –

Return type:

tuple[list[psutil.Process], list[psutil.Process]]