feat(scheduler-core): extract xce_sched_core_t from monolithic scheduler struct (task 4.1)
Splits xce_scheduler_t along the controller-I/O seam: xce_sched_core_t
(new core.h/core.c) now holds all scheduling state (jobs/queues/workers/
users/projects/resource managers/plugins/three-thread-cbuf pipeline),
while xce_scheduler_t shrinks to {core; apictx; cluster_cfg}. Proven via
an nm-based link-time isolation test (zero netio/xcecli/idgen/delaymgr
symbols reachable from core.c) plus a reproducible wall-clock-call guard.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019dw5WnN3DXStaEaPYfACU1
This commit is contained in:
parent
604a564904
commit
7c229284e2
26 changed files with 1233 additions and 661 deletions
|
|
@ -81,24 +81,26 @@ int sched_init_config(xce_scheduler_t* s, xce_conf4sched_t* c)
|
|||
|
||||
/* REAL kvmgr-backed job add/get -- same rtti path production uses (mirrors
|
||||
* test_job_array_expand.c's precedent), needed so sched_on_job_array()'s
|
||||
* per-element dedup check (sched_get_job) is exercised for real. */
|
||||
int sched_add_job(xce_scheduler_t* sched, xce_sched_job_t* j)
|
||||
* per-element dedup check (sched_get_job) is exercised for real. Relocated
|
||||
* to core.h (scheduler-core spec, task 4.1) -- now operate on
|
||||
* xce_sched_core_t*, not xce_scheduler_t*. */
|
||||
int sched_add_job(xce_sched_core_t* core, xce_sched_job_t* j)
|
||||
{
|
||||
int rc;
|
||||
lock(sched->jobs, RTTI_LOCK_WRITE);
|
||||
rc = key_add(sched->jobs, (void*)j->jobid, j);
|
||||
unlock(sched->jobs);
|
||||
lock(core->jobs, RTTI_LOCK_WRITE);
|
||||
rc = key_add(core->jobs, (void*)j->jobid, j);
|
||||
unlock(core->jobs);
|
||||
return rc;
|
||||
}
|
||||
|
||||
xce_sched_job_t* sched_get_job(xce_scheduler_t* sched, uint64_t jobid)
|
||||
xce_sched_job_t* sched_get_job(xce_sched_core_t* core, uint64_t jobid)
|
||||
{
|
||||
int rc;
|
||||
xce_sched_job_t* job = NULL;
|
||||
|
||||
lock(sched->jobs, RTTI_LOCK_READ);
|
||||
rc = key_find(sched->jobs, (void*)jobid, (void**)&job);
|
||||
unlock(sched->jobs);
|
||||
lock(core->jobs, RTTI_LOCK_READ);
|
||||
rc = key_find(core->jobs, (void*)jobid, (void**)&job);
|
||||
unlock(core->jobs);
|
||||
|
||||
if (rc <= 0) {
|
||||
return NULL;
|
||||
|
|
@ -118,12 +120,12 @@ static void fixture_init(xce_scheduler_t* sched)
|
|||
.datakiller = NULL };
|
||||
|
||||
memset(sched, 0, sizeof(*sched));
|
||||
mylock_init(&(sched->lock));
|
||||
sched->pend_updates[0] = (dataq_t*)calloc(1, sizeof(dataq_t));
|
||||
dataq_init(sched->pend_updates[0], NULL);
|
||||
sched->pend_updates[1] = (dataq_t*)calloc(1, sizeof(dataq_t));
|
||||
dataq_init(sched->pend_updates[1], NULL);
|
||||
sched->jobs = makeInstance(&xkvmgr_type, &jobs_params);
|
||||
mylock_init(&(sched->core.lock));
|
||||
sched->core.pend_updates[0] = (dataq_t*)calloc(1, sizeof(dataq_t));
|
||||
dataq_init(sched->core.pend_updates[0], NULL);
|
||||
sched->core.pend_updates[1] = (dataq_t*)calloc(1, sizeof(dataq_t));
|
||||
dataq_init(sched->core.pend_updates[1], NULL);
|
||||
sched->core.jobs = makeInstance(&xkvmgr_type, &jobs_params);
|
||||
}
|
||||
|
||||
/* Pop one pending update request, asserting it is an UPDATE_JOB op; hands
|
||||
|
|
@ -132,7 +134,7 @@ static void fixture_init(xce_scheduler_t* sched)
|
|||
* test_job_array_expand.c's identical helper. */
|
||||
static int pop_job_update(xce_scheduler_t* sched, xce_job_t*** jobs_out)
|
||||
{
|
||||
data_item_t* it = dataq_deq(sched->pend_updates[0], NULL);
|
||||
data_item_t* it = dataq_deq(sched->core.pend_updates[0], NULL);
|
||||
xce_sched_update_request_t* req;
|
||||
int njobs;
|
||||
|
||||
|
|
@ -168,7 +170,7 @@ static void materialize_popped_jobs(xce_scheduler_t* sched, xce_job_t** jobs,
|
|||
for (i = 0; i < njobs; i++) {
|
||||
xce_sched_job_t* job = (xce_sched_job_t*)calloc(1, sizeof(*job));
|
||||
job->jobid = jobs[i]->jobid;
|
||||
sched_add_job(sched, job);
|
||||
sched_add_job(&(sched->core), job);
|
||||
free_Job_ptr(&jobs[i]);
|
||||
}
|
||||
free(jobs);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue