mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-19 15:16:33 +00:00
JobGroups check active job to determine if in progress (#4602)
This commit is contained in:
parent
1c815dcad1
commit
d70aa5f9a9
@ -1,7 +1,6 @@
|
|||||||
"""Interface class for Supervisor Docker object."""
|
"""Interface class for Supervisor Docker object."""
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from collections.abc import Awaitable
|
from collections.abc import Awaitable
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
@ -92,7 +91,6 @@ class DockerInterface(JobGroup):
|
|||||||
)
|
)
|
||||||
self.coresys: CoreSys = coresys
|
self.coresys: CoreSys = coresys
|
||||||
self._meta: dict[str, Any] | None = None
|
self._meta: dict[str, Any] | None = None
|
||||||
self.lock: asyncio.Lock = asyncio.Lock()
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def timeout(self) -> int:
|
def timeout(self) -> int:
|
||||||
@ -153,7 +151,7 @@ class DockerInterface(JobGroup):
|
|||||||
@property
|
@property
|
||||||
def in_progress(self) -> bool:
|
def in_progress(self) -> bool:
|
||||||
"""Return True if a task is in progress."""
|
"""Return True if a task is in progress."""
|
||||||
return self.lock.locked()
|
return self.active_job
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def restart_policy(self) -> RestartPolicy | None:
|
def restart_policy(self) -> RestartPolicy | None:
|
||||||
|
@ -58,7 +58,6 @@ class HomeAssistantCore(JobGroup):
|
|||||||
"""Initialize Home Assistant object."""
|
"""Initialize Home Assistant object."""
|
||||||
super().__init__(coresys, JOB_GROUP_HOME_ASSISTANT_CORE)
|
super().__init__(coresys, JOB_GROUP_HOME_ASSISTANT_CORE)
|
||||||
self.instance: DockerHomeAssistant = DockerHomeAssistant(coresys)
|
self.instance: DockerHomeAssistant = DockerHomeAssistant(coresys)
|
||||||
self.lock: asyncio.Lock = asyncio.Lock()
|
|
||||||
self._error_state: bool = False
|
self._error_state: bool = False
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -402,7 +401,7 @@ class HomeAssistantCore(JobGroup):
|
|||||||
@property
|
@property
|
||||||
def in_progress(self) -> bool:
|
def in_progress(self) -> bool:
|
||||||
"""Return True if a task is in progress."""
|
"""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:
|
async def check_config(self) -> ConfigResult:
|
||||||
"""Run Home Assistant config check."""
|
"""Run Home Assistant config check."""
|
||||||
|
Loading…
x
Reference in New Issue
Block a user