use of org.apache.tez.dag.app.TezTaskCommunicatorImpl in project tez by apache.
the class LocalContainerLauncher method launch.
// launch tasks
private void launch(ContainerLaunchRequest event) {
String tokenIdentifier = context.getApplicationID().toString();
try {
TezChild tezChild;
try {
int taskCommId = context.getTaskCommunicatorIdentifier(event.getTaskCommunicatorName());
Configuration conf = context.getAMConf();
if (isLocalMode) {
TezLocalCacheManager cacheManager = new TezLocalCacheManager(event.getContainerLaunchContext().getLocalResources(), conf);
cacheManagers.put(event.getContainerId(), cacheManager);
cacheManager.localize();
}
tezChild = createTezChild(conf, event.getContainerId(), tokenIdentifier, context.getApplicationAttemptId().getAttemptId(), context.getLocalDirs(), ((TezTaskCommunicatorImpl) tal.getTaskCommunicator(taskCommId).getTaskCommunicator()).getUmbilical(), TezCommonUtils.parseCredentialsBytes(event.getContainerLaunchContext().getTokens().array()));
} catch (InterruptedException e) {
handleLaunchFailed(e, event.getContainerId());
return;
} catch (TezException e) {
handleLaunchFailed(e, event.getContainerId());
return;
} catch (IOException e) {
handleLaunchFailed(e, event.getContainerId());
return;
}
ListenableFuture<TezChild.ContainerExecutionResult> runningTaskFuture = taskExecutorService.submit(createSubTask(tezChild, event.getContainerId()));
RunningTaskCallback callback = new RunningTaskCallback(event.getContainerId());
runningContainers.put(event.getContainerId(), runningTaskFuture);
Futures.addCallback(runningTaskFuture, callback, callbackExecutor);
if (deletionTracker != null) {
deletionTracker.addNodeShufflePort(event.getNodeId(), shufflePort);
}
} catch (RejectedExecutionException e) {
handleLaunchFailed(e, event.getContainerId());
}
}
use of org.apache.tez.dag.app.TezTaskCommunicatorImpl in project tez by apache.
the class TestTezTaskCommunicatorManager method testContainerAliveOnGetTask.
@Test(timeout = 5000)
public void testContainerAliveOnGetTask() throws IOException {
TaskCommunicatorContext context = mock(TaskCommunicatorContext.class);
Configuration conf = new Configuration(false);
UserPayload userPayload = TezUtils.createUserPayloadFromConf(conf);
ApplicationId appId = ApplicationId.newInstance(1000, 1);
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId, 1);
ContainerId containerId = createContainerId(appId, 1);
doReturn(appAttemptId).when(context).getApplicationAttemptId();
doReturn(userPayload).when(context).getInitialUserPayload();
doReturn(new Credentials()).when(context).getAMCredentials();
TezTaskCommunicatorImpl taskComm = new TezTaskCommunicatorImpl(context);
ContainerContext containerContext = new ContainerContext(containerId.toString());
taskComm.registerRunningContainer(containerId, "fakehost", 0);
ContainerTask containerTask = taskComm.getUmbilical().getTask(containerContext);
assertNull(containerTask);
verify(context).containerAlive(containerId);
}
Aggregations