本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse.getFailedRequests方法的典型用法代码示例。如果您正苦于以下问题:Java StopContainersResponse.getFailedRequests方法的具体用法?Java StopContainersResponse.getFailedRequests怎么用?Java StopContainersResponse.getFailedRequests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse
的用法示例。
在下文中一共展示了StopContainersResponse.getFailedRequests方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopContainer
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void stopContainer(YarnRPC rpc, Token nmToken,
List<ContainerId> containerId, ApplicationAttemptId appAttemptId,
NodeId nodeId) throws Exception {
StopContainersRequest request =
StopContainersRequest.newInstance(containerId);
ContainerManagementProtocol proxy = null;
try {
proxy =
getContainerManagementProtocolProxy(rpc, nmToken, nodeId,
appAttemptId.toString());
StopContainersResponse response = proxy.stopContainers(request);
if (response.getFailedRequests() != null &&
response.getFailedRequests().containsKey(containerId)) {
parseAndThrowException(response.getFailedRequests().get(containerId)
.deSerialize());
}
} catch (Exception e) {
if (proxy != null) {
rpc.stopProxy(proxy, conf);
}
}
}
示例2: stopContainerInternal
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void stopContainerInternal(ContainerId containerId, NodeId nodeId)
throws IOException, YarnException {
ContainerManagementProtocolProxyData proxy = null;
List<ContainerId> containerIds = new ArrayList<ContainerId>();
containerIds.add(containerId);
try {
proxy = cmProxy.getProxy(nodeId.toString(), containerId);
StopContainersResponse response =
proxy.getContainerManagementProtocol().stopContainers(
StopContainersRequest.newInstance(containerIds));
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(containerId)) {
Throwable t = response.getFailedRequests().get(containerId)
.deSerialize();
parseAndThrowException(t);
}
} finally {
if (proxy != null) {
cmProxy.mayBeCloseProxy(proxy);
}
}
}
示例3: cleanup
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void cleanup() throws IOException, YarnException {
connect();
ContainerId containerId = masterContainer.getId();
List<ContainerId> containerIds = new ArrayList<ContainerId>();
containerIds.add(containerId);
StopContainersRequest stopRequest =
StopContainersRequest.newInstance(containerIds);
StopContainersResponse response =
containerMgrProxy.stopContainers(stopRequest);
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(containerId)) {
Throwable t = response.getFailedRequests().get(containerId).deSerialize();
parseAndThrowException(t);
}
}
示例4: cleanup
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
private void cleanup() throws IOException, YarnException {
connect();
ContainerId containerId = masterContainer.getId();
List<ContainerId> containerIds = new ArrayList<ContainerId>();
containerIds.add(containerId);
StopContainersRequest stopRequest =
StopContainersRequest.newInstance(containerIds);
StopContainersResponse response =
containerMgrProxy.stopContainers(stopRequest);
// The application is cleaned-up when completes successfully or killed
// If the application failed more times than allowed, the cryptograhic
// material is cleaned by RMAppImpl#AttemptFailedTransition
if (conf.getBoolean(CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED,
CommonConfigurationKeysPublic.IPC_SERVER_SSL_ENABLED_DEFAULT)) {
// Remove the cryptographic material only if the application is
// finished or killed
RMApp app = rmContext.getRMApps().get(application.getAppAttemptId()
.getApplicationId());
if (appFinalStates.contains(app.getState())) {
String user = rmContext.getRMApps().get(containerId
.getApplicationAttemptId().getApplicationId()).getUser();
try {
rmContext.getCertificateLocalizationService().removeMaterial(user);
} catch (InterruptedException | ExecutionException e) {
throw new IOException(e);
}
}
}
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(containerId)) {
Throwable t = response.getFailedRequests().get(containerId).deSerialize();
parseAndThrowException(t);
}
}
示例5: kill
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void kill() {
if(this.state == ContainerState.PREP) {
this.state = ContainerState.KILLED_BEFORE_LAUNCH;
} else if (!isCompletelyDone()) {
LOG.info("KILLING " + taskAttemptID);
ContainerManagementProtocolProxyData proxy = null;
try {
proxy = getCMProxy(this.containerMgrAddress, this.containerID);
// kill the remote container if already launched
List<ContainerId> ids = new ArrayList<ContainerId>();
ids.add(this.containerID);
StopContainersRequest request = StopContainersRequest.newInstance(ids);
StopContainersResponse response =
proxy.getContainerManagementProtocol().stopContainers(request);
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(this.containerID)) {
throw response.getFailedRequests().get(this.containerID)
.deSerialize();
}
} catch (Throwable t) {
// ignore the cleanup failure
String message = "cleanup failed for container "
+ this.containerID + " : "
+ StringUtils.stringifyException(t);
context.getEventHandler()
.handle(
new TaskAttemptDiagnosticsUpdateEvent(this.taskAttemptID,
message));
LOG.warn(message);
} finally {
if (proxy != null) {
cmProxy.mayBeCloseProxy(proxy);
}
}
this.state = ContainerState.DONE;
}
// after killing, send killed event to task attempt
context.getEventHandler().handle(
new TaskAttemptEvent(this.taskAttemptID,
TaskAttemptEventType.TA_CONTAINER_CLEANED));
}
示例6: kill
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public synchronized void kill() {
if(this.state == ContainerState.PREP) {
LOG.info("final state for killed container"+"KILLED BEFORE LAUNCH");
this.state = ContainerState.KILLED_BEFORE_LAUNCH;
} else if (!isCompletelyDone()) {
LOG.info("KILLING " + taskAttemptID);
ContainerManagementProtocolProxyData proxy = null;
try {
proxy = getCMProxy(this.containerMgrAddress, this.containerID);
// kill the remote container if already launched
List<ContainerId> ids = new ArrayList<ContainerId>();
ids.add(this.containerID);
StopContainersRequest request = StopContainersRequest.newInstance(ids);
StopContainersResponse response =
proxy.getContainerManagementProtocol().stopContainers(request);
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(this.containerID)) {
throw response.getFailedRequests().get(this.containerID)
.deSerialize();
}
} catch (Throwable t) {
// ignore the cleanup failure
String message = "cleanup failed for container "
+ this.containerID + " : "
+ StringUtils.stringifyException(t);
context.getEventHandler()
.handle(
new TaskAttemptDiagnosticsUpdateEvent(this.taskAttemptID,
message));
LOG.warn(message);
} finally {
if (proxy != null) {
cmProxy.mayBeCloseProxy(proxy);
}
}
LOG.info("final state for killed container"+"DONE");
this.state = ContainerState.DONE;
}
// after killing, send killed event to task attempt
context.getEventHandler().handle(
new TaskAttemptEvent(this.taskAttemptID,
TaskAttemptEventType.TA_CONTAINER_CLEANED));
}