Search in sources :

Example 6 with TaskTAttemptKilledEvent

use of org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptKilledEvent in project hadoop by apache.

the class TestTaskImpl method testKillAttemptForSuccessfulTask.

@Test
public /**
   * Kill map attempt for succeeded map task
   * {@link TaskState#SUCCEEDED}->{@link TaskState#SCHEDULED}
   */
void testKillAttemptForSuccessfulTask() {
    LOG.info("--- START: testKillAttemptForSuccessfulTask ---");
    mockTask = createMockTask(TaskType.MAP);
    TaskId taskId = getNewTaskID();
    scheduleTaskAttempt(taskId);
    launchTaskAttempt(getLastAttempt().getAttemptId());
    commitTaskAttempt(getLastAttempt().getAttemptId());
    mockTask.handle(new TaskTAttemptEvent(getLastAttempt().getAttemptId(), TaskEventType.T_ATTEMPT_SUCCEEDED));
    assertTaskSucceededState();
    mockTask.handle(new TaskTAttemptKilledEvent(getLastAttempt().getAttemptId(), true));
    assertEquals(TaskAttemptEventType.TA_RESCHEDULE, taskAttemptEventHandler.lastTaskAttemptEvent.getType());
    assertTaskScheduledState();
}
Also used : TaskTAttemptKilledEvent(org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptKilledEvent) TaskId(org.apache.hadoop.mapreduce.v2.api.records.TaskId) TaskTAttemptEvent(org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptEvent) Test(org.junit.Test)

Aggregations

TaskTAttemptKilledEvent (org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptKilledEvent)4 TaskId (org.apache.hadoop.mapreduce.v2.api.records.TaskId)3 TaskEvent (org.apache.hadoop.mapreduce.v2.app.job.event.TaskEvent)3 Test (org.junit.Test)3 MapTaskAttemptImpl (org.apache.hadoop.mapred.MapTaskAttemptImpl)2 TaskAttemptEvent (org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptEvent)2 TaskAttemptKillEvent (org.apache.hadoop.mapreduce.v2.app.job.event.TaskAttemptKillEvent)2 TaskTAttemptEvent (org.apache.hadoop.mapreduce.v2.app.job.event.TaskTAttemptEvent)2 Path (org.apache.hadoop.fs.Path)1 JobConf (org.apache.hadoop.mapred.JobConf)1 TaskSplitMetaInfo (org.apache.hadoop.mapreduce.split.JobSplit.TaskSplitMetaInfo)1 JobId (org.apache.hadoop.mapreduce.v2.api.records.JobId)1 AppContext (org.apache.hadoop.mapreduce.v2.app.AppContext)1 TaskAttemptListener (org.apache.hadoop.mapreduce.v2.app.TaskAttemptListener)1 Credentials (org.apache.hadoop.security.Credentials)1 Token (org.apache.hadoop.security.token.Token)1 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)1