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

[Issue-1084] Addjust scheduler extender algorithm #1086

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
19 changes: 13 additions & 6 deletions pkg/scheduler/extender/extender.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,14 +195,21 @@
e.Lock()
defer e.Unlock()

hostPriority, err := e.score(extenderArgs.Nodes.Items)
if err != nil {
ll.Errorf("Unable to score %v", err)
return
pod := extenderArgs.Pod
var hostPriority []schedulerapi.HostPriority
requests, _ := e.gatherCapacityRequestsByProvisioner(context.TODO(), pod)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to check error?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to replace TODO context by context with value

if len(requests) != 0 {
var err error
hostPriority, err = e.score(extenderArgs.Nodes.Items)
if err != nil {
ll.Errorf("Unable to score %v", err)
return
}
ll.Infof("Score results for pod %s: %v", pod, hostPriority)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to print just pod namespace and name

} else {
ll.Infof("Skip skoring for pod: %s", pod)

Check warning on line 210 in pkg/scheduler/extender/extender.go

View check run for this annotation

Codecov / codecov/patch

pkg/scheduler/extender/extender.go#L198-L210

Added lines #L198 - L210 were not covered by tests
}
ll.Infof("Score results: %v", hostPriority)
extenderRes := (schedulerapi.HostPriorityList)(hostPriority)

if err := resp.Encode(&extenderRes); err != nil {
ll.Errorf("Unable to write response %v: %v", extenderRes, err)
}
Expand Down
Loading