feat(scheduler-allocation): implement parjob's combinatorial plan generation

Add the real xce_alloc_plan_iter_t for parjob: for host-count k=1..maxTasks
(ascending, most-preferred-first), generate one balanced partition of
maxTasks into k buckets (floor/ceil split, remainder to the first rem
buckets), which is descending by construction. Pure function of maxTasks
alone -- never dereferences sched -- with a real pthread_testcancel()
cancellation point and stable post-exhaustion NULL (Req 2.1-2.6, 4.1).

my_alloc()/parjob_prepare_allocation() remain untouched stubs; wiring the
iterator into real allocation is task 4.2.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XYdtrEWWZfKRRGED7raEYg
This commit is contained in:
Rongsong Shen 2026-09-04 20:04:44 +00:00
parent 9d64ba0d69
commit 6ca717fb86
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
4 changed files with 583 additions and 1 deletions

View file

@ -51,7 +51,7 @@
- _Depends: 3.1_
- [ ] 4. Core: parjob combinatorial allocation
- [ ] 4.1 Implement parjob's lazy combinatorial plan generation
- [x] 4.1 Implement parjob's lazy combinatorial plan generation
- Generate candidate plans as a pure function of a job's task count: ascending host-count order, one balanced partition per host-count, descending bucket order within each plan
- Ensure each call advances a real cancellation point and that plan generation never inspects live worker state (a pure function of the task count alone)
- Write a unit test proving one-plan-per-call generation, most-preferred-first ordering (including an uneven split, e.g. splitting 7 tasks across 3 hosts), and a stable exhaustion signal