Skip to content

Commit

Permalink
fix: Silent failure of DockerAgent.push_image
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine committed Jul 26, 2024
1 parent 859b09d commit 38e91ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/ai/backend/agent/docker/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1343,7 +1343,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)
result = await docker.images.push(image_ref.canonical, auth=auth_config)

# Why is this list? It contradicts the API documentation.
result_ = cast(list, result)

if error := result_[-1].get("error"):
raise RuntimeError(f"Failed to push image: {error}")

async def pull_image(self, image_ref: ImageRef, registry_conf: ImageRegistry) -> None:
auth_config = None
Expand Down
6 changes: 5 additions & 1 deletion src/ai/backend/common/bgtask.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,11 @@ async def push_bgtask_events(
else:
await resp.send("{}", event="bgtask_done")
await resp.send("{}", event="server_close")
case BgtaskCancelledEvent() | BgtaskFailedEvent():
case BgtaskCancelledEvent():
await resp.send("{}", event="bgtask_failed")
await resp.send("{}", event="server_close")
case BgtaskFailedEvent():
await resp.send("{}", event="bgtask_cancelled")
await resp.send("{}", event="server_close")
except:
log.exception("")
Expand Down

0 comments on commit 38e91ed

Please sign in to comment.