feat(scheduler-allocation): rewrap seqjob allocation onto shared iterators

Restructure seqjob's my_alloc() as a trivial single-bucket case over the
shared xce_alloc_plan_iter_t/xce_host_iter_t contracts, replacing its own
inline worker-collection loop. Guard seqjob_prepare_allocation() to
maxTasks == 1, closing the fan-out gap for the parallel allocator's later
fix (Req 9.1, 4.6).

Export sched_try_alloc_on_host_() from resource.c (drop static/va_list,
plain (worker, sched, ctx) signature) so seqjob calls the real per-host
try-alloc leaf instead of a private duplicate; delete the now-dead
sched_try_alloc_on_hosts() variadic wrapper. Also wires host_iter.c into
the production scheduler_srcs list (task 2.1 only added it to testsuite).

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 18:48:49 +00:00
parent 86c86352d1
commit b18c5f780d
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
7 changed files with 602 additions and 37 deletions

View file

@ -1527,6 +1527,21 @@ sched_alloc_cache_test = executable(
dependencies: [scheduler_test_deps],
install: false)
# Task 3.1 (scheduler-allocation spec, Req 9.1, 4.6): seqjob_allocator.c's
# rewrap onto the shared plan_iter/host_iter interfaces, plus the new
# maxTasks==1 guard on seqjob_prepare_allocation() (Req 4.6). Same
# white-box #include pattern as sched_host_iter_test above (../src/core.c,
# ../src/resource.c, ../src/schedobj.c, ../src/host_iter.c) PLUS
# ../src/plugins/seqjob_allocator.c itself, the file under test. Smoke-
# level coverage only -- the exhaustive pre/post-rewrap equivalence proof
# is task 3.2's dedicated sched_seqjob_rewrap_equivalence_test.
sched_seqjob_allocator_test = executable(
'sched_seqjob_allocator_test',
['test_seqjob_allocator.c'],
include_directories:[incdir],
dependencies: [scheduler_test_deps],
install: false)
# Register as meson tests so `meson test --suite scheduler` runs them all.
# detect_leaks=0 matches the suite convention (fixtures are not torn down).
test('scheduler test', scheduler_test, suite: 'scheduler',
@ -1718,3 +1733,6 @@ test('scheduler host iter test',
test('scheduler alloc cache test',
sched_alloc_cache_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])
test('scheduler seqjob allocator test',
sched_seqjob_allocator_test, suite: 'scheduler',
env: ['ASAN_OPTIONS=detect_leaks=0'])