Coverage Report

Created: 2026-01-25 15:05

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/home/noah/src/realizar/src/scheduler/types.rs
Line
Count
Source
1
//! Scheduler Core Types
2
//!
3
//! Common types for the continuous batching scheduler.
4
//! Extracted from scheduler/mod.rs (PMAT-802).
5
6
use serde::{Deserialize, Serialize};
7
8
/// Request priority level
9
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
10
pub enum Priority {
11
    /// Low priority (background tasks)
12
    Low = 0,
13
    /// Normal priority (standard requests)
14
    Normal = 1,
15
    /// High priority (interactive requests)
16
    High = 2,
17
    /// Critical priority (system requests)
18
    Critical = 3,
19
}
20
21
impl Default for Priority {
22
23
    fn default() -> Self {
23
23
        Self::Normal
24
23
    }
25
}
26
27
/// Sequence state in the scheduler
28
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
29
pub enum SequenceState {
30
    /// Waiting in queue
31
    Waiting,
32
    /// Currently running
33
    Running,
34
    /// Preempted (swapped out)
35
    Preempted,
36
    /// Completed (EOS or max_tokens)
37
    Completed,
38
    /// Failed (error during generation)
39
    Failed,
40
}
41
42
/// Scheduler statistics
43
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
44
pub struct SchedulerStats {
45
    /// Total requests received
46
    pub total_requests: u64,
47
    /// Total requests completed
48
    pub completed_requests: u64,
49
    /// Total preemptions
50
    pub preemptions: u64,
51
    /// Average queue wait time (ms)
52
    pub avg_wait_time_ms: f64,
53
    /// Average time-to-first-token (ms)
54
    pub avg_ttft_ms: f64,
55
    /// Current queue depth
56
    pub queue_depth: usize,
57
    /// Current running count
58
    pub running_count: usize,
59
}