Skip to content

Commit 79af2ee

Browse files
committed
contest: loadavg: avoid false negatives when waiting for idle
kunit is sensitive to overload. We currently ungate it too early, we seem to kick off before other workers start. Wait a few cycles to confirm the machine is actually idle. Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 4ec10ed commit 79af2ee

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

contest/remote/lib/loadavg.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44
import time
55

66

7-
def wait_loadavg(target, check_ival=30):
7+
def wait_loadavg(target, check_ival=30, stable_cnt=4):
8+
"""
9+
Wait for loadavg to drop but be careful at the start, the load
10+
may have not ramped up, yet, so if we ungate early whoever is waiting
11+
will experience the overload.
12+
"""
813
while target is not None:
914
load, _, _ = os.getloadavg()
1015

1116
if load <= target:
12-
break
17+
if stable_cnt == 0:
18+
break
19+
stable_cnt -= 1
20+
else:
21+
stable_cnt = 0
1322

14-
print(f"Waiting for loadavg to decrease: {load} > {target}")
23+
print(f"Waiting for loadavg to decrease: {load} > {target} ({stable_cnt})")
1524
time.sleep(check_ival)

0 commit comments

Comments
 (0)