Skip to content

Commit 7f48d95

Browse files
author
Thomas Desveaux
committed
check: add debug logging
Hopefully, this will help track hang
1 parent 20bf739 commit 7f48d95

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nimp/base_commands/check.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,11 @@ def _run_check(self, env: NimpEnvironment):
182182
# psutil.process_iter caches processes
183183
# we want a fresh list since we might have killed/
184184
# process completed since last iteration
185+
logging.debug("Clear psutil process cache")
185186
psutil.process_iter.cache_clear()
187+
logging.debug("Get current process")
186188
current_process = psutil.Process()
189+
logging.debug("Current process is %d", current_process.pid)
187190
ignore_process_ids = set(
188191
(
189192
current_process.pid,
@@ -246,7 +249,9 @@ def _run_check(self, env: NimpEnvironment):
246249
if not env.kill:
247250
# Wait a bit, give a chance to problematic processes to end,
248251
# even if not killed
249-
time.sleep(5)
252+
sleep_time = 5.0
253+
logging.debug("Wait %.2fs. Giving a chance to processes for a natural exit", sleep_time)
254+
time.sleep(sleep_time)
250255
else:
251256
for p in problematic_processes:
252257
logging.info('Requesting process %s termination', p.pid)

0 commit comments

Comments
 (0)