diff --git a/evalharness/sandbox/prefetch.py b/evalharness/sandbox/prefetch.py index c3aa8e7..9a9baed 100644 --- a/evalharness/sandbox/prefetch.py +++ b/evalharness/sandbox/prefetch.py @@ -146,7 +146,13 @@ def _pull_one(image: str, verbose: bool = True) -> None: buf = '' _lines_iter = iter(lambda: None, 1) # placeholder, replaced below - _IDLE_S = 300 # no output for 5 minutes -> dead mirror + # no output at all -> dead mirror, switch source. ANY output resets + # the timer (manifest/layer announcements/DOWNLOADING refreshes), so + # this only fires on sources that print nothing. 10s default; + # override with EVALHARNESS_PULL_IDLE_S for slow-negotiating mirrors. + import os as _os2 + + _IDLE_S = float(_os2.environ.get('EVALHARNESS_PULL_IDLE_S', '10')) def _iter_lines(): nonlocal buf @@ -154,8 +160,8 @@ def _pull_one(image: str, verbose: bool = True) -> None: if not _selr.select(timeout=_IDLE_S): proc.kill() if verbose: - print(f'· no data for {_IDLE_S // 60}min -- dead ' - 'mirror, trying next source ...', + print(f'· no data for {_IDLE_S:.0f}s -- dead mirror, ' + 'trying next source ...', file=_sys.stderr, flush=True) return chunk = _os.read(_fd, 4096)