mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-10-03 07:43:58 +00:00
feat(scheduler): M7 可观测性 + 压力测试 + 端到端测试
设计依据 docs/zh/input-scheduler-design.md §11.5(O1/O2)、§11.6(E1/E2)。
- 可观测性:KernelStatus 新增 Scheduler 段(running/三集合深度/计数/
深度上限),由 GetKernelStatus 从 DumpScheduler 原子快照填充;
新增 events.EventScheduler,挂起/恢复各发一条(action/task/level)
- TaskKind.String() 便于日志与状态输出
- 新增 scheduler_e2e_test.go 3 项:
· 压力:200 排队输入 + 50 中断全部经真实 loop 执行,结束时三集合排空、
LLM 调用数精确等于输入数、无 Rejected
· 可观测性:挂起/恢复事件齐备,状态快照计数一致
· 端到端:完整启动 schedulerLoop+interceptLoop,经真实 channel 投递
L1 任务与 L4 中断,验证「LLM 流式中断 → 挂起 → 中断先完成 → 原任务恢复」
整条链路(LLM 调用数 = 丢弃1+中断1+恢复1+常规1)
- 验收:agent 全量 + -race;全仓 build/vet 通过
This commit is contained in:
@ -46,6 +46,36 @@ type KernelStatus struct {
|
||||
ONNX ONNXStatus `json:"onnx"`
|
||||
|
||||
Tracker TrackerStatus `json:"tracker"`
|
||||
|
||||
// Scheduler 是输入调度器的运行时快照(可观测性,设计文档 §11 O1/O2)。
|
||||
// M2 起输入不再直接排队在 channel 上,而是经 readyQueue/pendingInterrupts/
|
||||
// suspendPool 三集合按优先级调度;这里把这些状态暴露出来。
|
||||
Scheduler SchedulerStatus `json:"scheduler"`
|
||||
}
|
||||
|
||||
// SchedulerStatus 是调度器的原子快照 DTO。
|
||||
type SchedulerStatus struct {
|
||||
// Running 是当前执行的任务(空表示空闲)。
|
||||
Running *SchedulerTask `json:"running,omitempty"`
|
||||
// ReadyQueueDepth / PendingInterrupts / SuspendPool 是三个集合的深度。
|
||||
ReadyQueueDepth int `json:"ready_queue_depth"`
|
||||
PendingInterrupts int `json:"pending_interrupts"`
|
||||
SuspendPool int `json:"suspend_pool"`
|
||||
MaxSuspendDepth int `json:"max_suspend_depth"`
|
||||
|
||||
Enqueued uint64 `json:"enqueued"`
|
||||
Executed uint64 `json:"executed"`
|
||||
Rejected uint64 `json:"rejected"`
|
||||
Suspended uint64 `json:"suspended"`
|
||||
Resumed uint64 `json:"resumed"`
|
||||
Preempted uint64 `json:"preempted"`
|
||||
}
|
||||
|
||||
// SchedulerTask 是任务的最小标识(不暴露帧内容)。
|
||||
type SchedulerTask struct {
|
||||
ID uint64 `json:"id"`
|
||||
Level int `json:"level"`
|
||||
Kind string `json:"kind"`
|
||||
}
|
||||
|
||||
// ONNXStatus 是统一多模态向量空间(ONNX 模型)的启用状态与身份。
|
||||
|
||||
Reference in New Issue
Block a user