-
Notifications
You must be signed in to change notification settings - Fork 975
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 the conflict between preemption and antiAffinity #3070
Fix the conflict between preemption and antiAffinity #3070
Conversation
@@ -411,45 +411,35 @@ func (pp *predicatesPlugin) OnSessionOpen(ssn *framework.Session) { | |||
Reason: api.NodePodNumberExceeded, | |||
} | |||
predicateStatus = append(predicateStatus, podsNumStatus) | |||
return predicateStatus, nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't return, please filter out those reason is null string at
volcano/pkg/scheduler/util/predicate_helper.go
Lines 156 to 158 in c91eb07
for _, status := range s { | |
all = append(all, status.Reason) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if nodeUnscheduleStatus.Code != api.Success { | ||
predicateStatus = append(predicateStatus, nodeUnscheduleStatus) | ||
return predicateStatus, false, nil | ||
return predicateStatus, false, fmt.Errorf("plugin %s predicates failed %s", nodeUnscheduleFilter.Name(), status.Message()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that if error is return, those code will not hit:
volcano/pkg/scheduler/actions/allocate/allocate.go
Lines 110 to 113 in c91eb07
if statusSets.ContainsUnschedulable() || statusSets.ContainsUnschedulableAndUnresolvable() || | |
statusSets.ContainsErrorSkipOrWait() { | |
return nil, api.NewFitError(task, node, statusSets.Message()) | |
} |
volcano/pkg/scheduler/actions/preempt/preempt.go
Lines 220 to 223 in c91eb07
if statusSets.ContainsUnschedulableAndUnresolvable() || statusSets.ContainsErrorSkipOrWait() { | |
return nil, fmt.Errorf("predicates failed in preempt for task <%s/%s> on node <%s>, status is not success or unschedulable", | |
task.Namespace, task.Name, node.Name) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- The filtering of the pod number in the predicate plugin will go to this part of the code logic
- The gpu-related resource filtering in device FilterNode will go to this part of the code logic
For strategies such as nodeaffinity, podaffinity, and nodeport, an error is returned directly, and the preemption action is not currently supported
if nodeAffinityStatus.Code != api.Success { | ||
predicateStatus = append(predicateStatus, nodeAffinityStatus) | ||
return predicateStatus, false, nil | ||
return predicateStatus, false, fmt.Errorf("plugin %s predicates failed %s", nodeAffinityFilter.Name(), status.Message()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
if nodePortStatus.Code != api.Success { | ||
predicateStatus = append(predicateStatus, nodePortStatus) | ||
return predicateStatus, nil | ||
return predicateStatus, fmt.Errorf("plugin %s predicates failed %s", nodePortFilter.Name(), status.Message()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thanks for your hard work. BTW, Is there any test result about this PR, not only including preemtation works well, but also the pod/podgroup unscheduling message in their status. |
And there is another enhancement can be used in preemption action: #3071 What's more, I think the current preemption action can not work well. In my opinion, it should following those steps:
|
I will add the test results later. |
14d1a8d
to
5d6cc2d
Compare
…t does not support preemption by strategies such as antiAffinity and topologyspread Signed-off-by: wangyang <[email protected]>
5d6cc2d
to
63bc96c
Compare
I very much agree with your proposal, the preemption function still has a lot to optimize, we can iterate gradually. |
@@ -126,15 +126,15 @@ func (ra *Action) Execute(ssn *framework.Session) { | |||
var statusSets util.StatusSets | |||
statusSets, err := ssn.PredicateFn(task, n) | |||
if err != nil { | |||
klog.V(3).Infof("reclaim predicates failed for task <%s/%s> on node <%s>: %v", | |||
klog.V(5).Infof("reclaim predicates failed for task <%s/%s> on node <%s>: %v", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason of change level 3 to level 5?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a large number of pending pods in the cluster perform the reclaim operation and resource reclamation fails, a large number of repeated logs are generated in each round of scheduling. I think it is more appropriate to change the log level to debug.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: william-wang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I have open an enhancement requirement to trace it. enhancement for preemption action #3074 |
Test Results:
The high-priority job anti-test preempts the resources of the low-priority job label-sh and runs successfully.
Pending pod event:
Pending pod msg: