Skip to content

Commit

Permalink
fix: Invalid image format log spam in Agent (#2894) (#2895)
Browse files Browse the repository at this point in the history
Co-authored-by: Gyubong Lee <jopemachine@naver.com>
  • Loading branch information
lablup-octodog and jopemachine authored Oct 8, 2024
1 parent c4cab2b commit 94f0e04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions changes/2894.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix invalid image format log spam in Agent
12 changes: 8 additions & 4 deletions src/ai/backend/agent/docker/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,6 +1055,7 @@ class DockerAgent(AbstractAgent[DockerKernel, DockerKernelCreationContext]):
metadata_server: MetadataServer
docker_ptask_group: aiotools.PersistentTaskGroup
gwbridge_subnet: Optional[str]
checked_invalid_images: Set[str]

def __init__(
self,
Expand All @@ -1074,6 +1075,7 @@ def __init__(
skip_initial_scan=skip_initial_scan,
agent_public_key=agent_public_key,
)
self.checked_invalid_images = set()

async def __ainit__(self) -> None:
async with closing_async(Docker()) as docker:
Expand Down Expand Up @@ -1256,10 +1258,12 @@ async def scan_images(self) -> Mapping[str, str]:
try:
ImageRef(repo_tag, ["*"])
except ValueError:
log.warning(
"Image name {} does not conform to Backend.AI's image naming rule. This image will be ignored.",
repo_tag,
)
if repo_tag not in self.checked_invalid_images:
log.warning(
"Image name {} does not conform to Backend.AI's image naming rule. This image will be ignored.",
repo_tag,
)
self.checked_invalid_images.add(repo_tag)
continue

img_detail = await docker.images.inspect(repo_tag)
Expand Down

0 comments on commit 94f0e04

Please sign in to comment.