From 66bba8c0244e5b17d496e2fa3999991705c11bc7 Mon Sep 17 00:00:00 2001 From: Yufei Gu Date: Fri, 19 May 2017 14:53:27 -0700 Subject: [PATCH] YARN-6249. TestFairSchedulerPreemption fails inconsistently. (Tao Jie via Yufei Gu) --- .../scheduler/fair/TestFairSchedulerPreemption.java | 4 ++++ 1 file changed, 4 insertions(+) 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/TestFairSchedulerPreemption.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/TestFairSchedulerPreemption.java index 59d243bc69..31630240e2 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/TestFairSchedulerPreemption.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/TestFairSchedulerPreemption.java @@ -24,6 +24,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl; import org.apache.hadoop.yarn.util.ControlledClock; +import org.apache.hadoop.yarn.util.SystemClock; import org.junit.After; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -188,6 +189,9 @@ private void writeResourceParams(PrintWriter out) { private void setupCluster() throws IOException { resourceManager = new MockRM(conf); scheduler = (FairScheduler) resourceManager.getResourceScheduler(); + // YARN-6249, FSLeafQueue#lastTimeAtMinShare is initialized to the time in + // the real world, so we should keep the clock up with it. + clock.setTime(SystemClock.getInstance().getTime()); scheduler.setClock(clock); resourceManager.start();