From 9346e8d44ce8fd69c8a8fab7da63a82f06729d80 Mon Sep 17 00:00:00 2001 From: Plamen Dimitrov Date: Wed, 17 May 2023 05:51:02 +0300 Subject: [PATCH] logging and debugging for remote spawner's is_alive checks --- avocado/plugins/spawners/remote.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/avocado/plugins/spawners/remote.py b/avocado/plugins/spawners/remote.py index 4fa6c22848..9246ea4eae 100644 --- a/avocado/plugins/spawners/remote.py +++ b/avocado/plugins/spawners/remote.py @@ -12,7 +12,7 @@ from avocado.core.settings import settings from avocado.core.spawners.common import SpawnerMixin, SpawnMethod -LOG = logging.getLogger(__name__) +LOG = logging.getLogger("avocado.job." + __name__) class RemoteSpawnerException(Exception): @@ -128,10 +128,19 @@ def is_task_alive(runtime_task): session = runtime_task.spawner_handle + # TODO: it seems we always call this once right at the end of each + # test (using other methods to detect running test) and when doing + # this always end up with "" output and timeout error, slowing the + # run down and leading to task not being alive without fatal problems + return False + # TODO: create second session to properly check this? why is the first + # one always ending with empty output? try: - session.read_up_to_prompt(timeout=1.0) + out = session.read_up_to_prompt(timeout=1.0) + LOG.critical(f"Alive output: {out} with task {runtime_task}") return True - except exceptions.ExpectTimeoutError: + except exceptions.ExpectTimeoutError as error: + LOG.critical(f"Alive error: {error} with task {runtime_task}") return False # TODO: consider a secondary session as an alternative? #status, _ = session.cmd_status_output("pgrep -r R,S -f task-run")