YARN-1049. ContainerExistStatus should define a status for preempted containers. (tucu)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1521036 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b2af6c7024
commit
1cd7b067f7
|
@ -162,6 +162,9 @@ Release 2.1.1-beta - UNRELEASED
|
|||
YARN-1107. Fixed a bug in ResourceManager because of which RM in secure mode
|
||||
fails to restart. (Omkar Vinit Joshi via vinodkv)
|
||||
|
||||
YARN-1049. ContainerExistStatus should define a status for preempted
|
||||
containers. (tucu)
|
||||
|
||||
Release 2.1.0-beta - 2013-08-22
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -41,4 +41,9 @@ public class ContainerExitStatus {
|
|||
* threshold number of the nodemanager-log-directories become bad.
|
||||
*/
|
||||
public static final int DISKS_FAILED = -101;
|
||||
|
||||
/**
|
||||
* Containers preempted by the framework.
|
||||
*/
|
||||
public static final int PREEMPTED = -102;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,37 @@ public class SchedulerUtils {
|
|||
|
||||
public static final String UNRESERVED_CONTAINER =
|
||||
"Container reservation no longer required.";
|
||||
|
||||
|
||||
/**
|
||||
* Utility to create a {@link ContainerStatus} during exceptional
|
||||
* circumstances.
|
||||
*
|
||||
* @param containerId {@link ContainerId} of returned/released/lost container.
|
||||
* @param diagnostics diagnostic message
|
||||
* @return <code>ContainerStatus</code> for an returned/released/lost
|
||||
* container
|
||||
*/
|
||||
public static ContainerStatus createAbnormalContainerStatus(
|
||||
ContainerId containerId, String diagnostics) {
|
||||
return createAbnormalContainerStatus(containerId,
|
||||
ContainerExitStatus.ABORTED, diagnostics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to create a {@link ContainerStatus} during exceptional
|
||||
* circumstances.
|
||||
*
|
||||
* @param containerId {@link ContainerId} of returned/released/lost container.
|
||||
* @param diagnostics diagnostic message
|
||||
* @return <code>ContainerStatus</code> for an returned/released/lost
|
||||
* container
|
||||
*/
|
||||
public static ContainerStatus createPreemptedContainerStatus(
|
||||
ContainerId containerId, String diagnostics) {
|
||||
return createAbnormalContainerStatus(containerId,
|
||||
ContainerExitStatus.PREEMPTED, diagnostics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility to create a {@link ContainerStatus} during exceptional
|
||||
* circumstances.
|
||||
|
@ -73,14 +103,13 @@ public class SchedulerUtils {
|
|||
* @return <code>ContainerStatus</code> for an returned/released/lost
|
||||
* container
|
||||
*/
|
||||
public static ContainerStatus createAbnormalContainerStatus(
|
||||
ContainerId containerId, String diagnostics) {
|
||||
private static ContainerStatus createAbnormalContainerStatus(
|
||||
ContainerId containerId, int exitStatus, String diagnostics) {
|
||||
ContainerStatus containerStatus =
|
||||
recordFactory.newRecordInstance(ContainerStatus.class);
|
||||
containerStatus.setContainerId(containerId);
|
||||
containerStatus.setDiagnostics(diagnostics);
|
||||
containerStatus.setExitStatus(
|
||||
ContainerExitStatus.ABORTED);
|
||||
containerStatus.setExitStatus(exitStatus);
|
||||
containerStatus.setState(ContainerState.COMPLETE);
|
||||
return containerStatus;
|
||||
}
|
||||
|
|
|
@ -904,7 +904,7 @@ public class CapacityScheduler
|
|||
LOG.debug("KILL_CONTAINER: container" + cont.toString());
|
||||
}
|
||||
completedContainer(cont,
|
||||
SchedulerUtils.createAbnormalContainerStatus(
|
||||
SchedulerUtils.createPreemptedContainerStatus(
|
||||
cont.getContainerId(),"Container being forcibly preempted:"
|
||||
+ cont.getContainerId()),
|
||||
RMContainerEventType.KILL);
|
||||
|
|
|
@ -444,7 +444,7 @@ public class FairScheduler implements ResourceScheduler {
|
|||
// proceed with kill
|
||||
if (time + waitTimeBeforeKill < clock.getTime()) {
|
||||
ContainerStatus status =
|
||||
SchedulerUtils.createAbnormalContainerStatus(
|
||||
SchedulerUtils.createPreemptedContainerStatus(
|
||||
container.getContainerId(), SchedulerUtils.PREEMPTED_CONTAINER);
|
||||
|
||||
// TODO: Not sure if this ever actually adds this to the list of cleanup
|
||||
|
|
|
@ -41,6 +41,10 @@ import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerExitStatus;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
||||
import org.apache.hadoop.yarn.api.records.Priority;
|
||||
import org.apache.hadoop.yarn.api.records.Resource;
|
||||
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
|
||||
|
@ -358,4 +362,20 @@ public class TestSchedulerUtils {
|
|||
Priority low = Priority.newInstance(2);
|
||||
assertTrue(high.compareTo(low) > 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAbnormalContainerStatus() {
|
||||
ContainerStatus cd = SchedulerUtils.createAbnormalContainerStatus(
|
||||
ContainerId.newInstance(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(System.currentTimeMillis(), 1), 1), 1), "x");
|
||||
Assert.assertEquals(ContainerExitStatus.ABORTED, cd.getExitStatus());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreatePreemptedContainerStatus() {
|
||||
ContainerStatus cd = SchedulerUtils.createPreemptedContainerStatus(
|
||||
ContainerId.newInstance(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(System.currentTimeMillis(), 1), 1), 1), "x");
|
||||
Assert.assertEquals(ContainerExitStatus.PREEMPTED, cd.getExitStatus());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue