From 96045a0a47d37bcbaa5d449b21d248256b02ff39 Mon Sep 17 00:00:00 2001 From: Reid Sunderland Date: Fri, 30 Aug 2024 19:14:03 +0000 Subject: [PATCH 1/2] Change stop output to show the number of processes still runningwq --- sarracenia/sr.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index 466a2e744..09e1bc8e2 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -2346,16 +2346,17 @@ def stop(self): attempts_max = 5 now = time.time() + running_pids = len(pids_signalled) while attempts < attempts_max: for pid in self.procs: if (not self.procs[pid]['claimed']) and ( - (now - self.procs[pid]['create_time']) > 50): + (now - self.procs[pid]['create_time']) > 50 and pid not in pids_signalled): print( f"pid: {pid} \"{' '.join(self.procs[pid]['cmdline'])}\" does not match any configured instance, sending it TERM" ) signal_pid(pid, signal.SIGTERM) pids_signalled |= set([pid]) ttw = 1 << attempts - print( f"Waiting {ttw} sec. to check if {len(pids_signalled)} processes stopped (try: {attempts})" ) + print( f"Waiting {ttw} sec. to check if {running_pids} processes stopped (try: {attempts})" ) time.sleep(ttw) # update to reflect killed processes. self._read_procs() From ce3adbd28c9b46174e81c8ce46c2213e41ecfdb3 Mon Sep 17 00:00:00 2001 From: Reid Sunderland Date: Fri, 30 Aug 2024 20:16:06 +0000 Subject: [PATCH 2/2] add the command line to show which process is being killed --- sarracenia/sr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sarracenia/sr.py b/sarracenia/sr.py index 09e1bc8e2..d99f1c7be 100755 --- a/sarracenia/sr.py +++ b/sarracenia/sr.py @@ -2394,7 +2394,7 @@ def stop(self): for i in self.states[c][cfg]['instance_pids']: if self.states[c][cfg]['instance_pids'][i] in self.procs: p=self.states[c][cfg]['instance_pids'][i] - print( f"signal_pid( {p}, SIGKILL )") + print( f"signal_pid( {p} \"{' '.join(self.procs[p]['cmdline'])}\", SIGKILL )") signal_pid(p, signal.SIGKILL) pids_signalled |= set([p]) print('.', end='')