Search in sources :

Example 6 with AMContainerEventCompleted

use of org.apache.tez.dag.app.rm.container.AMContainerEventCompleted in project tez by apache.

the class TaskSchedulerManager method preemptContainer.

public void preemptContainer(int schedulerId, ContainerId containerId) {
    // TODO Why is this making a call back into the scheduler, when the call is originating from there.
    // An AMContainer instance should already exist if an attempt is being made to preempt it
    AMContainer amContainer = appContext.getAllContainers().get(containerId);
    try {
        taskSchedulers[amContainer.getTaskSchedulerIdentifier()].deallocateContainer(containerId);
    } catch (Exception e) {
        String msg = "Error in TaskScheduler when preempting container" + ", scheduler=" + Utils.getTaskSchedulerIdentifierString(amContainer.getTaskSchedulerIdentifier(), appContext) + ", containerId=" + containerId;
        LOG.error(msg, e);
        sendEvent(new DAGAppMasterEventUserServiceFatalError(DAGAppMasterEventType.TASK_SCHEDULER_SERVICE_FATAL_ERROR, msg, e));
    }
    // Inform the Containers about completion.
    sendEvent(new AMContainerEventCompleted(containerId, ContainerExitStatus.INVALID, "Container preempted internally", TaskAttemptTerminationCause.INTERNAL_PREEMPTION));
}
Also used : DAGAppMasterEventUserServiceFatalError(org.apache.tez.dag.app.dag.event.DAGAppMasterEventUserServiceFatalError) AMContainerEventCompleted(org.apache.tez.dag.app.rm.container.AMContainerEventCompleted) AMContainer(org.apache.tez.dag.app.rm.container.AMContainer) TezUncheckedException(org.apache.tez.dag.api.TezUncheckedException) TezException(org.apache.tez.dag.api.TezException)

Aggregations

AMContainer (org.apache.tez.dag.app.rm.container.AMContainer)6 AMContainerEventCompleted (org.apache.tez.dag.app.rm.container.AMContainerEventCompleted)6 Configuration (org.apache.hadoop.conf.Configuration)4 ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)4 Event (org.apache.hadoop.yarn.event.Event)4 TezConfiguration (org.apache.tez.dag.api.TezConfiguration)4 DagInfoImplForTest (org.apache.tez.dag.helpers.DagInfoImplForTest)4 Test (org.junit.Test)4 ContainerStatus (org.apache.hadoop.yarn.api.records.ContainerStatus)3 TaskAttemptImpl (org.apache.tez.dag.app.dag.impl.TaskAttemptImpl)3 TaskLocationHint (org.apache.tez.dag.api.TaskLocationHint)1 TezException (org.apache.tez.dag.api.TezException)1 TezUncheckedException (org.apache.tez.dag.api.TezUncheckedException)1 DAGAppMasterEventUserServiceFatalError (org.apache.tez.dag.app.dag.event.DAGAppMasterEventUserServiceFatalError)1 TaskAttemptTerminationCause (org.apache.tez.dag.records.TaskAttemptTerminationCause)1