|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
package org.apache.hadoop.mapreduce.v2.app.job.impl;
|
|
package org.apache.hadoop.mapreduce.v2.app.job.impl;
|
|
|
|
|
|
|
|
+import static org.apache.hadoop.test.GenericTestUtils.waitFor;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertEquals;
|
|
import static org.junit.Assert.assertFalse;
|
|
import static org.junit.Assert.assertFalse;
|
|
import static org.junit.Assert.assertTrue;
|
|
import static org.junit.Assert.assertTrue;
|
|
@@ -33,6 +34,7 @@ import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import com.google.common.base.Supplier;
|
|
import org.junit.Assert;
|
|
import org.junit.Assert;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.conf.Configuration;
|
|
import org.apache.hadoop.fs.FileStatus;
|
|
import org.apache.hadoop.fs.FileStatus;
|
|
@@ -380,7 +382,7 @@ public class TestTaskAttempt{
|
|
}
|
|
}
|
|
|
|
|
|
private void testTaskAttemptAssignedKilledHistory
|
|
private void testTaskAttemptAssignedKilledHistory
|
|
- (FailingAttemptsDuringAssignedMRApp app) throws Exception {
|
|
|
|
|
|
+ (final FailingAttemptsDuringAssignedMRApp app) throws Exception {
|
|
Configuration conf = new Configuration();
|
|
Configuration conf = new Configuration();
|
|
Job job = app.submit(conf);
|
|
Job job = app.submit(conf);
|
|
app.waitForState(job, JobState.RUNNING);
|
|
app.waitForState(job, JobState.RUNNING);
|
|
@@ -390,8 +392,18 @@ public class TestTaskAttempt{
|
|
Map<TaskAttemptId, TaskAttempt> attempts = task.getAttempts();
|
|
Map<TaskAttemptId, TaskAttempt> attempts = task.getAttempts();
|
|
TaskAttempt attempt = attempts.values().iterator().next();
|
|
TaskAttempt attempt = attempts.values().iterator().next();
|
|
app.waitForState(attempt, TaskAttemptState.KILLED);
|
|
app.waitForState(attempt, TaskAttemptState.KILLED);
|
|
- Assert.assertTrue("No Ta Started JH Event", app.getTaStartJHEvent());
|
|
|
|
- Assert.assertTrue("No Ta Killed JH Event", app.getTaKilledJHEvent());
|
|
|
|
|
|
+ waitFor(new Supplier<Boolean>() {
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean get() {
|
|
|
|
+ return app.getTaStartJHEvent();
|
|
|
|
+ }
|
|
|
|
+ }, 100, 800);
|
|
|
|
+ waitFor(new Supplier<Boolean>() {
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean get() {
|
|
|
|
+ return app.getTaKilledJHEvent();
|
|
|
|
+ }
|
|
|
|
+ }, 100, 800);
|
|
}
|
|
}
|
|
|
|
|
|
static class FailingAttemptsMRApp extends MRApp {
|
|
static class FailingAttemptsMRApp extends MRApp {
|