Currently, ProportionalCapacityPreemptionPolicy has hard coded logic to select candidates to be preempted (based on FIFO order of applications/containers). It's not a simple to add new candidate-selection logics, such as preemption for large container, intra-queeu fairness/policy, etc.
In this JIRA, I propose to do following changes:
1) Cleanup code bases, consolidate current logic into 3 stages:
- Compute ideal sharing of queues
- Select to-be-preempt candidates
- Send preemption/kill events to scheduler
2) Add a new interface: PreemptionCandidatesSelectionPolicy for above "select to-be-preempt candidates" part. Move existing how to select candidates logics to FifoPreemptionCandidatesSelectionPolicy.
3) Allow multiple PreemptionCandidatesSelectionPolicies work together in a chain. Preceding PreemptionCandidatesSelectionPolicy has higher priority to select candidates, and later PreemptionCandidatesSelectionPolicy can make decisions according to already selected candidates and pre-computed queue ideal shares of resources.