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


Java GetApplicationsResponse.getApplicationList方法代码示例

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


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

示例1: testApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test
public void testApplications() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  ApplicationId appId1 = ApplicationId.newInstance(0, 2);
  GetApplicationsRequest request = GetApplicationsRequest.newInstance();
  GetApplicationsResponse response =
      clientService.getClientHandler().getApplications(request);
  List<ApplicationReport> appReport = response.getApplicationList();
  Assert.assertNotNull(appReport);
  Collections.sort(appReport, new Comparator<ApplicationReport>() {
    @Override
    public int compare(ApplicationReport o1, ApplicationReport o2) {
      return o1.getApplicationId().compareTo(o2.getApplicationId());
    }
  });
  Assert.assertEquals(appId, appReport.get(0).getApplicationId());
  Assert.assertEquals(appId1, appReport.get(1).getApplicationId());
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:20,代码来源:TestApplicationHistoryClientService.java

示例2: testApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test
public void testApplications() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  writeApplicationStartData(appId);
  writeApplicationFinishData(appId);
  ApplicationId appId1 = ApplicationId.newInstance(0, 2);
  writeApplicationStartData(appId1);
  writeApplicationFinishData(appId1);
  GetApplicationsRequest request = GetApplicationsRequest.newInstance();
  GetApplicationsResponse response =
      historyServer.getClientService().getClientHandler()
        .getApplications(request);
  List<ApplicationReport> appReport = response.getApplicationList();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(appId, appReport.get(0).getApplicationId());
  Assert.assertEquals(appId1, appReport.get(1).getApplicationId());
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:19,代码来源:TestApplicationHistoryClientService.java

示例3: testApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test
public void testApplications() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  ApplicationId appId1 = ApplicationId.newInstance(0, 2);
  GetApplicationsRequest request = GetApplicationsRequest.newInstance();
  GetApplicationsResponse response =
      clientService.getApplications(request);
  List<ApplicationReport> appReport = response.getApplicationList();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(appId, appReport.get(0).getApplicationId());
  Assert.assertEquals(appId1, appReport.get(1).getApplicationId());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:TestApplicationHistoryClientService.java

