save works

This commit is contained in:
Rongsong Shen 2026-02-28 17:55:50 +08:00
parent b1faeb94b6
commit b748e30d20
35 changed files with 1247 additions and 2149 deletions

View file

@ -256,7 +256,7 @@ static int apiserver_job_update_fun(int type, int situation, void* data,
int rc;
xce_notify_data_t xdata
= { .event = NotifyData_data_updateJob,
.data = { .update_job = &(job->job) } };
.data = { .update_job = job->job } };
rc = notify(c, c->apiservers[i].ep, &xdata);
if (rc < 0) {
@ -351,11 +351,11 @@ static int apiserver_worker_change(int type, int situation, void* data,
{
int i;
TRACE("%s worker %s idx %d situation %d", __func__, w->host.name, w->idx,
TRACE("%s worker %s idx %d situation %d", __func__, w->host->name, w->idx,
situation);
collect_resval_with_idx(&(w->host.resvals), &(w->host.nresvals_to_sched),
&(w->host.resvals_to_sched));
collect_resval_with_idx(&(w->host->resvals), &(w->host->nresvals_to_sched),
&(w->host->resvals_to_sched));
switch (situation) {
case HOOK_AFTER_EVENT:
@ -383,8 +383,8 @@ static int apiserver_worker_change(int type, int situation, void* data,
break;
}
free_resval_with_idx_list(&(w->host.resvals_to_sched),
w->host.nresvals_to_sched);
free_resval_with_idx_list(&(w->host->resvals_to_sched),
w->host->nresvals_to_sched);
return 0;
}
@ -402,12 +402,18 @@ static int apiserver_worker_join(int type, int situation, void* data,
return 0;
}
w = workermgr_lock(&(c->workermgr), name, OBJREF_READ);
rc = key_find(c->workermgr, (void *)name, (void **)&w);
if (rc < 0) {
return rc;
}
if (rc == 0) {
return -ENOENT;
}
rc = apiserver_worker_change(type, situation, data, c, w);
/* FIXME: need to mark the jobs in this worker */
obj_deref(w);
return rc;
}
@ -508,7 +514,7 @@ static int apiserver_queue_hook_fun(int type, int situation, int detail,
int rc;
xce_notify_data_t xdata
= { .event = NotifyData_data_schedUpdateQueue,
.data = { .sched_update_queue = &(q->queue) } };
.data = { .sched_update_queue = q->queue } };
rc = notify(c, c->apiservers[i].ep, &xdata);
if (rc < 0) {