From a92ef030a2707182e90acee644e47c8ef7e1fd8d Mon Sep 17 00:00:00 2001 From: Yufei Gu Date: Thu, 21 Sep 2017 12:31:07 -0700 Subject: [PATCH] YARN-7045. Remove FSLeafQueue#addAppSchedulable. (Contributed by Sen Zhao via Yufei Gu) --- .../resourcemanager/scheduler/fair/FSLeafQueue.java | 10 ---------- .../scheduler/fair/TestFSLeafQueue.java | 6 +++--- .../scheduler/fair/TestFairScheduler.java | 6 +++--- 3 files changed, 6 insertions(+), 16 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java index 1dcfffcd1d..89ad1e6964 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/FSLeafQueue.java @@ -94,16 +94,6 @@ void addApp(FSAppAttempt app, boolean runnable) { } } - // for testing - void addAppSchedulable(FSAppAttempt appSched) { - writeLock.lock(); - try { - runnableApps.add(appSched); - } finally { - writeLock.unlock(); - } - } - /** * Removes the given app from this queue. * @return whether or not the app was runnable diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFSLeafQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFSLeafQueue.java index 2aed9bfdbf..b6b3f7ec6c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFSLeafQueue.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFSLeafQueue.java @@ -89,8 +89,8 @@ public void testUpdateDemand() { FSAppAttempt app = mock(FSAppAttempt.class); Mockito.when(app.getDemand()).thenReturn(maxResource); - schedulable.addAppSchedulable(app); - schedulable.addAppSchedulable(app); + schedulable.addApp(app, true); + schedulable.addApp(app, true); schedulable.updateDemand(); @@ -165,7 +165,7 @@ public void testConcurrentAccess() { @Override public void run() { for (int i=0; i < 500; i++) { - schedulable.addAppSchedulable(app); + schedulable.addApp(app, true); } } }); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java index 0ef4d7ba5e..d5b1fcca27 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/fair/TestFairScheduler.java @@ -5221,12 +5221,12 @@ public void testUpdateDemand() throws IOException { FSLeafQueue aQueue = new FSLeafQueue("root.queue1.a", scheduler, queue1); aQueue.setMaxShare(maxResource); - aQueue.addAppSchedulable(app1); + aQueue.addApp(app1, true); FSLeafQueue bQueue = new FSLeafQueue("root.queue1.b", scheduler, queue1); bQueue.setMaxShare(maxResource); - bQueue.addAppSchedulable(app2); + bQueue.addApp(app2, true); queue1.setMaxShare(maxResource); queue1.addChildQueue(aQueue); @@ -5270,7 +5270,7 @@ public void testDumpState() throws IOException { FSAppAttempt app = mock(FSAppAttempt.class); Mockito.when(app.getDemand()).thenReturn(resource); Mockito.when(app.getResourceUsage()).thenReturn(resource); - child1.addAppSchedulable(app); + child1.addApp(app, true); child1.updateDemand(); String childQueueString = "{Name: root.parent.child1,"