From 256f828e973f148ad4bc88ec4b62c49bf7d35815 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= Date: Sun, 28 Nov 2021 13:43:58 +0100 Subject: [PATCH] Add stopped count to controller status api --- 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 7d8f4f4..2e98768 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 + stopped: int started: int max_started: int to_initialize: int diff --git a/src/runboat/controller.py b/src/runboat/controller.py index be3fb84..50f7ec0 100644 --- a/src/runboat/controller.py +++ b/src/runboat/controller.py @@ -48,6 +48,10 @@ class Controller: if event == BuildEvent.modified and build.status == BuildStatus.undeploying: self._wakeup_cleaner.set() + @property + def stopped(self) -> int: + return self.db.count_by_status(BuildStatus.stopped) + @property def started(self) -> int: return self.db.count_by_status(BuildStatus.started)