@@ -103,6 +103,7 @@ public enum ContainerMetric {
103103 private ResourceUtilization containersUtilization ;
104104
105105 private ResourceThresholds overAllocationPreemptionThresholds ;
106+ private int overAlloctionPreemptionCpuCount = -1 ;
106107
107108 private volatile boolean stopped = false ;
108109
@@ -237,7 +238,7 @@ private void initializeOverAllocation(Configuration conf) {
237238 YarnConfiguration .MAX_NM_OVERALLOCATION_THRESHOLD );
238239 if (overAllocationMemoryUtilizationThreshold <= 0 ) {
239240 LOG .info ("NodeManager oversubscription is disabled because the memory " +
240- "utilization threshold is no larger than zero." );
241+ "overallocation threshold is no larger than zero." );
241242 return ;
242243 }
243244
@@ -249,36 +250,49 @@ private void initializeOverAllocation(Configuration conf) {
249250 YarnConfiguration .MAX_NM_OVERALLOCATION_THRESHOLD );
250251 if (overAllocationCpuUtilizationThreshold <= 0 ) {
251252 LOG .info ("NodeManager oversubscription is disabled because the CPU " +
252- "utilization threshold is no larger than zero." );
253+ "overallocation threshold is no larger than zero." );
253254 return ;
254255 }
255256
256- float preemptionThreshold = conf .getFloat (
257- YarnConfiguration .NM_OVERALLOCATION_PREEMPTION_THRESHOLD ,
258- YarnConfiguration .DEFAULT_NM_OVERALLOCATION_PREEMPTION_THRESHOLD );
259- if (preemptionThreshold <= overAllocationCpuUtilizationThreshold ) {
260- LOG .info ("NodeManager oversubscription is disabled because preemption" +
261- "threshold is no larger than the cpu utilization threshold." );
257+ float cpuPreemptionThreshold = conf .getFloat (
258+ YarnConfiguration .NM_OVERALLOCATION_CPU_PREEMPTION_THRESHOLD ,
259+ YarnConfiguration .
260+ DEFAULT_NM_OVERALLOCATION_CPU_PREEMPTION_THRESHOLD );
261+ if (cpuPreemptionThreshold <= overAllocationCpuUtilizationThreshold ) {
262+ LOG .info ("NodeManager oversubscription is disabled because the cpu " +
263+ " preemption threshold is no larger than the cpu overallocation" +
264+ " threshold." );
262265 return ;
263266 }
264- if (preemptionThreshold <= overAllocationMemoryUtilizationThreshold ) {
265- LOG .info ("NodeManager oversubscription is disabled because preemption" +
266- "threshold is no larger than the memory utilization threshold." );
267+
268+ float memoryPreemptionThreshold = conf .getFloat (
269+ YarnConfiguration .NM_OVERALLOCATION_MEMORY_PREEMPTION_THRESHOLD ,
270+ YarnConfiguration .
271+ DEFAULT_NM_OVERALLOCATION_MEMORY_PREEMPTION_THRESHOLD );
272+ if (memoryPreemptionThreshold <= overAllocationMemoryUtilizationThreshold ) {
273+ LOG .info ("NodeManager oversubscription is disabled because the memory" +
274+ " preemption threshold is no larger than the memory overallocation" +
275+ " threshold." );
267276 return ;
268277 }
269278
279+ this .overAlloctionPreemptionCpuCount = conf .getInt (
280+ YarnConfiguration .NM_OVERALLOCATION_PREEMPTION_CPU_COUNT ,
281+ YarnConfiguration .DEFAULT_NM_OVERALLOCATION_PREEMPTION_CPU_COUNT );
282+
270283 ResourceThresholds resourceThresholds = ResourceThresholds .newInstance (
271284 overAllocationCpuUtilizationThreshold ,
272285 overAllocationMemoryUtilizationThreshold );
273286 ((NodeManager .NMContext ) context ).setOverAllocationInfo (
274287 OverAllocationInfo .newInstance (resourceThresholds ));
275- this .overAllocationPreemptionThresholds =
276- ResourceThresholds . newInstance ( preemptionThreshold );
288+ this .overAllocationPreemptionThresholds = ResourceThresholds . newInstance (
289+ cpuPreemptionThreshold , memoryPreemptionThreshold );
277290
278291 LOG .info ("NodeManager oversubscription enabled with overallocation " +
279292 "thresholds (memory:" + overAllocationMemoryUtilizationThreshold +
280293 ", CPU:" + overAllocationCpuUtilizationThreshold + ") and preemption" +
281- " threshold: " + preemptionThreshold );
294+ " threshold (memory:" + memoryPreemptionThreshold + ", CPU:" +
295+ cpuPreemptionThreshold + ")" );
282296 }
283297
284298 private boolean isResourceCalculatorAvailable () {
0 commit comments