feat(scheduler-sim-live-allocation): make capacity checks core-safe (task 1.3)

Re-types sched_meet_host_selection(), sched_check_shared_satisfy()
(+its _ helper), sched_check_host_satisfy() (+its _ helper), and the
private unsatisfy_() helper they share, from xce_scheduler_t* to
xce_sched_core_t*, in resource.c.

Fixes every call site this forces (a C signature migration cannot
keep the build green otherwise): sched_try_alloc_on_host_() (2 sites,
already partially touched by task 1.2), host_iter.c's
sched_host_iter_next() (2 sites), and parjob_allocator.c/
seqjob_allocator.c's my_alloc() (1 site each) -- each fix is a minimal
&(sched->core) argument wrap, no algorithm change, preserving
host_iter/parjob/seqjob's own allocation algorithm exactly as-is.

Adds test_core_safe_allocation_chain_driver_parity, proving all three
functions produce identical grant/deny results whether given
normal-mode-shaped or simulation-mode-shaped core state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
Rongsong Shen 2026-09-18 12:42:11 +00:00
parent e8866641a6
commit 55173fca27
No known key found for this signature in database
GPG key ID: 5BCDAAE0123E9FE2
13 changed files with 345 additions and 53 deletions

View file

@ -336,11 +336,17 @@ extern int sched_publish_dispatch(xce_scheduler_t*, xce_job_dispatch_t*);
* function for the chicken-and-egg deadlock this closes. */
extern void sched_check_pending_rejoin(xce_scheduler_t*);
extern void sched_worker_release_host_ctx(xce_sched_worker_t*);
extern int sched_meet_host_selection(xce_scheduler_t*, xce_sched_worker_t*,
/* scheduler-sim-live-allocation spec, task 1.3: retyped from
* xce_scheduler_t* to xce_sched_core_t* -- these three now operate on
* shared core state directly, callable identically from either driver
* (both xce_scheduler_t and xce_sched_sim_driver_t embed xce_sched_core_t
* core as their first member). Body unchanged besides sched->core.X ->
* core->X field-access updates. */
extern int sched_meet_host_selection(xce_sched_core_t*, xce_sched_worker_t*,
xce_select_t*);
extern int sched_check_shared_satisfy(xce_scheduler_t*, xvec_t*, xvec_idval_t*,
extern int sched_check_shared_satisfy(xce_sched_core_t*, xvec_t*, xvec_idval_t*,
xvec_idval_t*);
extern int sched_check_host_satisfy(xce_scheduler_t*, xce_sched_worker_t*,
extern int sched_check_host_satisfy(xce_sched_core_t*, xce_sched_worker_t*,
xvec_t*, xvec_idval_t*, xvec_idval_t*);
extern int sched_collect_workers(xce_scheduler_t*, xlist_t*,
zarray_iter_skip_fn_t,