Skip to content

fix(BA-1626): Improve logging for inspecting missing containers #4784

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rapsealk
Copy link
Member

@rapsealk rapsealk commented Jun 23, 2025

Follow-up of #1266 and resolves #4783 (BA-1626)

This pull request refactors error handling in the src/ai/backend/agent/docker/agent.py file by replacing hardcoded HTTP status codes with the HTTPStatus enumeration for improved readability and maintainability. Additionally, logging behavior has been adjusted to ensure better clarity when handling specific Docker errors.

Refactoring HTTP status codes:

  • src/ai/backend/agent/docker/agent.py: Replaced hardcoded HTTP status codes (404 and 409) with HTTPStatus.NOT_FOUND and HTTPStatus.CONFLICT in multiple methods (_fetch_container_info, check_image, destroy_kernel, and log_iter). This improves code readability and aligns with Python's standard library conventions. [1] [2] [3] [4] [5]

Logging enhancements:

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue

@rapsealk rapsealk added this to the 25.6 milestone Jun 23, 2025
@rapsealk rapsealk self-assigned this Jun 23, 2025
@Copilot Copilot AI review requested due to automatic review settings June 23, 2025 08:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request refactors error handling and logging in the Docker agent to improve readability and clarity when handling missing or cleaned containers.

  • Replaces hardcoded HTTP status codes with HTTPStatus enumerations.
  • Adjusts logging behavior for better clarity on Docker error events.

@github-actions github-actions bot added size:S 10~30 LoC comp:agent Related to Agent component labels Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:agent Related to Agent component size:S 10~30 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No such container error during inspection via container.show()
1 participant