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

项目:hadoop    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hadoop    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getGcoreSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:hadoop    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } 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.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:aliyun-oss-hadoop-fs    文件:TestAppReportFetcher.java   
@Override
protected ApplicationHistoryProtocol getAHSProxy(Configuration conf)
    throws IOException
{
  GetApplicationReportResponse resp = Mockito.
      mock(GetApplicationReportResponse.class);
  historyManager = Mockito.mock(ApplicationHistoryProtocol.class);
  try {
    Mockito.when(historyManager.getApplicationReport(Mockito
        .any(GetApplicationReportRequest.class))).thenReturn(resp);
  } catch (YarnException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return historyManager;
}
项目:aliyun-oss-hadoop-fs    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:aliyun-oss-hadoop-fs    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:aliyun-oss-hadoop-fs    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } catch (ApplicationNotFoundException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    return historyClient.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:big-c    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:big-c    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:big-c    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } 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.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getClientHandler().getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:hadoop-2.6.0-cdh5.4.3    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } 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.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:hops    文件:TestAppReportFetcher.java   
@Override
protected ApplicationHistoryProtocol getAHSProxy(Configuration conf)
    throws IOException
{
  GetApplicationReportResponse resp = Mockito.
      mock(GetApplicationReportResponse.class);
  historyManager = Mockito.mock(ApplicationHistoryProtocol.class);
  try {
    Mockito.when(historyManager.getApplicationReport(Mockito
        .any(GetApplicationReportRequest.class))).thenReturn(resp);
  } catch (YarnException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }
  return historyManager;
}
项目:hops    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hops    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      clientService.getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(123, appReport.getApplicationResourceUsageReport()
      .getMemorySeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
      .getVcoreSeconds());
  Assert.assertEquals(345, appReport.getApplicationResourceUsageReport()
             .getGPUSeconds());
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test app type",
      appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:hops    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } catch (ApplicationNotFoundException e) {
    if (!historyServiceEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    return historyClient.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:hadoop-TCP    文件:TestQueueACLs.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hardfs    文件:TestQueueACLs.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hadoop-on-lustre2    文件:QueueACLsTestBase.java   
private void verifyGetClientAMToken(String submitter, String queueAdmin,
    String queueName, boolean setupACLs) throws Exception {
  ApplicationId applicationId =
      submitAppAndGetAppId(submitter, queueName, setupACLs);
  final GetApplicationReportRequest appReportRequest =
      GetApplicationReportRequest.newInstance(applicationId);

  ApplicationClientProtocol submitterClient = getRMClientForUser(submitter);
  ApplicationClientProtocol adMinUserClient = getRMClientForUser(queueAdmin);

  GetApplicationReportResponse submitterGetReport =
      submitterClient.getApplicationReport(appReportRequest);
  GetApplicationReportResponse adMinUserGetReport =
      adMinUserClient.getApplicationReport(appReportRequest);

  Assert.assertEquals(submitterGetReport.getApplicationReport()
    .getClientToAMToken(), adMinUserGetReport.getApplicationReport()
    .getClientToAMToken());
}
项目:hadoop-on-lustre2    文件:TestApplicationHistoryClientService.java   
@Test
public void testApplicationReport() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  writeApplicationStartData(appId);
  writeApplicationFinishData(appId);
  GetApplicationReportRequest request =
      GetApplicationReportRequest.newInstance(appId);
  GetApplicationReportResponse response =
      historyServer.getClientService().getClientHandler()
        .getApplicationReport(request);
  ApplicationReport appReport = response.getApplicationReport();
  Assert.assertNotNull(appReport);
  Assert.assertEquals("application_0_0001", appReport.getApplicationId()
    .toString());
  Assert.assertEquals("test type", appReport.getApplicationType().toString());
  Assert.assertEquals("test queue", appReport.getQueue().toString());
}
项目:hadoop-on-lustre2    文件:YarnClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportResponse response = null;
  try {
    GetApplicationReportRequest request = Records
        .newRecord(GetApplicationReportRequest.class);
    request.setApplicationId(appId);
    response = rmClient.getApplicationReport(request);
  } 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.getApplicationReport(appId);
  }
  return response.getApplicationReport();
}
项目:hadoop    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException, IOException {
  GetApplicationReportRequestProto requestProto =
      ((GetApplicationReportRequestPBImpl) request).getProto();
  try {
    return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException,
    IOException {
  GetApplicationReportRequestProto requestProto =
      ((GetApplicationReportRequestPBImpl) request).getProto();
  try {
    return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:hadoop    文件:TestAggregatedLogDeletionService.java   
private static GetApplicationReportResponse
    createApplicationReportWithRunningApplication() {
  ApplicationReport report = mock(ApplicationReport.class);
  when(report.getYarnApplicationState()).thenReturn(
    YarnApplicationState.RUNNING);
  GetApplicationReportResponse response =
      mock(GetApplicationReportResponse.class);
  when(response.getApplicationReport()).thenReturn(report);
  return response;
}
项目:hadoop    文件:TestAggregatedLogDeletionService.java   
private static GetApplicationReportResponse
    createApplicationReportWithFinishedApplication() {
  ApplicationReport report = mock(ApplicationReport.class);
  when(report.getYarnApplicationState()).thenReturn(
    YarnApplicationState.FINISHED);
  GetApplicationReportResponse response =
      mock(GetApplicationReportResponse.class);
  when(response.getApplicationReport()).thenReturn(report);
  return response;
}
项目:hadoop    文件:AppReportFetcher.java   
/**
 * Get a report for the specified app.
 * @param appId the id of the application to get. 
 * @return the ApplicationReport for that app.
 * @throws YarnException on any error.
 * @throws IOException
 */
public ApplicationReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(appId);

  GetApplicationReportResponse response = applicationsManager
      .getApplicationReport(request);
  return response.getApplicationReport();
}
项目:hadoop    文件:ClientRMService.java   
/**
 * It gives response which includes application report if the application
 * present otherwise throws ApplicationNotFoundException.
 */
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException {
  ApplicationId applicationId = request.getApplicationId();

  UserGroupInformation callerUGI;
  try {
    callerUGI = UserGroupInformation.getCurrentUser();
  } catch (IOException ie) {
    LOG.info("Error getting UGI ", ie);
    throw RPCUtil.getRemoteException(ie);
  }

  RMApp application = this.rmContext.getRMApps().get(applicationId);
  if (application == null) {
    // If the RM doesn't have the application, throw
    // ApplicationNotFoundException and let client to handle.
    throw new ApplicationNotFoundException("Application with id '"
        + applicationId + "' doesn't exist in RM.");
  }

  boolean allowAccess = checkAccess(callerUGI, application.getUser(),
      ApplicationAccessType.VIEW_APP, application);
  ApplicationReport report =
      application.createAndGetApplicationReport(callerUGI.getUserName(),
          allowAccess);

  GetApplicationReportResponse response = recordFactory
      .newRecordInstance(GetApplicationReportResponse.class);
  response.setApplicationReport(report);
  return response;
}
项目:hadoop    文件:TestRMRestart.java   
private ApplicationReport verifyAppReportAfterRMRestart(RMApp app, MockRM rm)
    throws Exception {
  GetApplicationReportRequest reportRequest =
      GetApplicationReportRequest.newInstance(app.getApplicationId());
  GetApplicationReportResponse response =
      rm.getClientRMService().getApplicationReport(reportRequest);
  ApplicationReport report = response.getApplicationReport();
  Assert.assertEquals(app.getStartTime(), report.getStartTime());
  Assert.assertEquals(app.getFinishTime(), report.getFinishTime());
  Assert.assertEquals(app.createApplicationState(),
    report.getYarnApplicationState());
  Assert.assertTrue(1 == report.getProgress());
  return response.getApplicationReport();
}
项目:hadoop    文件:MockRM.java   
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  ApplicationClientProtocol client = getClientRMService();
  GetApplicationReportResponse response =
      client.getApplicationReport(GetApplicationReportRequest
          .newInstance(appId));
  return response.getApplicationReport();
}
项目:hadoop    文件:TestClientRMService.java   
@Test
public void testGetApplicationReport() throws Exception {
  YarnScheduler yarnScheduler = mock(YarnScheduler.class);
  RMContext rmContext = mock(RMContext.class);
  mockRMContext(yarnScheduler, rmContext);

  ApplicationId appId1 = getApplicationId(1);

  ApplicationACLsManager mockAclsManager = mock(ApplicationACLsManager.class);
  when(
      mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
          ApplicationAccessType.VIEW_APP, null, appId1)).thenReturn(true);

  ClientRMService rmService = new ClientRMService(rmContext, yarnScheduler,
      null, mockAclsManager, null, null);
  try {
    RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
    GetApplicationReportRequest request = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    request.setApplicationId(appId1);
    GetApplicationReportResponse response = 
        rmService.getApplicationReport(request);
    ApplicationReport report = response.getApplicationReport();
    ApplicationResourceUsageReport usageReport = 
        report.getApplicationResourceUsageReport();
    Assert.assertEquals(10, usageReport.getMemorySeconds());
    Assert.assertEquals(3, usageReport.getVcoreSeconds());
    Assert.assertEquals(3, usageReport.getGcoreSeconds());
  } finally {
    rmService.close();
  }
}
项目:hadoop    文件:ApplicationHistoryClientService.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException, IOException {
  ApplicationId applicationId = request.getApplicationId();
  try {
    GetApplicationReportResponse response =
        GetApplicationReportResponse.newInstance(history
          .getApplication(applicationId));
    return response;
  } catch (IOException e) {
    LOG.error(e.getMessage(), e);
    throw e;
  }
}
项目:hadoop    文件:AHSClientImpl.java   
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportRequest request = GetApplicationReportRequest
      .newInstance(appId);
  GetApplicationReportResponse response = ahsClient
      .getApplicationReport(request);
  return response.getApplicationReport();
}
项目:hadoop    文件:ProtocolHATestBase.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException {
  resetStartFailoverFlag(true);

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

  // create a fake application report
  ApplicationReport report = createFakeAppReport();
  GetApplicationReportResponse response =
      GetApplicationReportResponse.newInstance(report);
  return response;
}
项目:hadoop    文件:TestClientRedirect.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws IOException {
  ApplicationId applicationId = request.getApplicationId();
  ApplicationReport application = recordFactory
      .newRecordInstance(ApplicationReport.class);
  application.setApplicationId(applicationId);
  application.setFinalApplicationStatus(FinalApplicationStatus.UNDEFINED);
  if (amRunning) {
    application.setYarnApplicationState(YarnApplicationState.RUNNING);
  } else if (amRestarting) {
    application.setYarnApplicationState(YarnApplicationState.SUBMITTED);
  } else {
    application.setYarnApplicationState(YarnApplicationState.FINISHED);
    application.setFinalApplicationStatus(FinalApplicationStatus.SUCCEEDED);
  }
  String[] split = AMHOSTADDRESS.split(":");
  application.setHost(split[0]);
  application.setRpcPort(Integer.parseInt(split[1]));
  application.setUser("TestClientRedirect-user");
  application.setName("N/A");
  application.setQueue("N/A");
  application.setStartTime(0);
  application.setFinishTime(0);
  application.setTrackingUrl("N/A");
  application.setDiagnostics("N/A");

  GetApplicationReportResponse response = recordFactory
      .newRecordInstance(GetApplicationReportResponse.class);
  response.setApplicationReport(application);
  return response;
}
项目:scheduling-connector-for-hadoop    文件:HPCApplicationClientProtocolImpl.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException, IOException {
  ApplicationReport applicationReport = appClient
      .getApplicationReport(request.getApplicationId());
  return GetApplicationReportResponse.newInstance(applicationReport);
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationHistoryProtocolPBClientImpl.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException, IOException {
  GetApplicationReportRequestProto requestProto =
      ((GetApplicationReportRequestPBImpl) request).getProto();
  try {
    return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationClientProtocolPBClientImpl.java   
@Override
public GetApplicationReportResponse getApplicationReport(
    GetApplicationReportRequest request) throws YarnException,
    IOException {
  GetApplicationReportRequestProto requestProto =
      ((GetApplicationReportRequestPBImpl) request).getProto();
  try {
    return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
项目:aliyun-oss-hadoop-fs    文件:TestAggregatedLogDeletionService.java   
private static GetApplicationReportResponse
    createApplicationReportWithRunningApplication() {
  ApplicationReport report = mock(ApplicationReport.class);
  when(report.getYarnApplicationState()).thenReturn(
    YarnApplicationState.RUNNING);
  GetApplicationReportResponse response =
      mock(GetApplicationReportResponse.class);
  when(response.getApplicationReport()).thenReturn(report);
  return response;
}
项目:aliyun-oss-hadoop-fs    文件:TestAggregatedLogDeletionService.java   
private static GetApplicationReportResponse
    createApplicationReportWithFinishedApplication() {
  ApplicationReport report = mock(ApplicationReport.class);
  when(report.getYarnApplicationState()).thenReturn(
    YarnApplicationState.FINISHED);
  GetApplicationReportResponse response =
      mock(GetApplicationReportResponse.class);
  when(response.getApplicationReport()).thenReturn(report);
  return response;
}