JobGroups check active job to determine if in progress (#4602)

This commit is contained in:
Mike Degatano 2023-10-04 12:53:10 -04:00 committed by GitHub
parent 1c815dcad1
commit d70aa5f9a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 5 deletions

View File

@ -1,7 +1,6 @@
"""Interface class for Supervisor Docker object."""
from __future__ import annotations
import asyncio
from collections import defaultdict
from collections.abc import Awaitable
from contextlib import suppress
@ -92,7 +91,6 @@ class DockerInterface(JobGroup):
)
self.coresys: CoreSys = coresys
self._meta: dict[str, Any] | None = None
self.lock: asyncio.Lock = asyncio.Lock()
@property
def timeout(self) -> int:
@ -153,7 +151,7 @@ class DockerInterface(JobGroup):
@property
def in_progress(self) -> bool:
"""Return True if a task is in progress."""
return self.lock.locked()
return self.active_job
@property
def restart_policy(self) -> RestartPolicy | None:

View File

@ -58,7 +58,6 @@ class HomeAssistantCore(JobGroup):
"""Initialize Home Assistant object."""
super().__init__(coresys, JOB_GROUP_HOME_ASSISTANT_CORE)
self.instance: DockerHomeAssistant = DockerHomeAssistant(coresys)
self.lock: asyncio.Lock = asyncio.Lock()
self._error_state: bool = False
@property
@ -402,7 +401,7 @@ class HomeAssistantCore(JobGroup):
@property
def in_progress(self) -> bool:
"""Return True if a task is in progress."""
return self.instance.in_progress or self.lock.locked()
return self.instance.in_progress or self.active_job
async def check_config(self) -> ConfigResult:
"""Run Home Assistant config check."""