swe_agentic: ensure per-instance image before docker run

docker run's implicit pull prints nothing and the 120s start timeout
kills runs on slow mirrors; ensure_image brings the progress display,
mirror chain and watchdog to per-instance pulls (each sample = its own
image, 10 samples = 10 pulls).

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
sora 2026-09-18 08:54:30 +00:00
parent a93996094d
commit f09fe184fe

View File

@ -118,6 +118,15 @@ class SWEAgenticEnvironment(Environment):
# ---- container lifecycle ---- # ---- container lifecycle ----
def _start(self, image: str) -> str: def _start(self, image: str) -> str:
# per-instance image: ensure (local check -> mirror-chain pull with
# progress) BEFORE docker run -- `docker run` auto-pulls with zero
# output and its 120s timeout kills runs on slow mirrors
from ...sandbox.docker import ensure_image
try:
ensure_image(image)
except RuntimeError as e:
raise RuntimeError(f'image {image} unavailable: {str(e)[:150]}')
name = f'eh-swe-{uuid.uuid4().hex[:10]}' name = f'eh-swe-{uuid.uuid4().hex[:10]}'
r = _docker(['run', '-d', '--name', name, r = _docker(['run', '-d', '--name', name,
'-w', '/testbed', '-w', '/testbed',