Search in sources :

Example 1 with AMContainerEventLaunchRequest

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

the class TaskSchedulerManager method taskAllocated.

// TaskSchedulerAppCallback methods with schedulerId, where relevant
public synchronized void taskAllocated(int schedulerId, Object task, Object appCookie, Container container) {
    AMSchedulerEventTALaunchRequest event = (AMSchedulerEventTALaunchRequest) appCookie;
    ContainerId containerId = container.getId();
    if (appContext.getAllContainers().addContainerIfNew(container, schedulerId, event.getLauncherId(), event.getTaskCommId())) {
        appContext.getNodeTracker().nodeSeen(container.getNodeId(), schedulerId);
        sendEvent(new AMNodeEventContainerAllocated(container.getNodeId(), schedulerId, container.getId()));
    }
    TaskAttempt taskAttempt = event.getTaskAttempt();
    // taskAllocated() upcall
    assert task.equals(taskAttempt);
    if (appContext.getAllContainers().get(containerId).getState() == AMContainerState.ALLOCATED) {
        sendEvent(new AMContainerEventLaunchRequest(containerId, taskAttempt.getVertexID(), event.getContainerContext(), event.getLauncherId(), event.getTaskCommId()));
    }
    sendEvent(new AMContainerEventAssignTA(containerId, taskAttempt.getID(), event.getRemoteTaskSpec(), event.getContainerContext().getLocalResources(), event.getContainerContext().getCredentials(), event.getPriority()));
}
Also used : AMNodeEventContainerAllocated(org.apache.tez.dag.app.rm.node.AMNodeEventContainerAllocated) AMContainerEventAssignTA(org.apache.tez.dag.app.rm.container.AMContainerEventAssignTA) ContainerId(org.apache.hadoop.yarn.api.records.ContainerId) TaskAttempt(org.apache.tez.dag.app.dag.TaskAttempt) AMContainerEventLaunchRequest(org.apache.tez.dag.app.rm.container.AMContainerEventLaunchRequest)

Aggregations

ContainerId (org.apache.hadoop.yarn.api.records.ContainerId)1 TaskAttempt (org.apache.tez.dag.app.dag.TaskAttempt)1 AMContainerEventAssignTA (org.apache.tez.dag.app.rm.container.AMContainerEventAssignTA)1 AMContainerEventLaunchRequest (org.apache.tez.dag.app.rm.container.AMContainerEventLaunchRequest)1 AMNodeEventContainerAllocated (org.apache.tez.dag.app.rm.node.AMNodeEventContainerAllocated)1