volcano-sh / volcano

A Cloud Native Batch System (Project under CNCF)
https://volcano.sh
Apache License 2.0
4.19k stars 962 forks source link

[Question] logic in preempt action #3694

Open vf827393 opened 2 months ago

vf827393 commented 2 months ago

Please describe your problem in detail

In preempt action, I see preempt logic like:

// Preemption between Jobs within Queue.
for _, queue := range queues {  // loop 1
    for {...  // loop 2
    }

    // Preemption between Task within Job.
    for _, job := range underRequest {...  // loop 3
    }
}

I'm kind of confused of the position of loop 3. Maybe it can be moved out of loop 1, since it seems to have no relation with queue.

I think in some case it may bring large overhead. Let me if I miss any consideration. thx

Monokaix commented 2 months ago

I think that the difference is that loop2 only consider preempt between jobs and loop3 consider preempt within jobs, we can know the differencr by checking the filtre func param of preempt.