示例4: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Override
public List<ApplicationReport> getApplications() throws YarnException,
    IOException {
  GetApplicationsRequest request = GetApplicationsRequest.newInstance(null,
      null);
  GetApplicationsResponse response = ahsClient.getApplications(request);
  return response.getApplicationList();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:AHSClientImpl.java

示例5: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Override
public List<ApplicationReport> getApplications(Set<String> applicationTypes,
    EnumSet<YarnApplicationState> applicationStates) throws YarnException,
    IOException {
  GetApplicationsRequest request =
      GetApplicationsRequest.newInstance(applicationTypes, applicationStates);
  GetApplicationsResponse response = rmClient.getApplications(request);
  return response.getApplicationList();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:YarnClientImpl.java

示例6: testApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test
public void testApplications() throws IOException, YarnException {
  ApplicationId appId = null;
  appId = ApplicationId.newInstance(0, 1);
  ApplicationId appId1 = ApplicationId.newInstance(0, 2);
  GetApplicationsRequest request = GetApplicationsRequest.newInstance();
  GetApplicationsResponse response =
      clientService.getApplications(request);
  List<ApplicationReport> appReport = response.getApplicationList();
  Assert.assertNotNull(appReport);
  Assert.assertEquals(appId, appReport.get(1).getApplicationId());
  Assert.assertEquals(appId1, appReport.get(0).getApplicationId());

  // Create a historyManager, and set the max_apps can be loaded
  // as 1.
  Configuration conf = new YarnConfiguration();
  conf.setLong(YarnConfiguration.APPLICATION_HISTORY_MAX_APPS, 1);
  ApplicationHistoryManagerOnTimelineStore historyManager2 =
      new ApplicationHistoryManagerOnTimelineStore(dataManager,
        new ApplicationACLsManager(conf));
  historyManager2.init(conf);
  historyManager2.start();
  @SuppressWarnings("resource")
  ApplicationHistoryClientService clientService2 =
      new ApplicationHistoryClientService(historyManager2);
  response = clientService2.getApplications(request);
  appReport = response.getApplicationList();
  Assert.assertNotNull(appReport);
  Assert.assertTrue(appReport.size() == 1);
  // Expected to get the appReport for application with appId1
  Assert.assertEquals(appId1, appReport.get(0).getApplicationId());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:33,代码来源:TestApplicationHistoryClientService.java

示例7: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Override
public List<ApplicationReport> getApplications(
    Set<String> applicationTypes) throws YarnException, IOException {
  GetApplicationsRequest request =
      applicationTypes == null ? GetApplicationsRequest.newInstance()
          : GetApplicationsRequest.newInstance(applicationTypes);
  GetApplicationsResponse response = rmClient.getApplications(request);
  return response.getApplicationList();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:10,代码来源:YarnClientImpl.java

示例8: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Override
public List<ApplicationReport> getApplications(
    Set<String> applicationTypes) throws YarnException, IOException {
  GetApplicationsRequest request =
      applicationTypes == null ? GetApplicationsRequest.newInstance()
          : GetApplicationsRequest.newInstance(applicationTypes);
  when(rmClient.getApplications(request))
      .thenReturn(
          getApplicationReports(reports,
              request));
  GetApplicationsResponse response = rmClient.getApplications(request);
  return response.getApplicationList();
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:14,代码来源:TestYarnClient.java

示例9: testInvalidateAMHostPortWhenAMFailedOrKilled

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test (timeout = 80000)
public void testInvalidateAMHostPortWhenAMFailedOrKilled() throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MockRM rm1 = new MockRM(conf);
  rm1.start();

  // a succeeded app
  RMApp app1 = rm1.submitApp(200);
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  MockRM.finishAMAndVerifyAppState(app1, rm1, nm1, am1);

  // a failed app
  RMApp app2 = rm1.submitApp(200);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1.nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am2.waitForState(RMAppAttemptState.FAILED);
  rm1.waitForState(app2.getApplicationId(), RMAppState.FAILED);

  // a killed app
  RMApp app3 = rm1.submitApp(200);
  MockAM am3 = MockRM.launchAndRegisterAM(app3, rm1, nm1);
  rm1.killApp(app3.getApplicationId());
  rm1.waitForState(app3.getApplicationId(), RMAppState.KILLED);
  rm1.waitForState(am3.getApplicationAttemptId(), RMAppAttemptState.KILLED);

  GetApplicationsRequest request1 =
      GetApplicationsRequest.newInstance(EnumSet.of(
        YarnApplicationState.FINISHED, YarnApplicationState.KILLED,
        YarnApplicationState.FAILED));
  GetApplicationsResponse response1 =
      rm1.getClientRMService().getApplications(request1);
  List<ApplicationReport> appList1 = response1.getApplicationList();

  Assert.assertEquals(3, appList1.size());
  for (ApplicationReport report : appList1) {
    // killed/failed apps host and rpc port are invalidated.
    if (report.getApplicationId().equals(app2.getApplicationId())
        || report.getApplicationId().equals(app3.getApplicationId())) {
      Assert.assertEquals("N/A", report.getHost());
      Assert.assertEquals(-1, report.getRpcPort());
    }
    // succeeded app's host and rpc port is not invalidated
    if (report.getApplicationId().equals(app1.getApplicationId())) {
      Assert.assertFalse(report.getHost().equals("N/A"));
      Assert.assertTrue(report.getRpcPort() != -1);
    }
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:52,代码来源:TestRM.java

示例10: testInvalidateAMHostPortWhenAMFailedOrKilled

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test (timeout = 80000)
public void testInvalidateAMHostPortWhenAMFailedOrKilled() throws Exception {
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MockRM rm1 = new MockRM(conf);
  Assume.assumeFalse(rm1.getResourceScheduler() instanceof FairScheduler);
  rm1.start();

  // a succeeded app
  RMApp app1 = rm1.submitApp(200);
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  MockRM.finishAMAndVerifyAppState(app1, rm1, nm1, am1);

  // a failed app
  RMApp app2 = rm1.submitApp(200);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1.nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am2.waitForState(RMAppAttemptState.FAILED);
  rm1.waitForState(app2.getApplicationId(), RMAppState.FAILED);

  // a killed app
  RMApp app3 = rm1.submitApp(200);
  MockAM am3 = MockRM.launchAndRegisterAM(app3, rm1, nm1);
  rm1.killApp(app3.getApplicationId());
  rm1.waitForState(app3.getApplicationId(), RMAppState.KILLED);
  rm1.waitForState(am3.getApplicationAttemptId(), RMAppAttemptState.KILLED);

  GetApplicationsRequest request1 =
      GetApplicationsRequest.newInstance(EnumSet.of(
        YarnApplicationState.FINISHED, YarnApplicationState.KILLED,
        YarnApplicationState.FAILED));
  GetApplicationsResponse response1 =
      rm1.getClientRMService().getApplications(request1);
  List<ApplicationReport> appList1 = response1.getApplicationList();

  Assert.assertEquals(3, appList1.size());
  for (ApplicationReport report : appList1) {
    // killed/failed apps host and rpc port are invalidated.
    if (report.getApplicationId().equals(app2.getApplicationId())
        || report.getApplicationId().equals(app3.getApplicationId())) {
      Assert.assertEquals("N/A", report.getHost());
      Assert.assertEquals(-1, report.getRpcPort());
    }
    // succeeded app's host and rpc port is not invalidated
    if (report.getApplicationId().equals(app1.getApplicationId())) {
      Assert.assertFalse(report.getHost().equals("N/A"));
      Assert.assertTrue(report.getRpcPort() != -1);
    }
  }
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:53,代码来源:TestRM.java

示例11: testInvalidateAMHostPortWhenAMFailedOrKilled

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
@Test (timeout = 80000)
public void testInvalidateAMHostPortWhenAMFailedOrKilled() throws Exception {
  YarnConfiguration conf = new YarnConfiguration();
  conf.setInt(YarnConfiguration.RM_AM_MAX_ATTEMPTS, 1);
  MockRM rm1 = new MockRM(conf);
  rm1.start();

  // a succeeded app
  RMApp app1 = rm1.submitApp(200);
  MockNM nm1 =
      new MockNM("127.0.0.1:1234", 15120, rm1.getResourceTrackerService());
  nm1.registerNode();
  MockAM am1 = MockRM.launchAndRegisterAM(app1, rm1, nm1);
  MockRM.finishAMAndVerifyAppState(app1, rm1, nm1, am1);

  // a failed app
  RMApp app2 = rm1.submitApp(200);
  MockAM am2 = MockRM.launchAndRegisterAM(app2, rm1, nm1);
  nm1.nodeHeartbeat(am2.getApplicationAttemptId(), 1, ContainerState.COMPLETE);
  am2.waitForState(RMAppAttemptState.FAILED);
  rm1.waitForState(app2.getApplicationId(), RMAppState.FAILED);

  // a killed app
  RMApp app3 = rm1.submitApp(200);
  MockAM am3 = MockRM.launchAndRegisterAM(app3, rm1, nm1);
  rm1.killApp(app3.getApplicationId());
  rm1.waitForState(app3.getApplicationId(), RMAppState.KILLED);
  rm1.waitForState(am3.getApplicationAttemptId(), RMAppAttemptState.KILLED);

  GetApplicationsRequest request1 =
      GetApplicationsRequest.newInstance(EnumSet.of(
        YarnApplicationState.FINISHED, YarnApplicationState.KILLED,
        YarnApplicationState.FAILED));
  GetApplicationsResponse response1 =
      rm1.getClientRMService().getApplications(request1);
  List<ApplicationReport> appList1 = response1.getApplicationList();

  Assert.assertEquals(3, appList1.size());
  for (ApplicationReport report : appList1) {
    // killed/failed apps host and rpc port are invalidated.
    if (report.getApplicationId().equals(app2.getApplicationId())
        || report.getApplicationId().equals(app3.getApplicationId())) {
      Assert.assertEquals("N/A", report.getHost());
      Assert.assertEquals(-1, report.getRpcPort());
    }
    // succeeded app's host and rpc port is not invalidated
    if (report.getApplicationId().equals(app1.getApplicationId())) {
      Assert.assertFalse(report.getHost().equals("N/A"));
      Assert.assertTrue(report.getRpcPort() != -1);
    }
  }
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:53,代码来源:TestRM.java

示例12: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入方法依赖的package包/类
/**
 * Get list of all applications known to RM
 * @return list of application report
 * @throws YarnException
 * @throws IOException
 */
public List<ApplicationReport> getApplications() throws YarnException, IOException{
	GetApplicationsResponse response = proxy.getApplications(GetApplicationsRequest.newInstance());
	List<ApplicationReport> applicationsReport = response.getApplicationList();
	return applicationsReport;
}
 
开发者ID:Impetus,项目名称:jumbune,代码行数:12,代码来源:RMCommunicator.java


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