From 3258a8b6f4ea181997d936df6de6f631c7136620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20S=C3=A1nchez-Gallego?= Date: Thu, 28 Nov 2024 21:19:07 -0800 Subject: [PATCH] Retries for all calls to o2_alert --- src/lvmcryo/handlers/ln2.py | 2 +- src/lvmcryo/tools.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lvmcryo/handlers/ln2.py b/src/lvmcryo/handlers/ln2.py index 104655a..9100c47 100644 --- a/src/lvmcryo/handlers/ln2.py +++ b/src/lvmcryo/handlers/ln2.py @@ -191,7 +191,7 @@ async def check( else: try: self.log.info("Checking for O2 alarms ...") - if await retrier(o2_alert)(self.alerts_route): + if await o2_alert(self.alerts_route): self.fail("O2 alarm detected.") else: self.log.debug("No O2 alarms reported.") diff --git a/src/lvmcryo/tools.py b/src/lvmcryo/tools.py index e03295a..db6a877 100644 --- a/src/lvmcryo/tools.py +++ b/src/lvmcryo/tools.py @@ -26,6 +26,7 @@ from rich.console import Console from rich.progress import BarColumn, MofNCompleteColumn, Progress, TaskID, TextColumn +from lvmopstools.retrier import Retrier from sdsstools.logger import CustomJsonFormatter from sdsstools.utils import run_in_executor @@ -244,6 +245,7 @@ def get_fake_logger(): return logger +@Retrier(max_attempts=3, delay=0.5) async def o2_alert(route: str = "http://lvm-hub.lco.cl:8090/api/alerts"): """Is there an active O2 alert?"""