|
@@ -130,13 +130,41 @@ public class TestCapacitySchedulerAsyncScheduling {
|
|
|
testAsyncContainerAllocation(2);
|
|
|
}
|
|
|
|
|
|
+ @Test(timeout = 300000)
|
|
|
+ public void testAsyncThreadNames() throws Exception {
|
|
|
+ conf.setInt(
|
|
|
+ CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_THREAD,
|
|
|
+ 1);
|
|
|
+ conf.setInt(CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_PREFIX
|
|
|
+ + ".scheduling-interval-ms", 0);
|
|
|
+ final RMNodeLabelsManager mg = new NullRMNodeLabelsManager();
|
|
|
+ mg.init(conf);
|
|
|
+
|
|
|
+ // inject node label manager
|
|
|
+ MockRM rm = new MockRM(TestUtils.getConfigurationWithMultipleQueues(conf)) {
|
|
|
+ @Override
|
|
|
+ public RMNodeLabelsManager createNodeLabelManager() {
|
|
|
+ return mg;
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ rm.getRMContext().setNodeLabelManager(mg);
|
|
|
+ rm.start();
|
|
|
+
|
|
|
+ CapacityScheduler cs = (CapacityScheduler) rm.getResourceScheduler();
|
|
|
+ for (CapacityScheduler.AsyncScheduleThread thread :
|
|
|
+ cs.asyncSchedulerThreads) {
|
|
|
+ Assert.assertTrue(thread.getName()
|
|
|
+ .startsWith("AsyncCapacitySchedulerThread"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void testAsyncContainerAllocation(int numThreads) throws Exception {
|
|
|
conf.setInt(
|
|
|
CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_MAXIMUM_THREAD,
|
|
|
numThreads);
|
|
|
conf.setInt(CapacitySchedulerConfiguration.SCHEDULE_ASYNCHRONOUSLY_PREFIX
|
|
|
+ ".scheduling-interval-ms", 0);
|
|
|
-
|
|
|
final RMNodeLabelsManager mgr = new NullRMNodeLabelsManager();
|
|
|
mgr.init(conf);
|
|
|
|
|
@@ -187,7 +215,6 @@ public class TestCapacitySchedulerAsyncScheduling {
|
|
|
ams.get(i).allocate("*", 1024, 20 * (i + 1), new ArrayList<>());
|
|
|
totalAsked += 20 * (i + 1) * GB;
|
|
|
}
|
|
|
-
|
|
|
// Wait for at most 15000 ms
|
|
|
int waitTime = 15000; // ms
|
|
|
while (waitTime > 0) {
|