YARN-2359. Application hangs when it fails to launch AM container. (Zhihai Xu via kasha)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1616376 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5c7571fa3f
commit
290d4e3ec8
|
@ -119,6 +119,9 @@ Release 2.6.0 - UNRELEASED
|
||||||
YARN-2374. Fixed TestDistributedShell#testDSShell failure due to hostname
|
YARN-2374. Fixed TestDistributedShell#testDSShell failure due to hostname
|
||||||
dismatch. (Varun Vasudev via jianhe)
|
dismatch. (Varun Vasudev via jianhe)
|
||||||
|
|
||||||
|
YARN-2359. Application hangs when it fails to launch AM container.
|
||||||
|
(Zhihai Xu via kasha)
|
||||||
|
|
||||||
Release 2.5.0 - UNRELEASED
|
Release 2.5.0 - UNRELEASED
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -217,7 +217,13 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable {
|
||||||
RMAppAttemptEventType.KILL,
|
RMAppAttemptEventType.KILL,
|
||||||
new FinalSavingTransition(new BaseFinalTransition(
|
new FinalSavingTransition(new BaseFinalTransition(
|
||||||
RMAppAttemptState.KILLED), RMAppAttemptState.KILLED))
|
RMAppAttemptState.KILLED), RMAppAttemptState.KILLED))
|
||||||
|
.addTransition(RMAppAttemptState.SCHEDULED,
|
||||||
|
RMAppAttemptState.FINAL_SAVING,
|
||||||
|
RMAppAttemptEventType.CONTAINER_FINISHED,
|
||||||
|
new FinalSavingTransition(
|
||||||
|
new AMContainerCrashedBeforeRunningTransition(),
|
||||||
|
RMAppAttemptState.FAILED))
|
||||||
|
|
||||||
// Transitions from ALLOCATED_SAVING State
|
// Transitions from ALLOCATED_SAVING State
|
||||||
.addTransition(RMAppAttemptState.ALLOCATED_SAVING,
|
.addTransition(RMAppAttemptState.ALLOCATED_SAVING,
|
||||||
RMAppAttemptState.ALLOCATED,
|
RMAppAttemptState.ALLOCATED,
|
||||||
|
|
|
@ -89,6 +89,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.ContainerAlloca
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl;
|
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainerImpl;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
|
||||||
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerUtils;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptAddedSchedulerEvent;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.AppAttemptAddedSchedulerEvent;
|
||||||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.event.SchedulerEvent;
|
||||||
|
@ -782,6 +783,32 @@ public class TestRMAppAttemptTransitions {
|
||||||
testAppAttemptKilledState(null, EMPTY_DIAGNOSTICS);
|
testAppAttemptKilledState(null, EMPTY_DIAGNOSTICS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAMCrashAtScheduled() {
|
||||||
|
// This is to test sending CONTAINER_FINISHED event at SCHEDULED state.
|
||||||
|
// Verify the state transition is correct.
|
||||||
|
scheduleApplicationAttempt();
|
||||||
|
ContainerStatus cs =
|
||||||
|
SchedulerUtils.createAbnormalContainerStatus(
|
||||||
|
BuilderUtils.newContainerId(
|
||||||
|
applicationAttempt.getAppAttemptId(), 1),
|
||||||
|
SchedulerUtils.LOST_CONTAINER);
|
||||||
|
// send CONTAINER_FINISHED event at SCHEDULED state,
|
||||||
|
// The state should be FINAL_SAVING with previous state SCHEDULED
|
||||||
|
applicationAttempt.handle(new RMAppAttemptContainerFinishedEvent(
|
||||||
|
applicationAttempt.getAppAttemptId(), cs));
|
||||||
|
// createApplicationAttemptState will return previous state (SCHEDULED),
|
||||||
|
// if the current state is FINAL_SAVING.
|
||||||
|
assertEquals(YarnApplicationAttemptState.SCHEDULED,
|
||||||
|
applicationAttempt.createApplicationAttemptState());
|
||||||
|
// send ATTEMPT_UPDATE_SAVED event,
|
||||||
|
// verify the state is changed to state FAILED.
|
||||||
|
sendAttemptUpdateSavedEvent(applicationAttempt);
|
||||||
|
assertEquals(RMAppAttemptState.FAILED,
|
||||||
|
applicationAttempt.getAppAttemptState());
|
||||||
|
verifyApplicationAttemptFinished(RMAppAttemptState.FAILED);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testAllocatedToKilled() {
|
public void testAllocatedToKilled() {
|
||||||
Container amContainer = allocateApplicationAttempt();
|
Container amContainer = allocateApplicationAttempt();
|
||||||
|
|
Loading…
Reference in New Issue