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


Java GetApplicationReportResponse.getApplicationReport方法代码示例

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


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

示例1: testApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestApplicationHistoryClientService.java

示例2: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:24,代码来源:YarnClientImpl.java

示例3: testApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:21,代码来源:TestApplicationHistoryClientService.java

示例4: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:YarnClientImpl.java

示例5: testApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:17,代码来源:TestApplicationHistoryClientService.java

示例6: testApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:23,代码来源:TestApplicationHistoryClientService.java

示例7: testApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:19,代码来源:TestApplicationHistoryClientService.java

示例8: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
/**
 * 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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:AppReportFetcher.java

示例9: verifyAppReportAfterRMRestart

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
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();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:TestRMRestart.java

示例10: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  ApplicationClientProtocol client = getClientRMService();
  GetApplicationReportResponse response =
      client.getApplicationReport(GetApplicationReportRequest
          .newInstance(appId));
  return response.getApplicationReport();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:MockRM.java

示例11: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:33,代码来源:TestClientRMService.java

示例12: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportRequest request = GetApplicationReportRequest
      .newInstance(appId);
  GetApplicationReportResponse response = ahsClient
      .getApplicationReport(request);
  return response.getApplicationReport();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AHSClientImpl.java

示例13: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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());
  } finally {
    rmService.close();
  }
}
 
开发者ID:yncxcw,项目名称:big-c,代码行数:32,代码来源:TestClientRMService.java

示例14: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@Override
public ApplicationReport getApplicationReport(ApplicationId appId)
    throws YarnException, IOException {
  GetApplicationReportRequest request =
      Records.newRecord(GetApplicationReportRequest.class);
  request.setApplicationId(appId);
  GetApplicationReportResponse response =
      rmClient.getApplicationReport(request);
  return response.getApplicationReport();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:11,代码来源:YarnClientImpl.java

示例15: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; //导入方法依赖的package包/类
@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("<Not set>", report.getAmNodeLabelExpression());
    Assert.assertEquals("<Not set>", report.getAppNodeLabelExpression());

    // if application has am node label set to blank
    ApplicationId appId2 = getApplicationId(2);
    when(mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
        ApplicationAccessType.VIEW_APP, null, appId2)).thenReturn(true);
    request.setApplicationId(appId2);
    response = rmService.getApplicationReport(request);
    report = response.getApplicationReport();

    Assert.assertEquals(NodeLabel.DEFAULT_NODE_LABEL_PARTITION,
        report.getAmNodeLabelExpression());
    Assert.assertEquals(NodeLabel.NODE_LABEL_EXPRESSION_NOT_SET,
        report.getAppNodeLabelExpression());

    // if application has am node label set to blank
    ApplicationId appId3 = getApplicationId(3);
    when(mockAclsManager.checkAccess(UserGroupInformation.getCurrentUser(),
        ApplicationAccessType.VIEW_APP, null, appId3)).thenReturn(true);

    request.setApplicationId(appId3);
    response = rmService.getApplicationReport(request);
    report = response.getApplicationReport();

    Assert.assertEquals("high-mem", report.getAmNodeLabelExpression());
    Assert.assertEquals("high-mem", report.getAppNodeLabelExpression());

    // if application id is null
    GetApplicationReportRequest invalidRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    invalidRequest.setApplicationId(null);
    try {
      rmService.getApplicationReport(invalidRequest);
    } catch (YarnException e) {
      // rmService should return a ApplicationNotFoundException
      // when a null application id is provided
      Assert.assertTrue(e instanceof ApplicationNotFoundException);
    }
  } finally {
    rmService.close();
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:71,代码来源:TestClientRMService.java


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