Skip to content

Commit

Permalink
fix: Invalid image format log spam in Agent (#2894)
Browse files Browse the repository at this point in the history
  • Loading branch information
jopemachine authored and Yaminyam committed Feb 12, 2025
1 parent 0e49b41 commit 34932d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 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
14 changes: 9 additions & 5 deletions src/ai/backend/agent/docker/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1100,6 +1100,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 @@ -1119,6 +1120,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 @@ -1357,11 +1359,13 @@ async def scan_images(self) -> Mapping[str, str]:
try:
ImageRef.parse_image_str(repo_tag, "*")
except (InvalidImageName, InvalidImageTag) as e:
log.warning(
"Image name {} does not conform to Backend.AI's image naming rule. This image will be ignored. Details: {}",
repo_tag,
e,
)
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. Details: {}",
repo_tag,
e,
)
self.checked_invalid_images.add(repo_tag)
continue

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

0 comments on commit 34932d2

Please sign in to comment.