当前位置: 首页>>代码示例>>Java>>正文


Java GetContainersResponse.getContainerList方法代码示例

本文整理汇总了Java中org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse.getContainerList方法的典型用法代码示例。如果您正苦于以下问题:Java GetContainersResponse.getContainerList方法的具体用法?Java GetContainersResponse.getContainerList怎么用?Java GetContainersResponse.getContainerList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse的用法示例。


在下文中一共展示了GetContainersResponse.getContainerList方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testContainers

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
@Test
public void testContainers() throws IOException, YarnException {
  ApplicationId appId = ApplicationId.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =
      ApplicationAttemptId.newInstance(appId, 1);
  ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
  ContainerId containerId1 = ContainerId.newContainerId(appAttemptId, 2);
  GetContainersRequest request =
      GetContainersRequest.newInstance(appAttemptId);
  GetContainersResponse response =
      clientService.getContainers(request);
  List<ContainerReport> containers = response.getContainerList();
  Assert.assertNotNull(containers);
  Assert.assertEquals(containerId, containers.get(0).getContainerId());
  Assert.assertEquals(containerId1, containers.get(1).getContainerId());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestApplicationHistoryClientService.java

示例2: testContainers

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
@Test
public void testContainers() throws IOException, YarnException {
  ApplicationId appId = ApplicationId.newInstance(0, 1);
  ApplicationAttemptId appAttemptId =
      ApplicationAttemptId.newInstance(appId, 1);
  ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
  ContainerId containerId1 = ContainerId.newContainerId(appAttemptId, 2);
  GetContainersRequest request =
      GetContainersRequest.newInstance(appAttemptId);
  GetContainersResponse response =
      clientService.getClientHandler().getContainers(request);
  List<ContainerReport> containers = response.getContainerList();
  Assert.assertNotNull(containers);
  Collections.sort(containers, new Comparator<ContainerReport>() {
    @Override
    public int compare(ContainerReport o1, ContainerReport o2) {
      return o1.getContainerId().compareTo(o2.getContainerId());
    }
  });
  Assert.assertEquals(containerId, containers.get(0).getContainerId());
  Assert.assertEquals(containerId1, containers.get(1).getContainerId());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:23,代码来源:TestApplicationHistoryClientService.java

示例3: getContainers

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  try {
    GetContainersRequest request = Records
        .newRecord(GetContainersRequest.class);
    request.setApplicationAttemptId(applicationAttemptId);
    GetContainersResponse response = rmClient.getContainers(request);
    return response.getContainerList();
  } catch (YarnException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    // Even if history-service is enabled, treat all exceptions still the same
    // except the following
    if (e.getClass() != ApplicationNotFoundException.class) {
      throw e;
    }
    return historyClient.getContainers(applicationAttemptId);
  }
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:24,代码来源:YarnClientImpl.java

示例4: testContainers

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
@Test
public void testContainers() throws IOException, YarnException {
  ApplicationId appId = ApplicationId.newInstance(0, 1);
  writeApplicationStartData(appId);
  ApplicationAttemptId appAttemptId =
      ApplicationAttemptId.newInstance(appId, 1);
  ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
  ContainerId containerId1 = ContainerId.newInstance(appAttemptId, 2);
  writeContainerStartData(containerId);
  writeContainerFinishData(containerId);
  writeContainerStartData(containerId1);
  writeContainerFinishData(containerId1);
  writeApplicationFinishData(appId);
  GetContainersRequest request =
      GetContainersRequest.newInstance(appAttemptId);
  GetContainersResponse response =
      historyServer.getClientService().getClientHandler()
        .getContainers(request);
  List<ContainerReport> containers = response.getContainerList();
  Assert.assertNotNull(containers);
  Assert.assertEquals(containerId, containers.get(1).getContainerId());
  Assert.assertEquals(containerId1, containers.get(0).getContainerId());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:24,代码来源:TestApplicationHistoryClientService.java

示例5: getContainers

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AHSClientImpl.java

示例6: getNodesWithCompletedAttempt

import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; //导入方法依赖的package包/类
/**
 * Get the list of nodes completed the application attempt
 * @param applicationAttemptId
 * @return
 * @throws YarnException
 * @throws IOException
 */
public Set<String> getNodesWithCompletedAttempt(ApplicationAttemptId applicationAttemptId) throws YarnException, IOException{
	Set<String> nodes = new HashSet<String>();
	GetContainersResponse response = proxy.getContainers(GetContainersRequest.newInstance(applicationAttemptId));
	List<ContainerReport> containers = response.getContainerList();
	for(ContainerReport container: containers){
		if(ContainerState.COMPLETE.equals(container.getContainerState())){
				nodes.add(container.getAssignedNode().getHost());
		}
	}
	return nodes;
}
 
开发者ID:Impetus,项目名称:jumbune,代码行数:19,代码来源:RMCommunicator.java


注:本文中的org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse.getContainerList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。