Skip to content

fix: idle checker init arguments #4557

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

Merged
merged 2 commits into from
May 29, 2025
Merged

Conversation

fregataa
Copy link
Member

@fregataa fregataa commented May 29, 2025

Checklist: (if applicable)

  • Milestone metadata specifying the target backport version
  • Mention to the original issue
  • Installer updates including:
    • Fixtures for db schema changes
    • New mandatory config options
  • Update of end-to-end CLI integration tests in ai.backend.test
  • API server-client counterparts (e.g., manager API -> client SDK)
  • Test case(s) to:
    • Demonstrate the difference of before/after
    • Demonstrate the flow of abstract/conceptual models with a concrete implementation
  • Documentation
    • Contents in the docs directory
    • docstrings in public interfaces and type annotations

@fregataa fregataa added this to the 25Q2 milestone May 29, 2025
@fregataa fregataa self-assigned this May 29, 2025
@Copilot Copilot AI review requested due to automatic review settings May 29, 2025 09:26
@github-actions github-actions bot added size:M 30~100 LoC comp:manager Related to Manager component labels May 29, 2025
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 PR refactors idle checker initialization by removing obsolete constructor parameters from NewUserGracePeriodChecker, introducing a unified BaseIdleChecker constructor for dependency injection, and updating checker instantiation to include the new db argument.

  • Removed event dispatcher and Redis args from NewUserGracePeriodChecker init
  • Added __init__ with dependencies to BaseIdleChecker and updated subclasses
  • Updated init_idle_checkers to pass db to all checker constructors
Comments suppressed due to low confidence (4)

src/ai/backend/manager/idle.py:1288

  • The updated checker_init_args now include db; add or update unit tests to verify that all idle checker subclasses are initialized correctly and handle missing/extra arguments as expected.
checker_init_args = (event_dispatcher, checker_host._redis_live, checker_host._redis_stat, db)

src/ai/backend/manager/idle.py:574

  • Changing BaseIdleChecker's constructor signature is a breaking change; ensure this API modification is documented in release notes or migration guides.
class BaseIdleChecker(AbstractIdleChecker, AbstractIdleCheckReporter):

src/ai/backend/manager/idle.py:510

  • [nitpick] The empty init in NewUserGracePeriodChecker may be redundant; consider removing it or adding a comment to explain its necessity if future initialization logic is expected.
def __init__(self) -> None:

src/ai/backend/manager/idle.py:574

  • [nitpick] Class-level declarations of dependency attributes in BaseIdleChecker duplicate the init parameters; consider consolidating to a single definition (e.g., via dataclass or annotations in init) to reduce redundancy.
_event_dispatcher: EventDispatcher

@fregataa fregataa requested a review from HyeockJinKim May 29, 2025 09:32
@HyeockJinKim HyeockJinKim added this pull request to the merge queue May 29, 2025
Merged via the queue into main with commit 8164422 May 29, 2025
27 checks passed
@HyeockJinKim HyeockJinKim deleted the fix/missing-idle-checker-args branch May 29, 2025 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:manager Related to Manager component size:M 30~100 LoC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants