Repository: hadoop Updated Branches: refs/heads/branch-2 576cc258f -> 43fb79317
Revert "MAPREDUCE-6898. TestKill.testKillTask is flaky. Contributed by Peter Bacsko" This reverts commit 576cc258f9ac1bccb13c01f147b360c526188467. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/43fb7931 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/43fb7931 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/43fb7931 Branch: refs/heads/branch-2 Commit: 43fb7931745ada3bd710ef0a16faff2d28689680 Parents: 576cc25 Author: Jason Lowe <[email protected]> Authored: Fri Jun 16 14:49:26 2017 -0500 Committer: Jason Lowe <[email protected]> Committed: Fri Jun 16 14:49:26 2017 -0500 ---------------------------------------------------------------------- .../hadoop/mapreduce/v2/app/TestKill.java | 36 +++----------------- 1 file changed, 5 insertions(+), 31 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/43fb7931/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java index 176ac01..f681cf8 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/test/java/org/apache/hadoop/mapreduce/v2/app/TestKill.java @@ -21,15 +21,11 @@ package org.apache.hadoop.mapreduce.v2.app; import java.util.Iterator; import java.util.Map; import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; import org.apache.hadoop.service.Service; import org.junit.Assert; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; + import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.mapreduce.jobhistory.EventType; -import org.apache.hadoop.mapreduce.jobhistory.TaskStartedEvent; import org.apache.hadoop.mapreduce.v2.api.records.JobId; import org.apache.hadoop.mapreduce.v2.api.records.JobState; import org.apache.hadoop.mapreduce.v2.api.records.TaskAttemptId; @@ -104,34 +100,12 @@ public class TestKill { @Test public void testKillTask() throws Exception { final CountDownLatch latch = new CountDownLatch(1); - final CountDownLatch jobRunning = new CountDownLatch(1); - - final Dispatcher dispatcher = new AsyncDispatcher() { - protected void dispatch(Event event) { - // We have to wait until the internal state is RUNNING and not SETUP - // because it can cause a transition failure. If the dispatchable - // event is TASK_STARTED, we can continue because the job must be in - // RUNNING at that point. - if (event.getType() == EventType.TASK_STARTED) { - jobRunning.countDown(); - } - super.dispatch(event); - } - }; - - MRApp app = new BlockingMRApp(2, 0, latch) { - @Override - public Dispatcher createDispatcher() { - return dispatcher; - } - }; - + MRApp app = new BlockingMRApp(2, 0, latch); //this will start the job but job won't complete as Task is blocked Job job = app.submit(new Configuration()); - - // wait until the job transitions to JobInternalState.RUNNING - jobRunning.await(10, TimeUnit.SECONDS); - + + //wait and vailidate for Job to become RUNNING + app.waitForInternalState((JobImpl) job, JobStateInternal.RUNNING); Map<TaskId,Task> tasks = job.getTasks(); Assert.assertEquals("No of tasks is not correct", 2, tasks.size()); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
