use of org.apache.tez.runtime.task.TezChild 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.runtime.task.TezChild in project tez by apache.
the class LocalContainerLauncher method createTezChild.
private TezChild createTezChild(Configuration defaultConf, ContainerId containerId, String tokenIdentifier, int attemptNumber, String[] localDirs, TezTaskUmbilicalProtocol tezTaskUmbilicalProtocol, Credentials credentials) throws InterruptedException, TezException, IOException {
Map<String, String> containerEnv = new HashMap<String, String>();
containerEnv.putAll(localEnv);
// Use the user from env if it's available.
String user = isLocalMode ? System.getenv(Environment.USER.name()) : context.getUser();
containerEnv.put(Environment.USER.name(), user);
long memAvailable;
synchronized (this) {
// needed to fix findbugs Inconsistent synchronization warning
memAvailable = Runtime.getRuntime().maxMemory() / numExecutors;
}
TezChild tezChild = TezChild.newTezChild(defaultConf, null, 0, containerId.toString(), tokenIdentifier, attemptNumber, localDirs, workingDirectory, containerEnv, "", executionContext, credentials, memAvailable, context.getUser(), tezTaskUmbilicalProtocol, false, context.getHadoopShim());
return tezChild;
}
Aggregations