Pull idle watchdog: 10s default (was 5min), env-tunable
Any docker output resets the timer, so this only fires on totally silent (dead) mirrors; EVALHARNESS_PULL_IDLE_S overrides. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
d58fdb4198
commit
dacffb02f2
@ -146,7 +146,13 @@ def _pull_one(image: str, verbose: bool = True) -> None:
|
|||||||
buf = ''
|
buf = ''
|
||||||
_lines_iter = iter(lambda: None, 1) # placeholder, replaced below
|
_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():
|
def _iter_lines():
|
||||||
nonlocal buf
|
nonlocal buf
|
||||||
@ -154,8 +160,8 @@ def _pull_one(image: str, verbose: bool = True) -> None:
|
|||||||
if not _selr.select(timeout=_IDLE_S):
|
if not _selr.select(timeout=_IDLE_S):
|
||||||
proc.kill()
|
proc.kill()
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f'· no data for {_IDLE_S // 60}min -- dead '
|
print(f'· no data for {_IDLE_S:.0f}s -- dead mirror, '
|
||||||
'mirror, trying next source ...',
|
'trying next source ...',
|
||||||
file=_sys.stderr, flush=True)
|
file=_sys.stderr, flush=True)
|
||||||
return
|
return
|
||||||
chunk = _os.read(_fd, 4096)
|
chunk = _os.read(_fd, 4096)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user