[chore] log process manager shutdown with more details (#49437)
Signed-off-by: Andy Xie <andy.xning@gmail.com>
This commit is contained in:
+17
-6
@@ -600,14 +600,18 @@ def shutdown(procs: list[BaseProcess], timeout: float | None = None) -> None:
|
|||||||
timeout = 5.0
|
timeout = 5.0
|
||||||
|
|
||||||
logger.debug(
|
logger.debug(
|
||||||
"[shutdown] Process manager: start process_count=%d timeout=%ss",
|
"[shutdown] Process manager: start process_count=%d timeout=%ss names=%s",
|
||||||
len(procs),
|
len(procs),
|
||||||
timeout,
|
timeout,
|
||||||
|
(",").join([proc.name for proc in procs]),
|
||||||
)
|
)
|
||||||
|
|
||||||
# Shutdown the process.
|
# Shutdown the process.
|
||||||
for proc in procs:
|
for proc in procs:
|
||||||
if proc.is_alive():
|
if proc.is_alive():
|
||||||
|
logger.info(
|
||||||
|
"[shutdown] Process manager: send sigterm to process %s", proc.name
|
||||||
|
)
|
||||||
proc.terminate()
|
proc.terminate()
|
||||||
|
|
||||||
# Allow time for remaining procs to terminate.
|
# Allow time for remaining procs to terminate.
|
||||||
@@ -619,15 +623,22 @@ def shutdown(procs: list[BaseProcess], timeout: float | None = None) -> None:
|
|||||||
if proc.is_alive():
|
if proc.is_alive():
|
||||||
proc.join(remaining)
|
proc.join(remaining)
|
||||||
|
|
||||||
remaining_pids = [
|
remaining_procs = [
|
||||||
proc.pid for proc in procs if proc.is_alive() and proc.pid is not None
|
(proc.pid, proc.name)
|
||||||
|
for proc in procs
|
||||||
|
if proc.is_alive() and proc.pid is not None
|
||||||
]
|
]
|
||||||
if remaining_pids:
|
if remaining_procs:
|
||||||
logger.warning(
|
logger.warning(
|
||||||
"[shutdown] Process manager: force killing remaining processes count=%d",
|
"[shutdown] Process manager: force killing remaining processes count=%d",
|
||||||
len(remaining_pids),
|
len(remaining_procs),
|
||||||
|
)
|
||||||
|
for pid, proc_name in remaining_procs:
|
||||||
|
logger.warning(
|
||||||
|
"[shutdown] Process manager: force killing remaining process %s pid %d",
|
||||||
|
proc_name,
|
||||||
|
pid,
|
||||||
)
|
)
|
||||||
for pid in remaining_pids:
|
|
||||||
kill_process_tree(pid)
|
kill_process_tree(pid)
|
||||||
|
|
||||||
logger.debug_once("[shutdown] Process manager: complete")
|
logger.debug_once("[shutdown] Process manager: complete")
|
||||||
|
|||||||
Reference in New Issue
Block a user