use of org.apache.hadoop.yarn.exceptions.YarnRemoteException in project weave by continuuity.
the class Hadoop20YarnNMClient method start.
@Override
public Cancellable start(YarnContainerInfo containerInfo, YarnLaunchContext launchContext) {
ContainerLaunchContext context = launchContext.getLaunchContext();
context.setUser(System.getProperty("user.name"));
Container container = containerInfo.getContainer();
context.setContainerId(container.getId());
context.setResource(container.getResource());
StartContainerRequest startRequest = Records.newRecord(StartContainerRequest.class);
startRequest.setContainerLaunchContext(context);
ContainerManager manager = connectContainerManager(container);
try {
manager.startContainer(startRequest);
return new ContainerTerminator(container, manager);
} catch (YarnRemoteException e) {
LOG.error("Error in launching process", e);
throw Throwables.propagate(e);
}
}
use of org.apache.hadoop.yarn.exceptions.YarnRemoteException in project weave by continuuity.
the class Hadoop20YarnAppClient method createLauncher.
@Override
public ProcessLauncher<ApplicationId> createLauncher(WeaveSpecification weaveSpec) throws Exception {
// Request for new application
final GetNewApplicationResponse response = yarnClient.getNewApplication();
final ApplicationId appId = response.getApplicationId();
// Setup the context for application submission
final ApplicationSubmissionContext appSubmissionContext = Records.newRecord(ApplicationSubmissionContext.class);
appSubmissionContext.setApplicationId(appId);
appSubmissionContext.setApplicationName(weaveSpec.getName());
appSubmissionContext.setUser(user);
ApplicationSubmitter submitter = new ApplicationSubmitter() {
@Override
public ProcessController<YarnApplicationReport> submit(YarnLaunchContext launchContext, Resource capability) {
ContainerLaunchContext context = launchContext.getLaunchContext();
addRMToken(context);
context.setUser(appSubmissionContext.getUser());
context.setResource(adjustMemory(response, capability));
appSubmissionContext.setAMContainerSpec(context);
try {
yarnClient.submitApplication(appSubmissionContext);
return new ProcessControllerImpl(yarnClient, appId);
} catch (YarnRemoteException e) {
LOG.error("Failed to submit application {}", appId, e);
throw Throwables.propagate(e);
}
}
};
return new ApplicationMasterProcessLauncher(appId, submitter);
}
Aggregations