Skip to content

Commit 22d58b8

Browse files
committed
Provide some race resilience for the task pulse check
There are observable cases where it might take a very short while for the process to appear and thus the task be considered alive so make sure the overall check makes at least a few tries within a ten second window. Signed-off-by: Plamen Dimitrov <plamen.dimitrov@intra2net.com>
1 parent 04f1157 commit 22d58b8

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

  • optional_plugins/spawner_remote/avocado_spawner_remote

optional_plugins/spawner_remote/avocado_spawner_remote/__init__.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import logging
55
import os
66
import shlex
7+
import time
78

89
from aexpect import exceptions, remote
910

@@ -137,9 +138,14 @@ def is_task_alive(runtime_task):
137138
# since each test is a session detached process, it is reasonable
138139
# to reuse the same session with a new command
139140
session = runtime_task.spawner_handle
140-
status, _ = session.cmd_status_output(
141-
f"pgrep -r R,S -f {runtime_task.task.identifier}"
142-
)
141+
for _ in range(10):
142+
status, output = RemoteSpawner.run_remote_cmd(
143+
session, f"pgrep -r R,S -f {runtime_task.task.identifier}", 10
144+
)
145+
LOG.debug(output)
146+
if status == 0:
147+
break
148+
time.sleep(1)
143149
return status == 0
144150

145151
@with_slot_reservation

0 commit comments

Comments
 (0)