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
|
|
@ -130,6 +130,16 @@ type rawSubmitData struct {
|
|||
fromHost string
|
||||
}
|
||||
|
||||
// rawHostSlot mirrors one xce_host_alloc_t's host name plus its "slots"
|
||||
// resource allocation count (xce_host_alloc_t.allocs[], scanned for
|
||||
// resname=="slots" -- mirrors the C scheduler's own get_nslots_in_alloc()/
|
||||
// repl_worker_alloc_nslots() convention, defaulting to 1 when no explicit
|
||||
// slots entry is present).
|
||||
type rawHostSlot struct {
|
||||
host string
|
||||
slots int
|
||||
}
|
||||
|
||||
// rawJobData mirrors the C xce_job_t fields used by the Go model.
|
||||
type rawJobData struct {
|
||||
jobID int64
|
||||
|
|
@ -140,7 +150,7 @@ type rawJobData struct {
|
|||
startTime int64
|
||||
finishTime int64
|
||||
submit *rawSubmitData
|
||||
execHosts []string
|
||||
execHosts []rawHostSlot
|
||||
}
|
||||
|
||||
// rawWorkerData mirrors the C xce_worker_t fields used by the Go model.
|
||||
|
|
@ -225,7 +235,7 @@ func rawJobToModel(r rawJobData) *models.JobInfo {
|
|||
}
|
||||
slots := make([]hostSlot, len(r.execHosts))
|
||||
for i, h := range r.execHosts {
|
||||
slots[i] = hostSlot{HostName: h, NumSlots: 1}
|
||||
slots[i] = hostSlot{HostName: h.host, NumSlots: h.slots}
|
||||
}
|
||||
data, _ := json.Marshal(execHostsJSON{HostSlots: slots, NumHosts: len(slots)})
|
||||
info.ExecHosts = models.Jsonb{String: string(data)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue