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

@ -178,6 +178,28 @@ int xcecli_hello(xcecli_ctx_t c, char* msg)
return xce_hello(&(ctx->ctx), msg);
}
int xcecli_nop(xcecli_ctx_t c)
{
api_ctx_t* ctx = (api_ctx_t*)c;
if (c == NULL) {
return -EINVAL;
}
return xce_nop(&(ctx->ctx));
}
int xcecli_heartbeat(xcecli_ctx_t c, int hb_interval)
{
api_ctx_t* ctx = (api_ctx_t*)c;
if (c == NULL) {
return -EINVAL;
}
return xce_heartbeat(&(ctx->ctx), hb_interval);
}
int xcecli_shutdown(xcecli_ctx_t c)
{
api_ctx_t* ctx = (api_ctx_t*)c;
@ -589,3 +611,52 @@ void xcecli_unblock_tasks(xcecli_ctx_t c)
xce_unblock_tasks(&(ctx->ctx));
}
int xcecli_set_pend_reason(xcecli_ctx_t c, xce_preason_set_t* reasons)
{
api_ctx_t* ctx = (api_ctx_t*)c;
int rc;
if ((ctx == NULL) || (reasons == NULL)) {
return -EINVAL;
}
rc = xce_set_pend_reason(&(ctx->ctx), reasons);
return rc;
}
int xcecli_clear_reason(xcecli_ctx_t c, int njobs, uint64_t* jobs)
{
api_ctx_t* ctx = (api_ctx_t*)c;
int rc;
/* clang-format off */
xce_clear_reason_t reason = {
.njobs = njobs,
.jobs = jobs
};
/* clang-format on */
if ((ctx == NULL) || ((njobs > 0) && (jobs == NULL))) {
return -EINVAL;
}
if (njobs == 0) {
return 0;
}
rc = xce_clear_reason(&(ctx->ctx), &reason);
return rc;
}
int xcecli_jobinfo(xcecli_ctx_t c, uint64_t jobid, xce_job_t** job)
{
api_ctx_t* ctx = (api_ctx_t*)c;
int rc;
if ((ctx == NULL) || (job == NULL)) {
return -EINVAL;
}
rc = xce_jobinfo(&(ctx->ctx), jobid, job);
return rc;
}