merge job rusage and pending reason support

This commit is contained in:
Rongsong Shen 2025-12-16 14:36:28 +08:00
parent 30824ae5ea
commit cb0c7fe9e7
82 changed files with 4280 additions and 2561 deletions

View file

@ -314,6 +314,37 @@ static int sched_job_update_fun(int type, int situation, void* data, va_list ap)
return rc;
}
static int sched_job_rusage_update_fun(int type, int situation, void* data,
va_list ap)
{
cluster_t* c = va_arg(ap, cluster_t*);
xce_job_rusages_t* rusages = va_arg(ap, xce_job_rusages_t*);
int rc = 0;
/* clang-format off */
xce_notify_data_t xdata = {
.event = NotifyData_data_schedJobRusages,
.data = {
.sched_job_rusages = rusages
}
};
/* clang-format on */
mylock_lock(&(c->sched.lock));
if (c->sched.ep != NULL) {
switch (situation) {
case HOOK_AFTER_EVENT:
rc = notify(c, c->sched.ep, &xdata);
break;
default:
break;
}
}
mylock_unlock(&(c->sched.lock));
return rc;
}
static int sched_job_hook_fun(int type, int situation, int detail, void* data,
va_list ap)
{
@ -328,6 +359,8 @@ static int sched_job_hook_fun(int type, int situation, int detail, void* data,
return sched_job_update_fun(type, situation, data, ap);
case HOOK_DETAIL_JOB_FAIL:
return sched_job_fail_fun(type, situation, data, ap);
case HOOK_DETAIL_JOB_RUSAGE_UPDATE:
return sched_job_rusage_update_fun(type, situation, data, ap);
}
return 0;