fix(frontend): count host job-state columns and EXEC_HOST by real slots
NJOBS/RUN/SSUSP/USUSP (xcecli hosts list -l) and EXEC_HOST (xcecli jobs list) always showed a hardcoded 1 slot per host regardless of a job's actual per-host allocation -- rawJobToModel()'s ExecHosts JSONB builder never read the real per-host "slots" resource from the C job allocation, so the already-correct downstream slot-counting logic (computeHostSlotUsage, bug-1743) and EXEC_HOST's "N*host" formatter never had real data to work with. convert.go now extracts each host's real slots allocation via a new CGO indexing helper, mirroring the scheduler's own get_nslots_in_alloc() convention. Also wires hosts list -l's "CURRENT LOAD USED FOR SCHEDULING" table (tmp/ swap/mem/slots and friends) to the host's real live resource values -- previously entirely hardcoded placeholder strings, never connected to any backend data.
This commit is contained in:
parent
f55b49f1a7
commit
e395eaa3ad
5 changed files with 223 additions and 28 deletions
|
|
@ -9,6 +9,10 @@ package backend
|
|||
|
||||
// Helper to index into xce_host_alloc_t** (CGO cannot dereference C pointer-to-pointer arrays).
|
||||
static xce_host_alloc_t *job_alloc_host(xce_job_alloc_t *a, int i) { return a->allocs[i]; }
|
||||
|
||||
// Helper to index into xce_alloc_t** (same CGO limitation as above) -- one
|
||||
// host's per-resource allocation list, scanned for the "slots" entry.
|
||||
static xce_alloc_t *host_alloc_res(xce_host_alloc_t *h, int i) { return h->allocs[i]; }
|
||||
*/
|
||||
import "C"
|
||||
|
||||
|
|
@ -114,9 +118,24 @@ func cJobToModel(job *C.xce_job_t) *models.JobInfo {
|
|||
n := int(job.allocs.nhosts)
|
||||
for i := 0; i < n; i++ {
|
||||
h := C.job_alloc_host(job.allocs, C.int(i))
|
||||
if h != nil && h.host != nil {
|
||||
r.execHosts = append(r.execHosts, C.GoString(h.host))
|
||||
if h == nil || h.host == nil {
|
||||
continue
|
||||
}
|
||||
// bug-1743-followup: this host's own "slots" resource
|
||||
// allocation (xce_host_alloc_t.allocs[]), mirroring the C
|
||||
// scheduler's own get_nslots_in_alloc()/repl_worker_alloc_
|
||||
// nslots() resname scan -- defaults to 1 when absent, same as
|
||||
// those.
|
||||
nslots := 1
|
||||
nallocs := int(h.nallocs)
|
||||
for j := 0; j < nallocs; j++ {
|
||||
res := C.host_alloc_res(h, C.int(j))
|
||||
if res != nil && res.resname != nil && C.GoString(res.resname) == "slots" {
|
||||
nslots = int(res.value)
|
||||
break
|
||||
}
|
||||
}
|
||||
r.execHosts = append(r.execHosts, rawHostSlot{host: C.GoString(h.host), slots: nslots})
|
||||
}
|
||||
}
|
||||
return rawJobToModel(r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue