Skip to content

Commit

Permalink
Fix panic issue with proportional scheduling
Browse files Browse the repository at this point in the history
Signed-off-by: Nikita <capitan.crazy.dayz@gmail.com>
  • Loading branch information
Томчик Никита Сергеевич authored and Cdayz committed Jul 20, 2023
1 parent 5302995 commit 46e014c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/scheduler/plugins/predicates/proportional.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func checkNodeResourceIsProportional(task *api.TaskInfo, node *api.NodeInfo, pro
return status, nil
}
}

for resourceName, resourceRate := range proportional {
if value, found := node.Idle.ScalarResources[resourceName]; found {
cpuReserved := value * resourceRate.CPU
memoryReserved := value * resourceRate.Memory * 1000 * 1000
r := node.Idle.Clone()
r = r.Sub(task.Resreq)
if r.MilliCPU < cpuReserved || r.Memory < memoryReserved {

if node.Idle.MilliCPU-task.Resreq.MilliCPU < cpuReserved || node.Idle.Memory-task.Resreq.Memory < memoryReserved {
status.Code = api.Unschedulable
status.Reason = fmt.Sprintf("proportional of resource %s check failed", resourceName)
return status, fmt.Errorf("proportional of resource %s check failed", resourceName)
Expand Down

0 comments on commit 46e014c

Please sign in to comment.