You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@yunikorn.apache.org by "Hedger Lai (Jira)" <ji...@apache.org> on 2026/10/07 19:53:00 UTC

[jira] [Created] (YUNIKORN-3501) [Core] Account for node available resource during victim selection in RequiredNodePreemptor.GetVictims

Hedger Lai created YUNIKORN-3501:
------------------------------------

             Summary: [Core] Account for node available resource during victim selection in RequiredNodePreemptor.GetVictims
                 Key: YUNIKORN-3501
                 URL: https://issues.apache.org/jira/browse/YUNIKORN-3501
             Project: Apache YuniKorn
          Issue Type: Sub-task
          Components: core - scheduler
            Reporter: Hedger Lai
            Assignee: Hedger Lai


h3. Problem

In {{PreemptionContext.GetVictims()}} ({{pkg/scheduler/objects/required_node_preemptor.go}}), the final check at the end of the function accounts for the node's currently available resource ({{p.node.GetAvailableResource()}}):

{code:go}
if len(victims) > 0 && resources.StrictlyGreaterThanOrEquals(
    resources.Add(currentResource, p.node.GetAvailableResource()), p.requiredAsk.GetAllocatedResource()) {
    return victims
}
{code}

However, the victim selection loop immediately above it initializes {{currentResource}} to an empty resource ({{0}}) and compares {{currentResource}} directly against {{p.requiredAsk.GetAllocatedResource()}} without including {{p.node.GetAvailableResource()}}:

{code:go}
var currentResource = resources.NewResource()
for _, allocation := range p.allocations {
    if !resources.StrictlyGreaterThanOrEquals(currentResource, p.requiredAsk.GetAllocatedResource()) {
        currentResource.AddTo(allocation.GetAllocatedResource())
        victims = append(victims, allocation)
    } else {
        break
    }
}
{code}

When the target node already has partial unallocated (available) resources, the loop ignores those available resources and continues preempting additional victims until the sum of victims alone reaches {{p.requiredAsk.GetAllocatedResource()}}, causing unnecessary over-preemption.

h3. Solution

Include {{p.node.GetAvailableResource()}} when tracking/comparing {{currentResource}} during the victim selection loop in {{GetVictims()}} so that victim selection stops as soon as {{available + reclaimed >= requiredAsk}}, and add unit test coverage verifying that partially available node resources prevent over-preemption.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@yunikorn.apache.org
For additional commands, e-mail: dev-help@yunikorn.apache.org