pass pend reason back to controller

This commit is contained in:
Rongsong Shen 2025-12-23 15:29:26 +08:00
parent cd0bca3138
commit 5560ae91da
16 changed files with 349 additions and 123 deletions

View file

@ -33,6 +33,7 @@ static xce_decision_t* calc_decision(xce_scheduler_t* sched, uint64_t jobid)
xce_sched_job_t* job = sched_get_job(sched, jobid);
xce_sched_plugin_t* plugin = NULL;
xce_job_alloc_t* alloc = NULL;
xce_pendreason_t* reason = NULL;
if (job == NULL) {
ERROR("%s job %lu can not be found", __func__, jobid);
@ -51,15 +52,16 @@ static xce_decision_t* calc_decision(xce_scheduler_t* sched, uint64_t jobid)
return NULL;
}
alloc = plugin->job_alloc_fn(job->allocator, jobid);
alloc = plugin->job_alloc_fn(job->allocator, jobid, &reason);
if (alloc == NULL) {
return make_pend_decision(jobid);
return make_pend_decision(reason);
}
return make_dispatch_decision(alloc);
}
static int commit_decision(xce_scheduler_t *sched, xce_decision_t *decision) {
static int commit_decision(xce_scheduler_t* sched, xce_decision_t* decision)
{
return sched_commit_decision(sched, decision);
}
@ -86,7 +88,7 @@ static void* sched_allocator(void* arg)
decision = calc_decision(sched, jobid);
commit_decision(sched, decision);
cbuf_put(&(sched->decisions), &decision);
}
@ -401,6 +403,13 @@ int sched_job_is_ready(xce_sched_job_t* j) { return 1; }
int sched_queue_is_ready(xce_sched_queue_t* q) { return 1; }
int sched_commit_decision(xce_scheduler_t *sched, xce_decision_t *decision) {
return 0;
int sched_commit_decision(xce_scheduler_t* sched, xce_decision_t* decision)
{
return plugin_commit_decision(sched, decision);
}
int sched_publish_pend_reason(xce_scheduler_t* sched,
xce_preason_set_t* reasons)
{
return xcecli_set_pend_reason(sched->apictx, reasons);
}