Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Silent failure of DockerAgent's push_image(), pull_image() #2572

Merged
Merged
1 change: 1 addition & 0 deletions changes/2572.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix silent failure of `DockerAgent.push_image()`, `DockerAgent.pull_image()`.
19 changes: 17 additions & 2 deletions src/ai/backend/agent/docker/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,13 @@ async def push_image(self, image_ref: ImageRef, registry_conf: ImageRegistry) ->
}

async with closing_async(Docker()) as docker:
await docker.images.push(image_ref.canonical, auth=auth_config)
# TODO: Remove this useless type casting after resolving https://github.com/aio-libs/aiodocker/pull/909.
result = cast(list, await docker.images.push(image_ref.canonical, auth=auth_config))

if not result:
raise RuntimeError("Failed to push image: unknown error")
jopemachine marked this conversation as resolved.
Show resolved Hide resolved
elif error := result[-1].get("error"):
raise RuntimeError(f"Failed to push image: {error}")

async def pull_image(
self,
Expand All @@ -1508,7 +1514,16 @@ async def pull_image(
}
log.info("pulling image {} from registry", image_ref.canonical)
async with closing_async(Docker()) as docker:
await docker.images.pull(image_ref.canonical, auth=auth_config, timeout=timeout)
# TODO: Remove this useless type casting after resolving https://github.com/aio-libs/aiodocker/pull/909.
result = cast(
list,
await docker.images.pull(image_ref.canonical, auth=auth_config, timeout=timeout),
)

if not result:
raise RuntimeError("Failed to pull image: unknown error")
elif error := result[-1].get("error"):
raise RuntimeError(f"Failed to pull image: {error}")

async def check_image(
self, image_ref: ImageRef, image_id: str, auto_pull: AutoPullBehavior
Expand Down