Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@

package org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

import org.apache.hadoop.yarn.api.protocolrecords.ResourceTypes;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.ResourceInformation;
Expand All @@ -26,10 +31,6 @@
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.LeafQueue;
import org.apache.hadoop.yarn.util.resource.DominantResourceCalculator;
import org.apache.hadoop.yarn.util.resource.ResourceUtils;
import org.junit.Before;
import org.junit.Test;

import java.io.IOException;

import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.argThat;
Expand Down Expand Up @@ -210,7 +211,7 @@ public void testInterQueuePreemptionWithStrictAndRelaxedDRF()
"-b(=[20480:200 61440:600 0:0 20480:20 0]);" + // a
"-c(=[20480:200 61440:600 0:0 0:0 0])"; // c
String appsConfig =
//queueName\t(priority,resource,host,expression,#repeat,reserved)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" + "(1,1024:1,n1,,60,false,0:0,user1);" + // app1 in a
"b\t" + "(1,0:0,n1,,0,false,20480:20,user2);"; // app2 in b

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

package org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity;

import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.TestProportionalCapacityPreemptionPolicy.IsPreemptionRequestFor;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.mockframework.ProportionalCapacityPreemptionPolicyMockFramework;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.TestProportionalCapacityPreemptionPolicy.IsPreemptionRequestFor;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.mockframework.ProportionalCapacityPreemptionPolicyMockFramework;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;

import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.never;
Expand Down Expand Up @@ -845,7 +846,7 @@ public void testIntraQueuePreemptionWithTwoUsers()
"-b(=[40 100 40 120 0])"; // b

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user(optional))
"a\t" // app1 in a
+ "(1,1,n1,,5,false,25);" + // app1 a
"a\t" // app2 in a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void testIntraQueuePreemptionFairOrderingPolicyEnabledOneAppPerUser()
// With FairOrderingPolicy enabled on queue a, all 20 resources should be
// preempted from app1
String appsConfig =
// queueName\t(prio,resource,host,expression,#repeat,reserved,pending,user)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1, user1 in a
+ "(1,1,n1,,60,false,0,user1);" +
"a\t" // app2, user2 in a
Expand Down Expand Up @@ -122,7 +122,7 @@ public void testIntraQueuePreemptionFifoOrderingPolicyEnabled()
// With FifoOrderingPolicy enabled on queue a, the first 5 should come from
// the youngest app, app2, until app2 is reduced to the user limit of 35.
String appsConfig =
// queueName\t(prio,resource,host,expression,#repeat,reserved,pending,user)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1, user1 in a
+ "(1,1,n1,,60,false,0,user1);" +
"a\t" // app2, user2 in a
Expand All @@ -145,7 +145,7 @@ public void testIntraQueuePreemptionFifoOrderingPolicyEnabled()
// The next 15 should come from app1 even though app2 is younger since app2
// has already been reduced to its user limit.
appsConfig =
// queueName\t(prio,resource,host,expression,#repeat,reserved,pending,user)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1, user1 in a
+ "(1,1,n1,,60,false,0,user1);" +
"a\t" // app2, user2 in a
Expand Down Expand Up @@ -195,7 +195,7 @@ public void testIntraQueuePreemptionFairOrderingPolicyMulitipleAppsPerUser()
// preempted from app1 since it's the most over served app from the most
// over served user
String appsConfig =
// queueName\t(prio,resource,host,expression,#repeat,reserved,pending,user)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 and app2, user1 in a
+ "(1,1,n1,,35,false,0,user1);" +
"a\t"
Expand Down Expand Up @@ -243,7 +243,7 @@ public void testIntraQueuePreemptionFifoOrderingPolicyMultipleAppsPerUser()
// user4/app4 is requesting 20 resources in queue a
// With 3 users, preemptable user limit should be around 35 resources each.
String appsConfig =
// queueName\t(prio,resource,host,expression,#repeat,reserved,pending,user)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1, user1 in a
+ "(1,1,n1,,40,false,0,user1);" +
"a\t" // app2, user1 in a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@

package org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity;

import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.mockframework.ProportionalCapacityPreemptionPolicyMockFramework;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
import java.io.IOException;

import org.junit.Before;
import org.junit.Test;

import java.io.IOException;
import org.apache.hadoop.yarn.server.resourcemanager.monitor.capacity.mockframework.ProportionalCapacityPreemptionPolicyMockFramework;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;

import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.times;
Expand Down Expand Up @@ -84,7 +85,7 @@ public void testSimpleIntraQueuePreemptionWithTwoUsers()
"-a(=[100 100 100 30 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,100,false,0,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -139,7 +140,7 @@ public void testNoIntraQueuePreemptionWithSingleUser()
"-a(=[100 100 100 30 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,100,false,0,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -196,7 +197,7 @@ public void testNoIntraQueuePreemptionWithTwoUserUnderUserLimit()
"-a(=[100 100 80 30 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,50,false,0,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -252,7 +253,7 @@ public void testSimpleIntraQueuePreemptionWithTwoUsersWithAppPriority()
"-a(=[100 100 100 30 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(2,1,n1,,100,false,0,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -309,7 +310,7 @@ public void testIntraQueuePreemptionOfUserLimitWithMultipleApps()
"-a(=[100 100 80 90 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,30,false,30,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -370,7 +371,7 @@ public void testNoPreemptionOfUserLimitWithMultipleAppsAndSameUser()
"-a(=[100 100 80 90 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,30,false,20,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -439,7 +440,7 @@ public void testIntraQueuePreemptionOfUserLimitWitAppsOfDifferentPriority()
"-a(=[100 100 80 60 0])"; // b

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(3,1,n1,,30,false,30,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -490,7 +491,7 @@ public void testIntraQueuePreemptionOfUserLimitInTwoQueues()
"-b(=[40 100 35 20 0])"; // b

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(3,1,n1,,20,false,30,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -556,7 +557,7 @@ public void testIntraQueuePreemptionWithTwoRequestingUsers()
"-a(=[100 100 100 20 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,60,false,10,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -795,7 +796,7 @@ public void testNoIntraQueuePreemptionWithUserLimitDeadzone()
"-a(=[100 100 100 20 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,3,n1,,20,false,10,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -855,7 +856,7 @@ public void testIntraQueuePreemptionWithUserLimitDeadzoneAndPriority()
"-a(=[100 100 100 20 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,3,n1,,20,false,10,user1);" + // app1 a
"a\t" // app2 in a
Expand All @@ -879,7 +880,7 @@ public void testIntraQueuePreemptionWithUserLimitDeadzoneAndPriority()
// After first round, 3 containers were preempted from app1 and resource
// distribution will be like below.
appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,3,n1,,17,false,10,user1);" + // app1 a
"a\t" // app2 in a
Expand Down Expand Up @@ -914,7 +915,7 @@ public void testSimpleIntraQueuePreemptionOneUserUnderOneUserAtOneUserAbove()
"-a(=[100 100 100 1 0])"; // a

String appsConfig =
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending)
// queueName\t(priority,resource,host,expression,#repeat,reserved,pending,user)
"a\t" // app1 in a
+ "(1,1,n1,,65,false,0,user1);" +
"a\t" // app2 in a
Expand Down