Java 类org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse 实例源码

项目:hadoop    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:hadoop    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:aliyun-oss-hadoop-fs    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:big-c    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:big-c    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:YarnClientImpl.java   
@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);
  }
}
项目:hops    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newContainerId(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:hops    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:hadoop-on-lustre2    文件:TestClientRMService.java   
@Test
public void testGetContainers() throws YarnException, IOException {
  ClientRMService rmService = createRMService();
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetContainersRequest request = recordFactory
      .newRecordInstance(GetContainersRequest.class);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(
      ApplicationId.newInstance(123456, 1), 1);
  ContainerId containerId = ContainerId.newInstance(attemptId, 1);
  request.setApplicationAttemptId(attemptId);
  try {
    GetContainersResponse response = rmService.getContainers(request);
    Assert.assertEquals(containerId, response.getContainerList().get(0)
        .getContainerId());
  } catch (ApplicationNotFoundException ex) {
    Assert.fail(ex.getMessage());
  }
}
项目:hadoop-on-lustre2    文件:TestApplicationHistoryClientService.java   
@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());
}
项目:hadoop-on-lustre2    文件:YarnClientImpl.java   
@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);
  }
}
项目:hadoop    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop    文件:ApplicationHistoryClientService.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersResponse response =
      GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
        history.getContainers(request.getApplicationAttemptId()).values()));
  return response;
}
项目:hadoop    文件:AHSClientImpl.java   
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
项目:hadoop    文件:ProtocolHATestBase.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // return fake ContainerReports
  return GetContainersResponse.newInstance(createFakeContainerReports());
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationHistoryClientService.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersResponse response =
      GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
        history.getContainers(request.getApplicationAttemptId()).values()));
  return response;
}
项目:aliyun-oss-hadoop-fs    文件:AHSClientImpl.java   
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
项目:aliyun-oss-hadoop-fs    文件:ProtocolHATestBase.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // return fake ContainerReports
  return GetContainersResponse.newInstance(createFakeContainerReports());
}
项目:big-c    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:big-c    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:big-c    文件:ApplicationHistoryClientService.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersResponse response =
      GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
        history.getContainers(request.getApplicationAttemptId()).values()));
  return response;
}
项目:big-c    文件:AHSClientImpl.java   
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
项目:big-c    文件:ProtocolHATestBase.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // return fake ContainerReports
  return GetContainersResponse.newInstance(createFakeContainerReports());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationHistoryClientService.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersResponse response =
      GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
        history.getContainers(request.getApplicationAttemptId()).values()));
  return response;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:AHSClientImpl.java   
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ProtocolHATestBase.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // return fake ContainerReports
  return GetContainersResponse.newInstance(createFakeContainerReports());
}
项目:hops    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hops    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersRequestProto requestProto =
      ((GetContainersRequestPBImpl) request).getProto();
  try {
    return new GetContainersResponsePBImpl(proxy.getContainers(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hops    文件:ApplicationHistoryClientService.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  GetContainersResponse response =
      GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
        history.getContainers(request.getApplicationAttemptId()).values()));
  return response;
}
项目:hops    文件:AHSClientImpl.java   
@Override
public List<ContainerReport> getContainers(
    ApplicationAttemptId applicationAttemptId) throws YarnException,
    IOException {
  GetContainersRequest request = GetContainersRequest
      .newInstance(applicationAttemptId);
  GetContainersResponse response = ahsClient.getContainers(request);
  return response.getContainerList();
}
项目:hops    文件:ProtocolHATestBase.java   
@Override
public GetContainersResponse getContainers(GetContainersRequest request)
    throws YarnException, IOException {
  resetStartFailoverFlag(true);

  // make sure failover has been triggered
  Assert.assertTrue(waittingForFailOver());

  // return fake ContainerReports
  return GetContainersResponse.newInstance(createFakeContainerReports());
}
项目:jumbune    文件:RMCommunicator.java   
/**
 * 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;
}