|
@@ -1074,11 +1074,10 @@ public class TestCapacityScheduler {
|
|
|
queue =
|
|
|
scheduler.getApplicationAttempt(appsInB1.get(0)).getQueue()
|
|
|
.getQueueName();
|
|
|
- System.out.println(queue);
|
|
|
Assert.assertTrue(queue.equals("b1"));
|
|
|
|
|
|
appsInB = scheduler.getAppsInQueue("b");
|
|
|
- assertTrue(appsInA.contains(appAttemptId));
|
|
|
+ assertTrue(appsInB.contains(appAttemptId));
|
|
|
assertEquals(1, appsInB.size());
|
|
|
|
|
|
appsInRoot = scheduler.getAppsInQueue("root");
|
|
@@ -1140,6 +1139,7 @@ public class TestCapacityScheduler {
|
|
|
assertTrue(appsInA1.isEmpty());
|
|
|
|
|
|
appsInA = scheduler.getAppsInQueue("a");
|
|
|
+ assertTrue(appsInA.contains(appAttemptId));
|
|
|
assertEquals(1, appsInA.size());
|
|
|
|
|
|
appsInRoot = scheduler.getAppsInQueue("root");
|
|
@@ -1664,7 +1664,7 @@ public class TestCapacityScheduler {
|
|
|
Assert.assertTrue(queue.equals("b1"));
|
|
|
|
|
|
appsInB = scheduler.getAppsInQueue("b");
|
|
|
- assertTrue(appsInA.contains(appAttemptId));
|
|
|
+ assertTrue(appsInB.contains(appAttemptId));
|
|
|
assertEquals(1, appsInB.size());
|
|
|
|
|
|
appsInRoot = scheduler.getAppsInQueue("root");
|
|
@@ -1798,4 +1798,96 @@ public class TestCapacityScheduler {
|
|
|
rm.stop();
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testKillAllAppsInQueue() throws Exception {
|
|
|
+ MockRM rm = setUpMove();
|
|
|
+ AbstractYarnScheduler scheduler =
|
|
|
+ (AbstractYarnScheduler) rm.getResourceScheduler();
|
|
|
+
|
|
|
+ // submit an app
|
|
|
+ RMApp app = rm.submitApp(GB, "test-move-1", "user_0", null, "a1");
|
|
|
+ ApplicationAttemptId appAttemptId =
|
|
|
+ rm.getApplicationReport(app.getApplicationId())
|
|
|
+ .getCurrentApplicationAttemptId();
|
|
|
+
|
|
|
+ // check preconditions
|
|
|
+ List<ApplicationAttemptId> appsInA1 = scheduler.getAppsInQueue("a1");
|
|
|
+ assertEquals(1, appsInA1.size());
|
|
|
+
|
|
|
+ List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
|
|
+ assertTrue(appsInA.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInA.size());
|
|
|
+ String queue =
|
|
|
+ scheduler.getApplicationAttempt(appsInA1.get(0)).getQueue()
|
|
|
+ .getQueueName();
|
|
|
+ Assert.assertTrue(queue.equals("a1"));
|
|
|
+
|
|
|
+ List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
|
|
+ assertTrue(appsInRoot.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInRoot.size());
|
|
|
+
|
|
|
+ // now kill the app
|
|
|
+ scheduler.killAllAppsInQueue("a1");
|
|
|
+
|
|
|
+ // check postconditions
|
|
|
+ rm.waitForState(app.getApplicationId(), RMAppState.KILLED);
|
|
|
+ appsInRoot = scheduler.getAppsInQueue("root");
|
|
|
+ assertTrue(appsInRoot.isEmpty());
|
|
|
+
|
|
|
+ appsInA1 = scheduler.getAppsInQueue("a1");
|
|
|
+ assertTrue(appsInA1.isEmpty());
|
|
|
+
|
|
|
+ appsInA = scheduler.getAppsInQueue("a");
|
|
|
+ assertTrue(appsInA.isEmpty());
|
|
|
+
|
|
|
+ rm.stop();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void testKillAllAppsInvalidSource() throws Exception {
|
|
|
+ MockRM rm = setUpMove();
|
|
|
+ AbstractYarnScheduler scheduler =
|
|
|
+ (AbstractYarnScheduler) rm.getResourceScheduler();
|
|
|
+
|
|
|
+ // submit an app
|
|
|
+ RMApp app = rm.submitApp(GB, "test-move-1", "user_0", null, "a1");
|
|
|
+ ApplicationAttemptId appAttemptId =
|
|
|
+ rm.getApplicationReport(app.getApplicationId())
|
|
|
+ .getCurrentApplicationAttemptId();
|
|
|
+
|
|
|
+ // check preconditions
|
|
|
+ List<ApplicationAttemptId> appsInA1 = scheduler.getAppsInQueue("a1");
|
|
|
+ assertEquals(1, appsInA1.size());
|
|
|
+
|
|
|
+ List<ApplicationAttemptId> appsInA = scheduler.getAppsInQueue("a");
|
|
|
+ assertTrue(appsInA.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInA.size());
|
|
|
+
|
|
|
+ List<ApplicationAttemptId> appsInRoot = scheduler.getAppsInQueue("root");
|
|
|
+ assertTrue(appsInRoot.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInRoot.size());
|
|
|
+
|
|
|
+ // now kill the app
|
|
|
+ try {
|
|
|
+ scheduler.killAllAppsInQueue("DOES_NOT_EXIST");
|
|
|
+ Assert.fail();
|
|
|
+ } catch (YarnException e) {
|
|
|
+ // expected
|
|
|
+ }
|
|
|
+
|
|
|
+ // check postconditions, app should still be in a1
|
|
|
+ appsInA1 = scheduler.getAppsInQueue("a1");
|
|
|
+ assertEquals(1, appsInA1.size());
|
|
|
+
|
|
|
+ appsInA = scheduler.getAppsInQueue("a");
|
|
|
+ assertTrue(appsInA.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInA.size());
|
|
|
+
|
|
|
+ appsInRoot = scheduler.getAppsInQueue("root");
|
|
|
+ assertTrue(appsInRoot.contains(appAttemptId));
|
|
|
+ assertEquals(1, appsInRoot.size());
|
|
|
+
|
|
|
+ rm.stop();
|
|
|
+ }
|
|
|
+
|
|
|
}
|