ensure_image pulls through the CN mirror chain

The preflight did a bare 'docker pull' -- docker.io is slow/unreachable
from CN without luck; it now walks the same fallback chain as the SWE
prefetch (daemon mirrors -> daocloud -> 1ms.run -> baidubce -> sjtu ->
rat.dev), retagging the hit to the canonical name.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-16 02:32:11 +00:00
parent 2949e10371
commit 5e98f6b701
2 changed files with 13 additions and 6 deletions

View File

@ -36,14 +36,20 @@ def ensure_image(img: str) -> None:
return
if _run(['docker', 'image', 'inspect', img]).returncode == 0:
return
r = _run(['docker', 'pull', img], timeout=1800)
if r.returncode != 0:
# CN-mirror fallback chain (daocloud -> 1ms.run -> baidubce -> sjtu ->
# rat.dev), mirroring the SWE prefetch path; a hit is retagged to the
# canonical name so the recipe never knows which mirror answered
from .prefetch import _pull_one
try:
_pull_one(img)
return
except RuntimeError as e:
raise RuntimeError(
f'sandbox image {img!r} is not available: not local, and '
f'docker pull failed: {(r.stderr or "")[:200]}. '
'Fix: pull/build it first (for bigcodebench the official image '
f'sandbox image {img!r} is not available: not local, and every '
f'mirror failed. {str(e)[:200]}. '
'Fix: pull/build it manually (for bigcodebench the official image '
'is bigcodebench/bigcodebench-evaluate:latest), then re-run with '
'--rescore to score the cached predictions.')
'--rescore to score the cached predictions.') from e
@register_sandbox('docker')

View File

@ -21,6 +21,7 @@ from ..data.dataset import Dataset
# fall through: daemon default -> 1ms.run -> baidubce -> sjtug.
_CN_MIRROR_FALLBACKS = [
'{img}', # daemon default (uses its own registry-mirrors config)
'docker.m.daocloud.io/{img}',
'docker.1ms.run/{img}',
'mirror.baidubce.com/{img}',
'docker.mirrors.sjtug.sjtu.edu.cn/{img}',