feat(scheduler): restore PEND-reason P1 + fix dispatchwindow merge regressions
The scheduler-framework merge (2026-08-25) silently regressed the PEND reason P1 work (4e2ac86/ee79179): the old fcfs.c became dead-on-default (builtin_fcfs replaced it), resource.c/limit.c conflict resolution took Rongsong's side, and the merge-fix only re-added the dispatchwindow FIELD without the logic. After the merge, sched_queue_is_ready/sched_job_is_ready were `return 1` stubs and only MATCH_FAIL/NO_RESOURCE were ever emitted. Restore P1 on the active (framework) path, keeping every reason attach in the allocator thread (bug-1521: the picker thread must not write job->schedobj->reason — it races the allocator's MOVE_PTR): - core.c: sched_job_is_ready (PEND & not suspended) and sched_queue_is_ready (QUEUE_STAT_CLOSED/INACT_ADMIN/INACT_WINDOW gate) real implementations. - scheduler.c: allocator loop injects sched_queue_status_reason() — queue status first, then the dispatch window evaluated against the core's virtual clock (xce_core_now/1e9) so live and sim modes agree; attaches QUEUE_CLOSED/DRAINING/TIME_WINDOW and pends the job. Adds <time.h>. - resource.c: skip UNAVAIL/CLOSED/CLOSED_BY_ADMIN workers + HOST_UNAVAIL (restored from4e2ac86). - limit.c: attach LIMIT_GLOBAL/LIMIT_HOST + carry reason in limit_job_election (restored from4e2ac86). Two further merge regressions found during cluster verification (the framework core path never carried the queue dispatch window): - core_events.c core_build_queue: duplicate q->dispatchwindow_config onto xce_sched_queue_t.dispatchwindow (make_sched_queue did this; the core path dropped it, so TIME_WINDOW could never fire on the default path). - core_events.c core_upsert_queue update branch: refresh dispatchwindow on QUEUE_UPDATE. Regression test: test_core_ready_gates.c (white-box #include of core.c, 7 cases covering both gates), registered in scheduler testsuite meson.build. Cluster-verified on t1/t2/t3 (nix xcecore closure + AppImage standard deployment): night queue (window closed) -> main_reason=8 time_window; all workers down -> main_reason=9 host_unavail with per-host detail; closed queue -> job stays PEND; normal queue baseline -> DONE. Scheduler suite 52/53 (1 pre-existing admin-request symlink-escape failure, unrelated). Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
parent
6020015fa7
commit
91c3fb7f04
8 changed files with 305 additions and 4 deletions
|
|
@ -204,6 +204,8 @@ spec 声称 36/36 任务完成,但 re-audit(research.md)发现缺陷。来
|
|||
- **code 策略已定**:扩展 PREASON_* 枚举到 9 个(BAD_RESREQ/NO_RESOURCE/MATCH_FAIL/LIMIT_GLOBAL/LIMIT_HOST/QUEUE_CLOSED/QUEUE_DRAINING/TIME_WINDOW/HOST_UNAVAIL),capnp UInt32 无限制。
|
||||
- **P0**:main_reason 修复(首个 detail code 设为主因,集群验证 PEND 作业 main_reason 非 0 + reason_name)+ limit 插件 attach(host 限额→LIMIT_HOST+limit 名,全局限额→LIMIT_GLOBAL+limit 名)。**集群验证**:PEND 作业 API 显示 `main_reason:3 main_reason_name:"match_fail"` + 每条 host/res reason 带 reason_name。
|
||||
- **P1 部分**:队列状态(sched_queue_is_ready 非 stub,closed/inactive 队列不参选 + fcfs election attach QUEUE_CLOSED/DRAINING);worker 过滤(sched_try_alloc_on_host_ 跳过 UNAVAIL/CLOSED worker + HOST_UNAVAIL)。
|
||||
- **⚠️ scheduler-framework 合并(2026-08-25)回归掉 P1**:P1 改动点(4e2ac86/ee79179)在旧 `fcfs.c`,框架合并用 `builtin_fcfs` 取代后旧 fcfs.c 成死路径;`resource.c`/`limit.c` 冲突取 theirs 直接丢;merge-fix 只补 dispatchwindow **字段**不补逻辑;验证从未跑。合并后 `sched_queue_is_ready`/`sched_job_is_ready` 是 `return 1` stub(core.c),仅 3 处 preason emit。
|
||||
- **✅ P1 已恢复(2026-08-30)**:core.c 恢复 job 状态门 + queue 状态门;scheduler.c allocator 循环注入 `sched_queue_status_reason`(状态→QUEUE_CLOSED/DRAINING,时间窗→TIME_WINDOW,用 `xce_core_now` 虚拟时钟);resource.c 恢复 worker 过滤+HOST_UNAVAIL;limit.c 恢复 LIMIT_GLOBAL/HOST attach。**全部 reason attach 走 allocator 线程(bug-1521 安全)**。单测通过(新增 `test_core_ready_gates.c`,scheduler 套件 52/53,唯一失败是既有的 admin-request 校验顺序问题与 P1 无关)。遗留:持续 closed 队列的作业被 picker 跳过(spec 契约)到不了 allocator → 收不到 reason(合并前 #17 后同样如此,非新回归)。集群验证待做。
|
||||
- **剩余(P2,超出 PEND reason 范畴,属 scheduler 特性开发)**:依赖 depend_cond / license / 保留 RsvID / exclusive / fairshare——机制本身在 scheduler 未实现(设计文档:调度器无处理);机制落地后 reason 自动出现,MCP 侧无需改。已收尾:TIME_WINDOW 已实现(ee79179,2026-08-15);`scheduler_pend_reasons` 工具(bjobs -p 等价)已上线(67abbfa,2026-08-15)。
|
||||
|
||||
### 5. 设计层加固(文档已写、代码零实现)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue