scheduling job with fake resource

This commit is contained in:
Rongsong Shen 2025-12-23 18:12:13 +08:00
parent 5560ae91da
commit 088afe4ea0
12 changed files with 281 additions and 46 deletions

View file

@ -206,7 +206,8 @@ int sched_init(xce_scheduler_t* sched, xce_client_config_t* config,
void sched_fini(xce_scheduler_t* sched)
{
void* res;
void* res;
uint64_t jobid;
if (sched == NULL) {
return;
@ -216,6 +217,8 @@ void sched_fini(xce_scheduler_t* sched)
pthread_join(sched->jobpicker, &res);
pthread_cancel(sched->allocator);
/* try to wake up allocator */
cbuf_tryput(&(sched->jbuf), &jobid);
pthread_join(sched->allocator, &res);
xcecli_wakeup(sched->apictx, (int)-EINTR);
@ -241,9 +244,11 @@ static int sched_update_config(xce_scheduler_t* sched, xce_conf4sched_t* config)
plugin_config_update(sched, config);
for (i = 0; i < config->n_queues; i++) {
xce_sched_queue_t* qold
= sched_get_queue(sched, config->queues[i]->queue);
xce_sched_queue_t* q = make_sched_queue(sched, config->queues[i]);
plugin_queue_update(sched, q);
plugin_queue_update(sched, qold, q);
}
return 0;
@ -255,9 +260,10 @@ static int sched_update_jobs(xce_scheduler_t* sched, int njobs,
int i;
for (i = 0; i < njobs; i++) {
xce_sched_job_t* j = make_sched_job(sched, jobs[i]);
xce_sched_job_t* jold = sched_get_job(sched, jobs[i]->jobid);
xce_sched_job_t* j = make_sched_job(sched, jobs[i]);
plugin_job_update(sched, j);
plugin_job_update(sched, jold, j);
}
return 0;
@ -269,9 +275,10 @@ static int sched_update_workers(xce_scheduler_t* sched, int nworkers,
int i;
for (i = 0; i < nworkers; i++) {
xce_sched_worker_t* w = make_sched_worker(sched, workers[i]);
xce_sched_worker_t* wold = sched_get_worker(sched, workers[i]->name);
xce_sched_worker_t* w = make_sched_worker(sched, workers[i]);
plugin_worker_update(sched, w);
plugin_worker_update(sched, wold,w);
}
return 0;
@ -413,3 +420,8 @@ int sched_publish_pend_reason(xce_scheduler_t* sched,
{
return xcecli_set_pend_reason(sched->apictx, reasons);
}
int sched_publish_dispatch(xce_scheduler_t* sched, xce_job_dispatch_t* dispatch)
{
return xcecli_jobdispatch(sched->apictx, dispatch);
}