From 89f94d21cd3b7e8e58a1fadd2f6870307416dcab Mon Sep 17 00:00:00 2001 From: Eduardo Olivares Date: Wed, 23 Aug 2023 13:16:03 +0200 Subject: [PATCH] Add some logs with info about process retry loop Tobiko does not print any information about the status of this loop because the sleep_interval is None. After one hour, the retry loop is broken because the timeout expires, but there is no information about the reason why it expired. With this patch, information about the timeout and the retry loop is printed within the Tobiko logs. Change-Id: I74e97bf251bbb0180b26d7111bde52663cee2406 --- tobiko/common/_retry.py | 3 +++ tobiko/shell/sh/_process.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tobiko/common/_retry.py b/tobiko/common/_retry.py index dacf20dca..77cc0e357 100644 --- a/tobiko/common/_retry.py +++ b/tobiko/common/_retry.py @@ -201,6 +201,9 @@ class Retry(object): _time.sleep(sleep_time) elapsed_time = _time.time() - start_time + if not sleep_time: # sleep_time is None or 0. + LOG.debug(f"retrying without waiting... ({attempt.details})") + @property def details(self) -> str: details = [] diff --git a/tobiko/shell/sh/_process.py b/tobiko/shell/sh/_process.py index fc0de1bea..bfd748144 100644 --- a/tobiko/shell/sh/_process.py +++ b/tobiko/shell/sh/_process.py @@ -349,7 +349,7 @@ class ShellProcessFixture(tobiko.SharedFixture): try: attempt.check_limits() except tobiko.RetryTimeLimitError: - pass + LOG.exception("retry timeout expired") else: return # Eventually raises ShellCommandTimeout exception