feat(scheduler-sim-live-allocation): extract shared picker/allocator into sched_election.c (task 3.1)
Relocates sched_job_picker()/sched_allocator() out of scheduler.c (1382 lines, already over this project's 800-line cap) into a new sched_election.c, retyped to xce_sched_core_t* -- the single implementation both drivers will spawn (task 4.1 wires simulation mode onto it). Independently verified bit-for-bit identical to the pre-relocation bodies modulo the sched->/core-> rename; no statement reordered, no branch changed. sched_make_allocation() becomes extern (was static, sole caller moved translation units); the old commit_decision() thin wrapper is deleted, its sole caller now calls sched_commit_decision() directly with identical semantics. sched_init() updated to spawn the relocated pair against &(sched->core). Adds an end-to-end fixture test proving a job flows from picked to a committed decision against bare (non-xce_scheduler_t) core state. Routes around, rather than fixes, two pre-existing out-of-boundary gaps this fixture exposed (seqjob/parjob allocator init still reading plugin->sched; make_sched_job()'s parse path not threading maxtasks/mintasks) -- both documented in the test's own comments for future follow-up. sched_election.c added to the normal build only; sched_sim_isolation_lib membership deferred to task 4.1, which is where sim mode actually starts spawning these threads. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RLSNJhNoULvVcUhXEFafQC
This commit is contained in:
parent
fc23ea8d31
commit
4195331b47
8 changed files with 675 additions and 242 deletions
|
|
@ -304,8 +304,29 @@ extern void sched_set_default_job_pick_plugin(xce_scheduler_t*);
|
|||
/* sched_resolve_job_picker relocated to core.h (scheduler-core spec, task
|
||||
* 4.3) -- it now operates on xce_sched_core_t*, not xce_scheduler_t*, so
|
||||
* xce_core_push_events() (core.c) can call it without core.c depending on
|
||||
* this header. Call sites in this file (sched_job_picker(), sched_allocator(),
|
||||
* sched_init()) now pass &sched->core. See core.h for the full contract. */
|
||||
* this header. Call sites in sched_election.c (sched_job_picker(),
|
||||
* sched_allocator()) and this file (sched_init()) now pass &sched->core
|
||||
* (or, for the two thread bodies, `core` directly -- see sched_election.c's
|
||||
* own header comment, scheduler-sim-live-allocation spec task 3.1). See
|
||||
* core.h for the full contract. */
|
||||
/* scheduler-sim-live-allocation spec, task 3.1 (Unified Picker/Allocator
|
||||
* Threads): sched_job_picker()/sched_allocator() relocated out of this
|
||||
* file into their own file, sched_election.c -- the single implementation
|
||||
* both normal mode (sched_init(), below, passing &(sched->core)) and a
|
||||
* future simulation driver (task 4.1, passing &(sim->core)) spawn. Retyped
|
||||
* from xce_scheduler_t* to xce_sched_core_t*; pthread_create()'s own
|
||||
* callback signature (void* (*)(void*)) is unchanged either way. Declared
|
||||
* here rather than a new header, mirroring this file's own established
|
||||
* convention for every other function this spec's migration
|
||||
* relocated/retyped (sched_meet_host_selection, sched_try_alloc_on_host_,
|
||||
* etc. below). */
|
||||
extern void* sched_job_picker(void* arg);
|
||||
extern void* sched_allocator(void* arg);
|
||||
/* scheduler-sim-live-allocation spec, task 3.1: exported (was `static`) --
|
||||
* its sole caller, sched_allocator(), moved out of this file (scheduler.c)
|
||||
* into sched_election.c, so this cross-file call needs external linkage.
|
||||
* Signature already core-safe since task 2.2. */
|
||||
extern int sched_make_allocation(xce_sched_core_t*, xce_sched_obj_t*);
|
||||
extern int sched_update(xce_scheduler_t*);
|
||||
extern void sched_go(xce_scheduler_t*);
|
||||
extern void sched_begin_session(xce_scheduler_t*);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue