You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by hi...@apache.org on 2014/03/20 00:35:49 UTC

git commit: TEZ-958. Increase sleeps in TestContainerReuse to fix flaky tests. (hitesh)

Repository: incubator-tez
Updated Branches:
  refs/heads/master 5a24e979a -> 90a056d64


TEZ-958. Increase sleeps in TestContainerReuse to fix flaky tests. (hitesh)


Project: http://git-wip-us.apache.org/repos/asf/incubator-tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tez/commit/90a056d6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tez/tree/90a056d6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tez/diff/90a056d6

Branch: refs/heads/master
Commit: 90a056d64da6aaa5db4688448edc3975de3db0a8
Parents: 5a24e97
Author: Hitesh Shah <hi...@apache.org>
Authored: Wed Mar 19 16:35:27 2014 -0700
Committer: Hitesh Shah <hi...@apache.org>
Committed: Wed Mar 19 16:35:27 2014 -0700

----------------------------------------------------------------------
 .../tez/dag/app/rm/TestContainerReuse.java      | 24 ++++++++++++--------
 .../tez/dag/app/rm/node/TestAMNodeMap.java      |  3 +++
 2 files changed, 18 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/90a056d6/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
index 4c8ef1d..238d92a 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/TestContainerReuse.java
@@ -36,6 +36,8 @@ import java.util.Map;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
@@ -92,7 +94,8 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
 public class TestContainerReuse {
-  
+  private static final Log LOG = LogFactory.getLog(TestContainerReuse.class);
+
   @Test(timeout = 15000l)
   public void testDelayedReuseContainerBecomesAvailable()
       throws IOException, InterruptedException, ExecutionException {
@@ -478,7 +481,7 @@ public class TestContainerReuse {
     taskSchedulerEventHandler.close();
   }
 
-  @Test(timeout = 15000l)
+  @Test(timeout = 30000l)
   public void testReuseNonLocalRequest()
       throws IOException, InterruptedException, ExecutionException {
     Configuration tezConf = new Configuration(new YarnConfiguration());
@@ -585,7 +588,8 @@ public class TestContainerReuse {
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);
     eventHandler.reset();
 
-    Thread.sleep(1000l);
+    LOG.info("Sleeping to ensure that the scheduling loop runs");
+    Thread.sleep(6000l);
     verify(taskSchedulerEventHandler).taskAllocated(
       eq(ta12), any(Object.class), eq(container1));
 
@@ -601,7 +605,7 @@ public class TestContainerReuse {
     taskSchedulerEventHandler.close();
   }
 
-  @Test(timeout = 15000l)
+  @Test(timeout = 30000l)
   public void testReuseAcrossVertices()
       throws IOException, InterruptedException, ExecutionException {
     Configuration tezConf = new Configuration(new YarnConfiguration());
@@ -609,7 +613,7 @@ public class TestContainerReuse {
     tezConf.setLong(
       TezConfiguration.TEZ_AM_CONTAINER_REUSE_LOCALITY_DELAY_ALLOCATION_MILLIS, 1l);
     tezConf.setLong(
-      TezConfiguration.TEZ_AM_CONTAINER_SESSION_DELAY_ALLOCATION_MILLIS, 3000l);
+      TezConfiguration.TEZ_AM_CONTAINER_SESSION_DELAY_ALLOCATION_MILLIS, 2000l);
     RackResolver.init(tezConf);
     TaskSchedulerAppCallback mockApp = mock(TaskSchedulerAppCallback.class);
 
@@ -715,8 +719,8 @@ public class TestContainerReuse {
         TaskAttemptState.SUCCEEDED));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
 
-    Thread.sleep(5000l);
-
+    LOG.info("Sleeping to ensure that the scheduling loop runs");
+    Thread.sleep(6000l);
     verify(rmClient).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyInvocation(AMContainerEventStopRequest.class);
 
@@ -724,11 +728,12 @@ public class TestContainerReuse {
     taskSchedulerEventHandler.close();
   }
   
-  @Test(timeout = 10000l)
+  @Test(timeout = 30000l)
   public void testReuseLocalResourcesChanged() throws IOException, InterruptedException, ExecutionException {
     Configuration tezConf = new Configuration(new YarnConfiguration());
     tezConf.setBoolean(TezConfiguration.TEZ_AM_CONTAINER_REUSE_ENABLED, true);
     tezConf.setBoolean(TezConfiguration.TEZ_AM_CONTAINER_REUSE_RACK_FALLBACK_ENABLED, true);
+    tezConf.setBoolean(TezConfiguration.TEZ_AM_CONTAINER_REUSE_NON_LOCAL_FALLBACK_ENABLED, true);
     tezConf.setLong(TezConfiguration.TEZ_AM_CONTAINER_REUSE_LOCALITY_DELAY_ALLOCATION_MILLIS, 0);
     tezConf.setLong(TezConfiguration.TEZ_AM_CONTAINER_SESSION_DELAY_ALLOCATION_MILLIS, -1);
     RackResolver.init(tezConf);
@@ -858,7 +863,8 @@ public class TestContainerReuse {
     drainableAppCallback.drain();
 
     // TODO This is terrible, need a better way to ensure the scheduling loop has run
-    Thread.sleep(3000l);
+    LOG.info("Sleeping to ensure that the scheduling loop runs");
+    Thread.sleep(6000l);
     verify(taskSchedulerEventHandler).taskAllocated(eq(ta211), any(Object.class), eq(container1));
     verify(rmClient, times(0)).releaseAssignedContainer(eq(container1.getId()));
     eventHandler.verifyNoInvocations(AMContainerEventStopRequest.class);

http://git-wip-us.apache.org/repos/asf/incubator-tez/blob/90a056d6/tez-dag/src/test/java/org/apache/tez/dag/app/rm/node/TestAMNodeMap.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/node/TestAMNodeMap.java b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/node/TestAMNodeMap.java
index b9d9140..374f20d 100644
--- a/tez-dag/src/test/java/org/apache/tez/dag/app/rm/node/TestAMNodeMap.java
+++ b/tez-dag/src/test/java/org/apache/tez/dag/app/rm/node/TestAMNodeMap.java
@@ -38,6 +38,7 @@ import org.apache.tez.dag.app.rm.AMSchedulerEventNodeBlacklistUpdate;
 import org.apache.tez.dag.app.rm.AMSchedulerEventType;
 import org.apache.tez.dag.app.rm.container.AMContainerEventNodeFailed;
 import org.apache.tez.dag.app.rm.container.AMContainerEventType;
+import org.apache.tez.dag.app.rm.container.AMContainerMap;
 import org.apache.tez.dag.records.TezTaskAttemptID;
 import org.junit.After;
 import org.junit.Before;
@@ -118,7 +119,9 @@ public class TestAMNodeMap {
     conf.setInt(TezConfiguration.TEZ_AM_MAX_TASK_FAILURES_PER_NODE, 2);
     TestEventHandler handler = new TestEventHandler();
     AMNodeMap amNodeMap = new AMNodeMap(handler, appContext);
+    AMContainerMap amContainerMap = mock(AMContainerMap.class);
     dispatcher.register(AMNodeEventType.class, amNodeMap);
+    dispatcher.register(AMContainerEventType.class, amContainerMap);
     amNodeMap.init(conf);
     amNodeMap.start();