harmonytask tests

This commit is contained in:
Andrew Jackson (Ajax)
2023-08-28 19:21:59 -05:00
parent 3d60a65906
commit e72e8588b9
4 changed files with 9 additions and 4 deletions
+3
View File
@@ -399,6 +399,9 @@ func (e *TaskEngine) resourcesInUse() resources.Resources {
tmp.Cpu -= int(ct) * t.Cost.Cpu
tmp.Gpu -= float64(ct) * t.Cost.Gpu
tmp.Ram -= uint64(ct) * t.Cost.Ram
if len(t.Cost.GpuRam) == 0 {
continue
}
for i := int32(0); i < ct; i++ {
for grIdx, j := range tmp.GpuRam {
if j > t.Cost.GpuRam[0] {
+2 -1
View File
@@ -11,6 +11,7 @@ import (
"time"
logging "github.com/ipfs/go-log/v2"
"github.com/samber/lo"
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
)
@@ -219,7 +220,7 @@ func (h *taskTypeHandler) AssertMachineHasCapacity() error {
return errors.New("Did not accept " + h.Name + " task: out of available GPU")
}
for _, u := range r.GpuRam {
if u > h.Cost.GpuRam[0] {
if u > lo.Sum(h.Cost.GpuRam) {
goto enoughGpuRam
}
}