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" diff --git a/scos_actions/hardware/sigan_iface.py b/scos_actions/hardware/sigan_iface.py index 5f0df68f..23497414 100644 --- a/scos_actions/hardware/sigan_iface.py +++ b/scos_actions/hardware/sigan_iface.py @@ -71,17 +71,27 @@ 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 + 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.")