Skip to content

Implement scheduler history repository layer #5968

@HyeockJinKim

Description

@HyeockJinKim

Story Description

Implement repository layer for managing scheduler history data access and manipulation.

Acceptance Criteria

  • Create SchedulerHistoryRepository class in src/ai/backend/manager/repositories/scheduler/
  • Implement methods for creating history records
  • Implement methods for updating history status
  • Support batch operations for sub-phase results
  • Implement query methods for retrieving history
  • Add proper error handling and logging
  • Write comprehensive unit tests

Required Repository Methods

Core Operations

async def create_scheduler_history(
    session_id: SessionId,
    scheduling_step: SchedulingStep,
    message: str
) -> SchedulerHistoryId

async def update_scheduler_history_status(
    history_id: SchedulerHistoryId,
    status: HistoryStatus,
    error_code: Optional[str],
    message: str
) -> None

async def add_phase_results(
    history_id: SchedulerHistoryId,
    phase_results: list[PhaseResult]
) -> None

async def increment_retry_count(
    history_id: SchedulerHistoryId
) -> int

Query Operations

async def get_session_history(
    session_id: SessionId
) -> list[SchedulerHistory]

async def get_latest_history(
    session_id: SessionId,
    scheduling_step: SchedulingStep
) -> Optional[SchedulerHistory]

async def get_failed_histories(
    time_range: TimeRange
) -> list[SchedulerHistory]

Testing Requirements

  • Unit tests for all repository methods
  • Integration tests with database
  • Performance tests for batch operations

JIRA Issue: BA-2440

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions