本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest类的典型用法代码示例。如果您正苦于以下问题:Java StopContainersRequest类的具体用法?Java StopContainersRequest怎么用?Java StopContainersRequest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StopContainersRequest类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了StopContainersRequest类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stopContainer
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的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: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
/**
* Stop a list of containers running on this NodeManager.
*/
@Override
public StopContainersResponse stopContainers(StopContainersRequest requests)
throws YarnException, IOException {
List<ContainerId> succeededRequests = new ArrayList<ContainerId>();
Map<ContainerId, SerializedException> failedRequests =
new HashMap<ContainerId, SerializedException>();
UserGroupInformation remoteUgi = getRemoteUgi();
NMTokenIdentifier identifier = selectNMTokenIdentifier(remoteUgi);
for (ContainerId id : requests.getContainerIds()) {
try {
stopContainerInternal(identifier, id);
succeededRequests.add(id);
} catch (YarnException e) {
failedRequests.put(id, SerializedException.newInstance(e));
}
}
return StopContainersResponse
.newInstance(succeededRequests, failedRequests);
}
示例3: finishTask
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
public synchronized void finishTask(Task task) throws IOException,
YarnException {
Set<Task> tasks = this.tasks.get(task.getPriority());
if (!tasks.remove(task)) {
throw new IllegalStateException(
"Finishing unknown task " + task.getTaskId() +
" from application " + applicationId);
}
NodeManager nodeManager = task.getNodeManager();
ContainerId containerId = task.getContainerId();
task.stop();
List<ContainerId> containerIds = new ArrayList<ContainerId>();
containerIds.add(containerId);
StopContainersRequest stopRequest =
StopContainersRequest.newInstance(containerIds);
nodeManager.stopContainers(stopRequest);
Resources.subtractFrom(used, requestSpec.get(task.getPriority()));
LOG.info("Finished task " + task.getTaskId() +
" of application " + applicationId +
" on node " + nodeManager.getHostName() +
", currently using " + used + " resources");
}
示例4: stopContainerInternal
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的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);
}
}
}
示例5: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
/**
* Stop a list of containers running on this NodeManager.
*/
@Override
public StopContainersResponse stopContainers(StopContainersRequest requests)
throws YarnException, IOException {
List<ContainerId> succeededRequests = new ArrayList<ContainerId>();
Map<ContainerId, SerializedException> failedRequests =
new HashMap<ContainerId, SerializedException>();
UserGroupInformation remoteUgi = getRemoteUgi();
NMTokenIdentifier identifier = selectNMTokenIdentifier(remoteUgi);
if (identifier == null) {
throw RPCUtil.getRemoteException(INVALID_NMTOKEN_MSG);
}
for (ContainerId id : requests.getContainerIds()) {
try {
stopContainerInternal(identifier, id);
succeededRequests.add(id);
} catch (YarnException e) {
failedRequests.put(id, SerializedException.newInstance(e));
}
}
return StopContainersResponse
.newInstance(succeededRequests, failedRequests);
}
示例6: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
@Override
public StopContainersResponse stopContainers(StopContainersRequest requests)
throws YarnException, IOException {
StopContainersRequestProto requestProto =
((StopContainersRequestPBImpl) requests).getProto();
try {
return new StopContainersResponsePBImpl(proxy.stopContainers(null,
requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
示例7: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
@Override
public StopContainersResponse stopContainers(StopContainersRequest request)
throws YarnException {
Exception e = new Exception(EXCEPTION_MSG,
new Exception(EXCEPTION_CAUSE));
throw new YarnException(e);
}
示例8: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
@Override
public StopContainersResponse
stopContainers(StopContainersRequest requests) throws YarnException,
IOException {
Exception e = new Exception("Dummy function", new Exception(
"Dummy function cause"));
throw new YarnException(e);
}
示例9: cleanup
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的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);
}
}
示例10: stopContainers
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest; //导入依赖的package包/类
@Override
public StopContainersResponse stopContainers(StopContainersRequest request)
throws YarnException {
LOG.info("Container cleaned up by MyContainerManager");
cleanedup = true;
return null;
}