feat(scheduler-sim-decision-trace): hook the allocator runner
Task 3.4: the runner records no-plan reasons, the cluster-wide check, plans (tried, discarded, not tried) and their ends, positions, claimed skips and per-host candidate verdicts, rollbacks, commit or finalize failure, and search end. A declined or generator-failed requirement now counts once as 'no plan generated'. Runner results are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
d4bee4b5d0
commit
16f40fa9dc
9 changed files with 1216 additions and 14 deletions
|
|
@ -551,7 +551,7 @@ Each hook is one `SCHED_TRACE(core, ...)` statement placed after the value it re
|
|||
- `; no plan tried: all generated plans discarded` (4.9) when g > 0 and d = g;
|
||||
- `; no plan could be placed` (4.6) when rc = 0, t > 0 and no plan ended in an internal error.
|
||||
|
||||
When rc > 0 or rc < 0 there is no statement; the commit or internal-error entries already say what happened. Like every other entry it counts against the line budget. It also bumps the matching decision-wide counter (requirements with no plan generated / all discarded / none placed), under the same conditions, which appear in the fixed-size totals block after truncation (9.3). | 4.6, 4.7, 4.9 |
|
||||
When rc > 0 or rc < 0 there is no statement; the commit or internal-error entries already say what happened. A declined requirement and a generator that cannot start end the runner before the search end: their `no_plan` entry is the requirement's "no plan generated" line and bumps that counter itself, once; a search end after a `no_plan` entry in the same requirement makes no statement and counts nothing. Like every other entry it counts against the line budget. It also bumps the matching decision-wide counter (requirements with no plan generated / all discarded / none placed), under the same conditions, which appear in the fixed-size totals block after truncation (9.3). | 4.6, 4.7, 4.9 |
|
||||
| Plan loop | malformed / reserve failure / try / result | `plan_discarded`; `plan_not_tried(err)`; `plan_begin`; `plan_end(rc, failed_pos)` | 4.3, 4.4, 4.6, 4.9 |
|
||||
| Position | `sched_claim_bucket_` | `pos_begin`; iterator init failure → `pos_end(SCAN_ERROR)`; snapshot failure after acceptance (`alloc_runner.c:237-243`) → `pos_end(INTERNAL)`; else `pos_end(FILLED/UNFILLED/SCAN_ERROR, host)` | 4.4, 5.9 |
|
||||
| Candidate | claimed skip / per-host result | `host_begin` + `host_verdict(CLAIMED)`; `host_begin`, call, `host_verdict(rc>0 ? ACCEPTED : rc==0 ? from rows : INTERNAL, err)` | 5.1–5.7 |
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@
|
|||
- _Requirements: 11.2, 11.4_
|
||||
- _Depends: 2.3_
|
||||
|
||||
- [ ] 3. Allocator-thread hooks at the decision seams
|
||||
- [x] 3. Allocator-thread hooks at the decision seams
|
||||
- [x] 3.1 Hook the allocator loop: position, record lifecycle, selection and no-decision paths (P)
|
||||
- **Position:** when session settings are present, every real job pop increments it.
|
||||
- **Record start:** a wanted job starts a record with its selection facts; its cluster-wide limits are added after election.
|
||||
|
|
@ -163,7 +163,7 @@
|
|||
- _Boundary: TraceHooks (host iterator, satisfaction check)_
|
||||
- _Depends: 2.2_
|
||||
|
||||
- [ ] 3.4 Hook the allocator runner: cluster-wide check, plans, positions, candidates and finalize
|
||||
- [x] 3.4 Hook the allocator runner: cluster-wide check, plans, positions, candidates and finalize
|
||||
- The runner records:
|
||||
- an allocator decline and a generator start failure, as no-plan reasons;
|
||||
- the cluster-wide check scope and its end, with "no plans tried" on failure;
|
||||
|
|
@ -363,3 +363,4 @@
|
|||
- 3.1: allocator-loop hooks live in `sched_allocator()` (sched_election.c), with helpers `sched_trace_push_no_decision()` and `sched_trace_attach()`. Selection is captured at job lookup, before election, so NO_SCHEDOBJ still has its selection; cluster-wide limits are captured after election. The position counter (`ctl->position`) is not SCHED_TRACE-gated (it creates the record) and counts only real pops. `sched_sim_isolation_lib` stays without the trace sources (unresolved references in a static archive are harmless); 5.1 decides whether to add them. `core->decisions` holds 5 items, so trace-only decisions take FIFO slots and cannot reorder real ones.
|
||||
- 3.2: requirement-branch hooks are in scheduler.c (`sched_make_allocation`, `sched_make_alter_allocation`, `sched_make_compound_alloc_`). The alternatives after the chosen one are not stored as entries; 4.1 renders "alternatives i+1..n not tried" from the alt_result (i,n). A merge failure stores an ATTEMPT_REASONS entry with ncodes==0. A failing single requirement records no attempt reasons; its pend outcome carries them. A single job with a NULL resreq stores its begin as a container with 0 members before returning -EINVAL, and 4.1 must tolerate that.
|
||||
- 3.3: the pre-filter (`sched_host_iter_next`) opens a host scope (`sched_trace_host_begin`) for every candidate and closes it with a verdict on each rejection: SELECT (pre-filter), INTERNAL(rc) for an uncommitted-fetch or check error, from-rows for a resource rejection (unreachable from the runner). A host the iterator returns is left in an open scope with no entry, so 3.4 must end or replace it for the accepted, already-claimed, snapshot-failure and per-host-error paths, or later rows attach to a stale host. A scan stopped with rc<0 calls `pos_scan_error`; exhaustion does not. `unsatisfy_` hands every row to `sched_trace_check_rows`. The sim thread's reconciliation reaches that hook but sees trace_rec NULL.
|
||||
- 3.4: runner hooks are in alloc_runner.c. The 1.5 OPEN item is settled: `sched_trace_no_plan` counts `reqs_none_generated` once and sets `scope_no_plan`, after which `search_end` makes no statement and `resreq_begin`/`search_end` reset the flag. So a declined or generator-failed requirement has a NO_PLAN entry and no SEARCH_END line, and 4.1 must render the NO_PLAN line as "no plan generated: <reason>". The 3.3 open scope is closed: every returned candidate gets a fresh host scope and one verdict, and check_begin drops any stale host rows. When the iterator can't start, the position ends as SCAN_ERROR with err 0, so 4.1 must render a scan error with no code. trace.h is at 790 lines; split it before adding to it.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue