From 773ac289dd7b1903e032edb4f028bf439dc3d7ec Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Thu, 16 Dec 2021 22:08:13 +0100 Subject: [PATCH] Tweak core add_job and async_add_job docstrings (#62112) --- homeassistant/core.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/core.py b/homeassistant/core.py index 2f5783de443..cb2a132307d 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -323,7 +323,10 @@ class HomeAssistant: _async_create_timer(self) def add_job(self, target: Callable[..., Any], *args: Any) -> None: - """Add job to the executor pool. + """Add a job to be executed by the event loop or by an executor. + + If the job is either a coroutine or decorated with @callback, it will be + run by the event loop, if not it will be run by an executor. target: target to call. args: parameters for method to call. @@ -336,7 +339,10 @@ class HomeAssistant: def async_add_job( self, target: Callable[..., Any], *args: Any ) -> asyncio.Future | None: - """Add a job from within the event loop. + """Add a job to be executed by the event loop or by an executor. + + If the job is either a coroutine or decorated with @callback, it will be + run by the event loop, if not it will be run by an executor. This method must be run in the event loop.