Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix panic issue with proportional scheduling #2968

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Cdayz Hi, I'm sorry for the late review. Can you demonstrate how this introduce panic? I've not gotten the point here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if node.idle has some dimension less than requst, there will be a assert.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if node.idle has some dimension less than requst, there will be a assert.

OK. That's reasonable. I'm OK about the fix.

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