From af7fb32a5e3b8a642b614e0aabf4d08a940d7be4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 28 Nov 2021 15:27:34 +0100 Subject: [PATCH] Add failed count --- src/runboat/api.py | 1 + src/runboat/controller.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/runboat/api.py b/src/runboat/api.py index f6d2b19..4bcd06a 100644 --- a/src/runboat/api.py +++ b/src/runboat/api.py @@ -20,6 +20,7 @@ router = APIRouter() class Status(BaseModel): deployed: int max_deployed: int + failed: int stopped: int started: int max_started: int diff --git a/src/runboat/controller.py b/src/runboat/controller.py index 18893ff..532b168 100644 --- a/src/runboat/controller.py +++ b/src/runboat/controller.py @@ -52,6 +52,10 @@ class Controller: def stopped(self) -> int: return self.db.count_by_status(BuildStatus.stopped) + @property + def failed(self) -> int: + return self.db.count_by_status(BuildStatus.failed) + @property def started(self) -> int: return self.db.count_by_status(BuildStatus.started)