From a3aa18d16f2ccaf2411e1f14b35c6d0f62877b1f Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Thu, 19 Oct 2023 18:27:17 -0400 Subject: [PATCH 1/2] statemachine: expand debug information on task alive It may be useful to take note when tasks are very short lived, because this may reveal issues with the spawners. Signed-off-by: Cleber Rosa --- avocado/core/task/statemachine.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/avocado/core/task/statemachine.py b/avocado/core/task/statemachine.py index 08b74d0b01..a1001141a0 100644 --- a/avocado/core/task/statemachine.py +++ b/avocado/core/task/statemachine.py @@ -396,6 +396,9 @@ async def monitor(self): return if self._spawner.is_task_alive(runtime_task): + LOG.debug( + 'Task "%s" is alive at monitor phase', runtime_task.task.identifier + ) async with self._state_machine.lock: self._state_machine._monitored.append(runtime_task) try: @@ -414,6 +417,13 @@ async def monitor(self): self._state_machine.monitored.remove(runtime_task) except ValueError: pass + else: + LOG.debug( + 'Task "%s" was very short lived, this may be ' + "completely normal depending on the task itself. " + "Please check the task logs", + runtime_task.task.identifier, + ) # from here, this `task` ran, so, let's check # the its latest data in the status repo From c77d8ebd4eb92d2aa73d49c93897977a1f4ae893 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Thu, 19 Oct 2023 18:27:17 -0400 Subject: [PATCH 2/2] statemachine: trivial comments fix Signed-off-by: Cleber Rosa --- avocado/core/task/statemachine.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/avocado/core/task/statemachine.py b/avocado/core/task/statemachine.py index a1001141a0..7d636a5422 100644 --- a/avocado/core/task/statemachine.py +++ b/avocado/core/task/statemachine.py @@ -426,14 +426,14 @@ async def monitor(self): ) # from here, this `task` ran, so, let's check - # the its latest data in the status repo + # its latest data in the status repo latest_task_data = ( self._state_machine._status_repo.get_latest_task_data( str(runtime_task.task.identifier) ) or {} ) - # maybe, the results are not available yet + # or maybe its results are not available yet while latest_task_data.get("result") is None: await asyncio.sleep(0.1) latest_task_data = (