sched: Fix resource checks

This commit is contained in:
Łukasz Magiera 2022-05-23 22:18:41 +02:00
parent 16f434c790
commit fd8b91a5d4
2 changed files with 4 additions and 6 deletions

View File

@ -20,7 +20,6 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
task := (*sh.SchedQueue)[sqi]
selectedWindow := -1
var info storiface.WorkerInfo
var bestWid storiface.WorkerID
bestAssigned := math.MaxInt // smaller = better
@ -28,11 +27,11 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
wid := sh.OpenWindows[wnd].Worker
w := sh.Workers[wid]
res := info.Resources.ResourceSpec(task.Sector.ProofType, task.TaskType)
res := w.Info.Resources.ResourceSpec(task.Sector.ProofType, task.TaskType)
log.Debugf("SCHED try assign sqi:%d sector %d to window %d (awi:%d)", sqi, task.Sector.ID.Number, wnd, i)
if !windows[wnd].Allocated.CanHandleRequest(res, wid, "schedAssign", info) {
if !windows[wnd].Allocated.CanHandleRequest(res, wid, "schedAssign", w.Info) {
continue
}
@ -41,7 +40,6 @@ func SpreadWS(sh *Scheduler, queueLen int, acceptableWindows [][]int, windows []
continue
}
info = w.Info
bestWid = wid
selectedWindow = wnd
bestAssigned = wu

View File

@ -30,12 +30,12 @@ func LowestUtilizationWS(sh *Scheduler, queueLen int, acceptableWindows [][]int,
wid := sh.OpenWindows[wnd].Worker
w := sh.Workers[wid]
res := info.Resources.ResourceSpec(task.Sector.ProofType, task.TaskType)
res := w.Info.Resources.ResourceSpec(task.Sector.ProofType, task.TaskType)
log.Debugf("SCHED try assign sqi:%d sector %d to window %d (awi:%d)", sqi, task.Sector.ID.Number, wnd, i)
// TODO: allow bigger windows
if !windows[wnd].Allocated.CanHandleRequest(res, wid, "schedAssign", info) {
if !windows[wnd].Allocated.CanHandleRequest(res, wid, "schedAssign", w.Info) {
continue
}