Unverified Commit cdfd70f0 authored by Tzu-Ling Kan's avatar Tzu-Ling Kan Committed by GitHub
Browse files

feat: changing SIGKILL to SIGINT for graceful shutdown (#3513)


Signed-off-by: default avatartzulingk@nvidia.com <tzulingk@nvidia.com>
parent 9b5bab72
...@@ -336,6 +336,15 @@ class PodProcess: ...@@ -336,6 +336,15 @@ class PodProcess:
signal = "SIGINT" signal = "SIGINT"
else: else:
signal = "SIGKILL" signal = "SIGKILL"
# Python processes need signal handlers for graceful shutdown
if self.pid == 1 and signal == "SIGKILL" and "python" in self.command.lower():
logging.info(
f"PID 1 is a Python process ({self.command[:50]}...), "
"changing SIGKILL to SIGINT for graceful shutdown"
)
signal = "SIGINT"
logging.info("Killing PID %s with %s", self.pid, signal)
return self._pod.exec(["kill", f"-{signal}", str(self.pid)]) return self._pod.exec(["kill", f"-{signal}", str(self.pid)])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment