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

@ -17,12 +17,16 @@ static int run_tasks_on_host(cluster_t* c, endpoint_t* ep, uint64_t jobid,
.clientidx = ep->idx,
.taskhosts = (xce_taskhost_t*[]) { info } };
w = workermgr_lock(&(c->workermgr), info->host, OBJREF_READ);
rc = key_find(c->workermgr, (void*)info->host, (void**)&w);
if (rc < 0) {
return rc;
}
if (w == NULL) {
return -ENOENT;
}
if ((w->ep == NULL) || (IS_WORKER_UNAVAIL(w->host.status))) {
if ((w->ep == NULL) || (IS_WORKER_UNAVAIL(w->host->status))) {
obj_deref(w);
return -EINVAL;
}
@ -40,19 +44,24 @@ static int check_task_hosts(cluster_t* c, xce_taskrun_t* runmsg)
for (i = 0; i < runmsg->nhosts; i++) {
worker_t* w;
int rc = 0;
w = workermgr_lock(&(c->workermgr), runmsg->taskhosts[i]->host,
OBJREF_READ);
rc = key_find(c->workermgr, (void*)runmsg->taskhosts[i]->host,
(void**)&w);
if (rc < 0) {
return rc;
}
if (rc == 0) {
return -ENOENT;
}
if (w == NULL) {
return -ENOENT;
}
if ((w->ep == NULL) || IS_WORKER_UNAVAIL(w->host.status)) {
obj_deref(w);
if ((w->ep == NULL) || IS_WORKER_UNAVAIL(w->host->status)) {
return -ENOENT;
}
obj_deref(w);
}
return 0;