feat(scheduler-core): wire builtin_fcfs as registered default picker (task 2.4)

Registers builtin_fcfs at scheduler startup and makes it the default
job_pick_plugin, replacing the hardcoded "xce_sched_fcfs" literal in
sched_job_picker() with a fail-loud lookup through sched_resolve_job_picker().
The picker thread now branches legacy job_elect_fn plugins (delegated
unchanged, preserving their self-contained wbuf-driven loop) from native
xce_job_picker_iface_t pickers (driven by a new per-session loop), and the
allocator now calls on_dispatch/on_pend for every picker as Req 1 AC 4
requires. Closes task 2.3's flagged picker/allocator concurrency race with a
mutex on fcfs_plugin_data_t, and adds cancel points to next_job().
This commit is contained in:
Rongsong Shen 2026-08-03 08:51:45 +00:00
parent fcb32a8b30
commit 7ee9a16f53
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
11 changed files with 1036 additions and 54 deletions

View file

@ -97,6 +97,7 @@ extern int plugin_job_election(void*, xce_sched_job_t*);
extern int plugin_job_rusage_update(void*, xce_sched_job_t*,
xce_job_rusages_t*);
extern int register_fcfs(void*);
extern int register_builtin_fcfs(void*);
extern int register_limit(void*);
extern int register_seqjob_allocator(void*);
extern int register_parjob_allocator(void*);

View file

@ -137,6 +137,21 @@ extern int sched_init_config(xce_scheduler_t* sched, xce_conf4sched_t*);
* default to sched->job_pick_plugin when unset. See the field comment on
* xce_scheduler_t above -- this does NOT resolve/register the name. */
extern void sched_set_default_job_pick_plugin(xce_scheduler_t*);
/* Req 1 AC 6 / Req 2 AC 5 (scheduler-core spec, task 2.4): resolves
* sched->job_pick_plugin against the plugin registry (the same
* plugin_register()/key_find() mechanism every other plugin category
* uses) and validates the result actually implements the picker MUST
* hooks (xce_job_picker_iface_t: next_job, begin_session, end_session,
* on_dispatch, on_pend). Returns 0 and sets *out on success; a negative
* errno on failure:
* -EINVAL bad arguments, or sched->job_pick_plugin is unset (NULL),
* or the name IS registered but is not a usable picker
* -ENOENT the configured name is not registered at all
* Called from sched_init() (before the picker thread is created, so an
* unregistered/non-picker name fails scheduler startup synchronously) and
* from sched_job_picker() (the picker thread, at thread start) -- one
* implementation, two call sites, no duplicated lookup logic. */
extern int sched_resolve_job_picker(xce_scheduler_t*, xce_sched_plugin_t**);
extern int sched_update(xce_scheduler_t*);
extern void sched_go(xce_scheduler_t*);
extern void sched_begin_session(xce_scheduler_t*);