本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest类的典型用法代码示例。如果您正苦于以下问题:Java GetContainerStatusesRequest类的具体用法?Java GetContainerStatusesRequest怎么用?Java GetContainerStatusesRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GetContainerStatusesRequest类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了GetContainerStatusesRequest类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getContainerStatuses
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
/**
* Get a list of container statuses running on this NodeManager
*/
@Override
public GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request) throws YarnException, IOException {
List<ContainerStatus> succeededRequests = new ArrayList<ContainerStatus>();
Map<ContainerId, SerializedException> failedRequests =
new HashMap<ContainerId, SerializedException>();
UserGroupInformation remoteUgi = getRemoteUgi();
NMTokenIdentifier identifier = selectNMTokenIdentifier(remoteUgi);
for (ContainerId id : request.getContainerIds()) {
try {
ContainerStatus status = getContainerStatusInternal(id, identifier);
succeededRequests.add(status);
} catch (YarnException e) {
failedRequests.put(id, SerializedException.newInstance(e));
}
}
return GetContainerStatusesResponse.newInstance(succeededRequests,
failedRequests);
}
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:ContainerManagerImpl.java
示例2: waitForContainerState
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
public static void waitForContainerState(ContainerManagementProtocol containerManager,
ContainerId containerID, ContainerState finalState, int timeOutMax)
throws InterruptedException, YarnException, IOException {
List<ContainerId> list = new ArrayList<ContainerId>();
list.add(containerID);
GetContainerStatusesRequest request =
GetContainerStatusesRequest.newInstance(list);
ContainerStatus containerStatus =
containerManager.getContainerStatuses(request).getContainerStatuses()
.get(0);
int timeoutSecs = 0;
while (!containerStatus.getState().equals(finalState)
&& timeoutSecs++ < timeOutMax) {
Thread.sleep(1000);
LOG.info("Waiting for container to get into state " + finalState
+ ". Current state is " + containerStatus.getState());
containerStatus = containerManager.getContainerStatuses(request).getContainerStatuses().get(0);
}
LOG.info("Container state is " + containerStatus.getState());
Assert.assertEquals("ContainerState is not correct (timedout)",
finalState, containerStatus.getState());
}
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:BaseContainerManagerTest.java
示例3: getContainerStatuses
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
@Override
synchronized public GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request) throws YarnException {
List<ContainerStatus> statuses = new ArrayList<ContainerStatus>();
for (ContainerId containerId : request.getContainerIds()) {
List<Container> appContainers =
containers.get(containerId.getApplicationAttemptId()
.getApplicationId());
Container container = null;
for (Container c : appContainers) {
if (c.getId().equals(containerId)) {
container = c;
}
}
if (container != null
&& containerStatusMap.get(container).getState() != null) {
statuses.add(containerStatusMap.get(container));
}
}
return GetContainerStatusesResponse.newInstance(statuses, null);
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:NodeManager.java
示例4: getContainerStatus
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
@Override
public ContainerStatus getContainerStatus(ContainerId containerId,
NodeId nodeId) throws YarnException, IOException {
ContainerManagementProtocolProxyData proxy = null;
List<ContainerId> containerIds = new ArrayList<ContainerId>();
containerIds.add(containerId);
try {
proxy = cmProxy.getProxy(nodeId.toString(), containerId);
GetContainerStatusesResponse response =
proxy.getContainerManagementProtocol().getContainerStatuses(
GetContainerStatusesRequest.newInstance(containerIds));
if (response.getFailedRequests() != null
&& response.getFailedRequests().containsKey(containerId)) {
Throwable t =
response.getFailedRequests().get(containerId).deSerialize();
parseAndThrowException(t);
}
ContainerStatus containerStatus = response.getContainerStatuses().get(0);
return containerStatus;
} finally {
if (proxy != null) {
cmProxy.mayBeCloseProxy(proxy);
}
}
}
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:NMClientImpl.java
示例5: getContainerStatuses
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
/**
* Get a list of container statuses running on this NodeManager
*/
@Override
public GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request) throws YarnException, IOException {
List<ContainerStatus> succeededRequests = new ArrayList<ContainerStatus>();
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 : request.getContainerIds()) {
try {
ContainerStatus status = getContainerStatusInternal(id, identifier);
succeededRequests.add(status);
} catch (YarnException e) {
failedRequests.put(id, SerializedException.newInstance(e));
}
}
return GetContainerStatusesResponse.newInstance(succeededRequests,
failedRequests);
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:27,代码来源:ContainerManagerImpl.java
示例6: getContainerStatus
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
private ContainerStatus getContainerStatus(
Context context, final ContainerManagerImpl cm, ContainerId cid)
throws Exception {
UserGroupInformation user = UserGroupInformation.createRemoteUser(
cid.getApplicationAttemptId().toString());
NMTokenIdentifier nmToken = new NMTokenIdentifier(
cid.getApplicationAttemptId(), context.getNodeId(),
user.getShortUserName(),
context.getNMTokenSecretManager().getCurrentKey().getKeyId());
user.addTokenIdentifier(nmToken);
List<ContainerId> containerIds = new ArrayList<>();
containerIds.add(cid);
final GetContainerStatusesRequest gcsRequest =
GetContainerStatusesRequest.newInstance(containerIds);
return user.doAs(
new PrivilegedExceptionAction<ContainerStatus>() {
@Override
public ContainerStatus run() throws Exception {
return cm.getContainerStatuses(gcsRequest)
.getContainerStatuses().get(0);
}
});
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:24,代码来源:TestContainerManagerRecovery.java
示例7: getContainerStatuses
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
@Override
public GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request) throws YarnException, IOException {
GetContainerStatusesRequestProto requestProto =
((GetContainerStatusesRequestPBImpl) request).getProto();
try {
return new GetContainerStatusesResponsePBImpl(proxy.getContainerStatuses(
null, requestProto));
} catch (ServiceException e) {
RPCUtil.unwrapAndThrowException(e);
return null;
}
}
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ContainerManagementProtocolPBClientImpl.java
示例8: getContainerStatuses
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest; //导入依赖的package包/类
@Override
public GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request)
throws YarnException {
GetContainerStatusesResponse response =
recordFactory.newRecordInstance(GetContainerStatusesResponse.class);
response.setContainerStatuses(statuses);
return response;
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:TestRPC.java
注:本文中的org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论