From 6a23599201d9aa0c61a0e520467dd52385b407f3 Mon Sep 17 00:00:00 2001 From: Doug Boulware Date: Fri, 3 May 2024 08:00:37 -0600 Subject: [PATCH 1/4] Add retries to healthy. --- scos_actions/hardware/sigan_iface.py | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/scos_actions/hardware/sigan_iface.py b/scos_actions/hardware/sigan_iface.py index 5f0df68f..1bf81a83 100644 --- a/scos_actions/hardware/sigan_iface.py +++ b/scos_actions/hardware/sigan_iface.py @@ -71,17 +71,22 @@ def connect(self) -> None: """ pass - def healthy(self, num_samples: int = 56000) -> bool: + def healthy(self, num_samples: int = 56000, retries: int = 3) -> bool: """Perform health check by collecting IQ samples.""" logger.debug("Performing health check.") if not self.is_available: return False - try: - measurement_result = self.acquire_time_domain_samples(num_samples) - data = measurement_result["data"] - except Exception as e: - logger.exception("Unable to acquire samples from device.") - return False + while True: + try: + measurement_result = self.acquire_time_domain_samples(num_samples) + data = measurement_result["data"] + break + except BaseException as e: + retries -= 1 + logger.debug("Unable to acquire samples during health check. Retrying...") + if retries == 0: + logger.exception("Unable to acquire samples from device during health check.") + return False if not len(data) == num_samples: logger.error("Data length doesn't match request.") From bfb6e9b31a746d8c2f86cacf4bd45b86be416edf Mon Sep 17 00:00:00 2001 From: Doug Boulware Date: Mon, 6 May 2024 12:52:50 -0600 Subject: [PATCH 2/4] increment version to 10.0.2 --- scos_actions/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scos_actions/__init__.py b/scos_actions/__init__.py index ab649641..b7a5e079 100644 --- a/scos_actions/__init__.py +++ b/scos_actions/__init__.py @@ -1 +1 @@ -__version__ = "10.0.1" +__version__ = "10.0.2" From 8a732a8ba1f90f835e965ff43000636a8f9f885b Mon Sep 17 00:00:00 2001 From: Doug Boulware Date: Mon, 6 May 2024 13:19:40 -0600 Subject: [PATCH 3/4] formatting. --- scos_actions/hardware/sigan_iface.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scos_actions/hardware/sigan_iface.py b/scos_actions/hardware/sigan_iface.py index 1bf81a83..3cf339bb 100644 --- a/scos_actions/hardware/sigan_iface.py +++ b/scos_actions/hardware/sigan_iface.py @@ -83,9 +83,13 @@ def healthy(self, num_samples: int = 56000, retries: int = 3) -> bool: break except BaseException as e: retries -= 1 - logger.debug("Unable to acquire samples during health check. Retrying...") + logger.debug( + "Unable to acquire samples during health check. Retrying..." + ) if retries == 0: - logger.exception("Unable to acquire samples from device during health check.") + logger.exception( + "Unable to acquire samples from device during health check." + ) return False if not len(data) == num_samples: From 5a503d9a3cc08d4731593eaee2fe4f34228496d2 Mon Sep 17 00:00:00 2001 From: Doug Boulware Date: Mon, 13 May 2024 09:57:21 -0400 Subject: [PATCH 4/4] Move logging statement of retry in healthy method into else to only log when it will retry. --- scos_actions/hardware/sigan_iface.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scos_actions/hardware/sigan_iface.py b/scos_actions/hardware/sigan_iface.py index 3cf339bb..23497414 100644 --- a/scos_actions/hardware/sigan_iface.py +++ b/scos_actions/hardware/sigan_iface.py @@ -83,14 +83,15 @@ def healthy(self, num_samples: int = 56000, retries: int = 3) -> bool: break except BaseException as e: retries -= 1 - logger.debug( - "Unable to acquire samples during health check. Retrying..." - ) if retries == 0: logger.exception( "Unable to acquire samples from device during health check." ) return False + else: + logger.debug( + "Unable to acquire samples during health check. Retrying..." + ) if not len(data) == num_samples: logger.error("Data length doesn't match request.")