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

@ -311,7 +311,15 @@ extern int sched_collect_workers(xce_scheduler_t*, xlist_t*,
extern uint64_t sched_get_id(xce_scheduler_t*);
extern xce_alloc_t** sched_make_allocs(xce_scheduler_t*, char*, int, int*,
float*, int*);
extern int sched_try_alloc_on_hosts(xce_worker_group_t*, va_list);
/* scheduler-allocation spec, task 3.1 remediation: exported (was `static`,
* wrapped by a variadic sched_try_alloc_on_hosts() whose sole caller was
* seqjob_allocator.c's pre-rewrap xlist_find() call site -- both now
* deleted) so both seqjob_allocator.c and parjob_allocator.c can call this
* shared Composition-Algorithm try_alloc leaf directly with real
* parameters, instead of each carrying its own private copy. */
extern int sched_try_alloc_on_host_(xce_sched_worker_t*,
xce_scheduler_t*,
xce_sched_ctx_t*);
extern int get_resvals(zarray_t*, int, int*, float*);
extern int put_resvals(zarray_t*, int, int*, float*);
extern request_res_t* make_resource_request(char*, float);