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


Java GetApplicationReportRequest.setApplicationId方法代码示例

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


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

示例1: testNonExistingApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
@Test
public void testNonExistingApplicationReport() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(ApplicationId.newInstance(0, 0));
  try {
    rmService.getApplicationReport(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Application with id '" + request.getApplicationId()
            + "' doesn't exist in RM.");
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestClientRMService.java

示例2: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
/**
 * Get an application report for the specified application id from the RM and
 * fall back to the Application History Server if not found in RM.
 * @param appId id of the application to get.
 * @return the ApplicationReport for the appId.
 * @throws YarnException on any error.
 * @throws IOException
 */
public FetchedAppReport getApplicationReport(ApplicationId appId)
throws YarnException, IOException {
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(appId);

  ApplicationReport appReport;
  FetchedAppReport fetchedAppReport;
  try {
    appReport = applicationsManager.
        getApplicationReport(request).getApplicationReport();
    fetchedAppReport = new FetchedAppReport(appReport, AppReportSource.RM);
  } catch (ApplicationNotFoundException e) {
    if (!isAHSEnabled) {
      // Just throw it as usual if historyService is not enabled.
      throw e;
    }
    //Fetch the application report from AHS
    appReport = historyManager.
        getApplicationReport(request).getApplicationReport();
    fetchedAppReport = new FetchedAppReport(appReport, AppReportSource.AHS);
  }
  return fetchedAppReport;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:AppReportFetcher.java

示例4: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
@Test
public void testGetApplicationReport() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null);
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(ApplicationId.newInstance(0, 0));
  try {
    rmService.getApplicationReport(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Application with id '" + request.getApplicationId()
            + "' doesn't exist in RM.");
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:21,代码来源:TestClientRMService.java

示例6: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
@Test
public void testGetApplicationReport() throws YarnException {
  RMContext rmContext = mock(RMContext.class);
  when(rmContext.getRMApps()).thenReturn(
      new ConcurrentHashMap<ApplicationId, RMApp>());
  ClientRMService rmService = new ClientRMService(rmContext, null, null,
      null, null, null);
  RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
  GetApplicationReportRequest request = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  request.setApplicationId(ApplicationId.newInstance(0, 0));
  try {
    rmService.getApplicationReport(request);
    Assert.fail();
  } catch (ApplicationNotFoundException ex) {
    Assert.assertEquals(ex.getMessage(),
        "Application with id '" + request.getApplicationId()
            + "' doesn't exist in RM.");
  }
}
 
开发者ID:chendave,项目名称:hadoop-TCP,代码行数:21,代码来源:TestClientRMService.java

示例7: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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

示例8: verifyOwnerAccess

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
private void verifyOwnerAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    // View as owner
    rmClient.getApplicationReport(appReportRequest);

    // List apps as owner
    Assert.assertEquals("App view by owner should list the apps!!", 1,
        rmClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as owner
    rmClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:29,代码来源:TestApplicationACLs.java

示例9: verifySuperUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
private void verifySuperUserAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol superUserClient = getRMClientForUser(SUPER_USER);

    // View as the superUser
    superUserClient.getApplicationReport(appReportRequest);

    // List apps as superUser
    Assert.assertEquals("App view by super-user should list the apps!!", 2,
        superUserClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the superUser
    superUserClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例10: verifyFriendAccess

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
private void verifyFriendAccess() throws Exception {

    AccessControlList viewACL = new AccessControlList("");
    viewACL.addGroup(FRIENDLY_GROUP);
    AccessControlList modifyACL = new AccessControlList("");
    modifyACL.addUser(FRIEND);
    ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

    final GetApplicationReportRequest appReportRequest = recordFactory
        .newRecordInstance(GetApplicationReportRequest.class);
    appReportRequest.setApplicationId(applicationId);
    final KillApplicationRequest finishAppRequest = recordFactory
        .newRecordInstance(KillApplicationRequest.class);
    finishAppRequest.setApplicationId(applicationId);

    ApplicationClientProtocol friendClient = getRMClientForUser(FRIEND);

    // View as the friend
    friendClient.getApplicationReport(appReportRequest);

    // List apps as friend
    Assert.assertEquals("App view by a friend should list the apps!!", 3,
        friendClient.getApplications(
            recordFactory.newRecordInstance(GetApplicationsRequest.class))
            .getApplicationList().size());

    // Kill app as the friend
    friendClient.forceKillApplication(finishAppRequest);
    resourceManager.waitForState(applicationId, RMAppState.KILLED);
  }
 
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:TestApplicationACLs.java

示例11: verifyAdministerQueueUserAccess

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
private void verifyAdministerQueueUserAccess() throws Exception {
  isQueueUser = true;
  AccessControlList viewACL = new AccessControlList("");
  viewACL.addGroup(FRIENDLY_GROUP);
  AccessControlList modifyACL = new AccessControlList("");
  modifyACL.addUser(FRIEND);
  ApplicationId applicationId = submitAppAndGetAppId(viewACL, modifyACL);

  final GetApplicationReportRequest appReportRequest = recordFactory
      .newRecordInstance(GetApplicationReportRequest.class);
  appReportRequest.setApplicationId(applicationId);
  final KillApplicationRequest finishAppRequest = recordFactory
      .newRecordInstance(KillApplicationRequest.class);
  finishAppRequest.setApplicationId(applicationId);

  ApplicationClientProtocol administerQueueUserRmClient =
      getRMClientForUser(QUEUE_ADMIN_USER);

  // View as the administerQueueUserRmClient
  administerQueueUserRmClient.getApplicationReport(appReportRequest);

  // List apps as administerQueueUserRmClient
  Assert.assertEquals("App view by queue-admin-user should list the apps!!",
      5, administerQueueUserRmClient.getApplications(
             recordFactory.newRecordInstance(GetApplicationsRequest.class))
             .getApplicationList().size());

  // Kill app as the administerQueueUserRmClient
  administerQueueUserRmClient.forceKillApplication(finishAppRequest);
  resourceManager.waitForState(applicationId, RMAppState.KILLED);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:32,代码来源:TestApplicationACLs.java

示例12: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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

示例13: getApplicationResourceReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的package包/类
public ApplicationResourceUsageReport getApplicationResourceReport(String appId) throws Exception {
  List<String> splits = Lists.newArrayList(Splitter.on('_').split(appId));
  Preconditions.checkArgument(splits.size() == 3, "Invalid application id - " + appId);
  ApplicationId applicationId =
    YarnUtils.createApplicationId(Long.parseLong(splits.get(1)), Integer.parseInt(splits.get(2)));

  ClientRMService clientRMService = cluster.getResourceManager().getClientRMService();
  GetApplicationReportRequest request = Records.newRecord(GetApplicationReportRequest.class);
  request.setApplicationId(applicationId);
  return clientRMService.getApplicationReport(request)
    .getApplicationReport().getApplicationResourceUsageReport();
}
 
开发者ID:apache,项目名称:twill,代码行数:13,代码来源:TwillTester.java

示例14: testGetApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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

示例15: getApplicationReport

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; //导入方法依赖的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


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