Add stopped count to controller status api

This commit is contained in:
Stéphane Bidoul 2021-11-28 13:43:58 +01:00
parent b17e639572
commit 256f828e97
No known key found for this signature in database
GPG key ID: BCAB2555446B5B92
2 changed files with 5 additions and 0 deletions

View file

@ -20,6 +20,7 @@ router = APIRouter()
class Status(BaseModel):
deployed: int
max_deployed: int
stopped: int
started: int
max_started: int
to_initialize: int

View file

@ -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)