• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java GetApplicationsResponse类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



GetApplicationsResponse类属于org.apache.hadoop.yarn.api.protocolrecords包,在下文中一共展示了GetApplicationsResponse类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: tesAllJobs

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void tesAllJobs() throws Exception {
  final ApplicationClientProtocol applicationsManager = Mockito.mock(ApplicationClientProtocol.class);
  GetApplicationsResponse allApplicationsResponse = Records
      .newRecord(GetApplicationsResponse.class);
  List<ApplicationReport> applications = new ArrayList<ApplicationReport>();
  applications.add(getApplicationReport(YarnApplicationState.FINISHED,
      FinalApplicationStatus.FAILED));
  applications.add(getApplicationReport(YarnApplicationState.FINISHED,
      FinalApplicationStatus.SUCCEEDED));
  applications.add(getApplicationReport(YarnApplicationState.FINISHED,
      FinalApplicationStatus.KILLED));
  applications.add(getApplicationReport(YarnApplicationState.FAILED,
      FinalApplicationStatus.FAILED));
  allApplicationsResponse.setApplicationList(applications);
  Mockito.when(
      applicationsManager.getApplications(Mockito
          .any(GetApplicationsRequest.class))).thenReturn(
      allApplicationsResponse);
  ResourceMgrDelegate resourceMgrDelegate = new ResourceMgrDelegate(
    new YarnConfiguration()) {
    @Override
    protected void serviceStart() throws Exception {
      Assert.assertTrue(this.client instanceof YarnClientImpl);
      ((YarnClientImpl) this.client).setRMClient(applicationsManager);
    }
  };
  JobStatus[] allJobs = resourceMgrDelegate.getAllJobs();

  Assert.assertEquals(State.FAILED, allJobs[0].getState());
  Assert.assertEquals(State.SUCCEEDED, allJobs[1].getState());
  Assert.assertEquals(State.KILLED, allJobs[2].getState());
  Assert.assertEquals(State.FAILED, allJobs[3].getState());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:35,代码来源:TestResourceMgrDelegate.java


示例2: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Override
public GetApplicationsResponse
    getApplications(GetApplicationsRequest request) throws YarnException,
        IOException {
  long startedBegin =
      request.getStartRange() == null ? 0L : request.getStartRange()
        .getMinimumLong();
  long startedEnd =
      request.getStartRange() == null ? Long.MAX_VALUE : request
        .getStartRange().getMaximumLong();
  GetApplicationsResponse response =
      GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>(
        history.getApplications(request.getLimit(), startedBegin, startedEnd)
          .values()));
  return response;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:17,代码来源:ApplicationHistoryClientService.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.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


示例4: getApplicationReports

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
private GetApplicationsResponse getApplicationReports(
    List<ApplicationReport> applicationReports,
    GetApplicationsRequest request) {

  List<ApplicationReport> appReports = new ArrayList<ApplicationReport>();
  Set<String> appTypes = request.getApplicationTypes();
  boolean bypassFilter = appTypes.isEmpty();

  for (ApplicationReport appReport : applicationReports) {
    if (!(bypassFilter || appTypes.contains(
        appReport.getApplicationType()))) {
      continue;
    }
    appReports.add(appReport);
  }
  GetApplicationsResponse response =
      GetApplicationsResponse.newInstance(appReports);
  return response;
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:20,代码来源:TestYarnClient.java


示例5: testLocalMode

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void testLocalMode() throws IOException, YarnException, InterpreterException {
  InterpreterSetting sparkInterpreterSetting = interpreterSettingManager.getInterpreterSettingByName("spark");
  sparkInterpreterSetting.setProperty("master", "local[*]");
  sparkInterpreterSetting.setProperty("SPARK_HOME", System.getenv("SPARK_HOME"));
  sparkInterpreterSetting.setProperty("ZEPPELIN_CONF_DIR", zeppelin.getZeppelinConfDir().getAbsolutePath());
  sparkInterpreterSetting.setProperty("zeppelin.spark.useHiveContext", "false");
  sparkInterpreterSetting.setProperty("zeppelin.pyspark.useIPython", "false");

  testInterpreterBasics();

  // no yarn application launched
  GetApplicationsRequest request = GetApplicationsRequest.newInstance(EnumSet.of(YarnApplicationState.RUNNING));
  GetApplicationsResponse response = hadoopCluster.getYarnCluster().getResourceManager().getClientRMService().getApplications(request);
  assertEquals(0, response.getApplicationList().size());

  interpreterSettingManager.close();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:19,代码来源:SparkInterpreterModeTest.java


示例6: testYarnClientMode

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void testYarnClientMode() throws IOException, YarnException, InterruptedException, InterpreterException {
  InterpreterSetting sparkInterpreterSetting = interpreterSettingManager.getInterpreterSettingByName("spark");
  sparkInterpreterSetting.setProperty("master", "yarn-client");
  sparkInterpreterSetting.setProperty("HADOOP_CONF_DIR", hadoopCluster.getConfigPath());
  sparkInterpreterSetting.setProperty("SPARK_HOME", System.getenv("SPARK_HOME"));
  sparkInterpreterSetting.setProperty("ZEPPELIN_CONF_DIR", zeppelin.getZeppelinConfDir().getAbsolutePath());
  sparkInterpreterSetting.setProperty("zeppelin.spark.useHiveContext", "false");
  sparkInterpreterSetting.setProperty("zeppelin.pyspark.useIPython", "false");
  sparkInterpreterSetting.setProperty("PYSPARK_PYTHON", getPythonExec());
  sparkInterpreterSetting.setProperty("spark.driver.memory", "512m");

  testInterpreterBasics();

  // 1 yarn application launched
  GetApplicationsRequest request = GetApplicationsRequest.newInstance(EnumSet.of(YarnApplicationState.RUNNING));
  GetApplicationsResponse response = hadoopCluster.getYarnCluster().getResourceManager().getClientRMService().getApplications(request);
  assertEquals(1, response.getApplicationList().size());

  interpreterSettingManager.close();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:22,代码来源:SparkInterpreterModeTest.java


示例7: testYarnClusterMode

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void testYarnClusterMode() throws IOException, YarnException, InterruptedException, InterpreterException {
  InterpreterSetting sparkInterpreterSetting = interpreterSettingManager.getInterpreterSettingByName("spark");
  sparkInterpreterSetting.setProperty("master", "yarn-cluster");
  sparkInterpreterSetting.setProperty("HADOOP_CONF_DIR", hadoopCluster.getConfigPath());
  sparkInterpreterSetting.setProperty("SPARK_HOME", System.getenv("SPARK_HOME"));
  sparkInterpreterSetting.setProperty("ZEPPELIN_CONF_DIR", zeppelin.getZeppelinConfDir().getAbsolutePath());
  sparkInterpreterSetting.setProperty("zeppelin.spark.useHiveContext", "false");
  sparkInterpreterSetting.setProperty("zeppelin.pyspark.useIPython", "false");
  sparkInterpreterSetting.setProperty("spark.pyspark.python", getPythonExec());
  sparkInterpreterSetting.setProperty("spark.driver.memory", "512m");

  testInterpreterBasics();

  // 1 yarn application launched
  GetApplicationsRequest request = GetApplicationsRequest.newInstance(EnumSet.of(YarnApplicationState.RUNNING));
  GetApplicationsResponse response = hadoopCluster.getYarnCluster().getResourceManager().getClientRMService().getApplications(request);
  assertEquals(1, response.getApplicationList().size());

  interpreterSettingManager.close();
}
 
开发者ID:apache,项目名称:zeppelin,代码行数:22,代码来源:SparkInterpreterModeTest.java


示例8: 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


示例9: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Override
public GetApplicationsResponse
    getApplications(GetApplicationsRequest request) throws YarnException,
        IOException {
  GetApplicationsRequestProto requestProto =
      ((GetApplicationsRequestPBImpl) request).getProto();
  try {
    return new GetApplicationsResponsePBImpl(proxy.getApplications(null,
      requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ApplicationHistoryProtocolPBClientImpl.java


示例10: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Override
public GetApplicationsResponse getApplications(
    GetApplicationsRequest request) throws YarnException,
    IOException {
  GetApplicationsRequestProto requestProto =
      ((GetApplicationsRequestPBImpl) request).getProto();
  try {
    return new GetApplicationsResponsePBImpl(proxy.getApplications(
      null, requestProto));
  } catch (ServiceException e) {
    RPCUtil.unwrapAndThrowException(e);
    return null;
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ApplicationClientProtocolPBClientImpl.java


示例11: testAppsRace

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void testAppsRace() throws Exception {
  // mock up an RM that returns app reports for apps that don't exist
  // in the RMApps list
  ApplicationId appId = ApplicationId.newInstance(1, 1);
  ApplicationReport mockReport = mock(ApplicationReport.class);
  when(mockReport.getApplicationId()).thenReturn(appId);
  GetApplicationsResponse mockAppsResponse =
      mock(GetApplicationsResponse.class);
  when(mockAppsResponse.getApplicationList())
    .thenReturn(Arrays.asList(new ApplicationReport[] { mockReport }));
  ClientRMService mockClientSvc = mock(ClientRMService.class);
  when(mockClientSvc.getApplications(isA(GetApplicationsRequest.class),
      anyBoolean())).thenReturn(mockAppsResponse);
  ResourceManager mockRM = mock(ResourceManager.class);
  RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
      null, null, null, null, null);
  when(mockRM.getRMContext()).thenReturn(rmContext);
  when(mockRM.getClientRMService()).thenReturn(mockClientSvc);

  RMWebServices webSvc = new RMWebServices(mockRM, new Configuration(),
      mock(HttpServletResponse.class));

  final Set<String> emptySet =
      Collections.unmodifiableSet(Collections.<String>emptySet());

  // verify we don't get any apps when querying
  HttpServletRequest mockHsr = mock(HttpServletRequest.class);
  AppsInfo appsInfo = webSvc.getApps(mockHsr, null, emptySet, null,
      null, null, null, null, null, null, null, emptySet, emptySet);
  assertTrue(appsInfo.getApps().isEmpty());

  // verify we don't get an NPE when specifying a final status query
  appsInfo = webSvc.getApps(mockHsr, null, emptySet, "FAILED",
      null, null, null, null, null, null, null, emptySet, emptySet);
  assertTrue(appsInfo.getApps().isEmpty());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:38,代码来源:TestRMWebServices.java


示例12: mockClientRMService

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
public static ClientRMService mockClientRMService(RMContext rmContext) {
  ClientRMService clientRMService = mock(ClientRMService.class);
  List<ApplicationReport> appReports = new ArrayList<ApplicationReport>();
  for (RMApp app : rmContext.getRMApps().values()) {
    ApplicationReport appReport =
        ApplicationReport.newInstance(
            app.getApplicationId(), (ApplicationAttemptId) null,
            app.getUser(), app.getQueue(),
            app.getName(), (String) null, 0, (Token) null,
            app.createApplicationState(),
            app.getDiagnostics().toString(), (String) null,
            app.getStartTime(), app.getFinishTime(),
            app.getFinalApplicationStatus(),
            (ApplicationResourceUsageReport) null, app.getTrackingUrl(),
            app.getProgress(), app.getApplicationType(), (Token) null);
    appReports.add(appReport);
  }
  GetApplicationsResponse response = mock(GetApplicationsResponse.class);
  when(response.getApplicationList()).thenReturn(appReports);
  try {
    when(clientRMService.getApplications(any(GetApplicationsRequest.class)))
        .thenReturn(response);
  } catch (YarnException e) {
    Assert.fail("Exception is not expteced.");
  }
  return clientRMService;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestRMWebApp.java


示例13: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Override
public GetApplicationsResponse
    getApplications(GetApplicationsRequest request) throws YarnException,
        IOException {
  GetApplicationsResponse response =
      GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>(
        history.getAllApplications().values()));
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:ApplicationHistoryClientService.java


示例14: 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


示例15: 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


示例16: 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


示例17: getApplications

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Override
public GetApplicationsResponse getApplications(
    GetApplicationsRequest request) throws YarnException {
  resetStartFailoverFlag(true);

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

  // create GetApplicationsResponse with fake applicationList
  GetApplicationsResponse response =
      GetApplicationsResponse.newInstance(createFakeAppReports());
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:14,代码来源:ProtocolHATestBase.java


示例18: testAppsRace

import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; //导入依赖的package包/类
@Test
public void testAppsRace() throws Exception {
  // mock up an RM that returns app reports for apps that don't exist
  // in the RMApps list
  ApplicationId appId = ApplicationId.newInstance(1, 1);
  ApplicationReport mockReport = mock(ApplicationReport.class);
  when(mockReport.getApplicationId()).thenReturn(appId);
  GetApplicationsResponse mockAppsResponse =
      mock(GetApplicationsResponse.class);
  when(mockAppsResponse.getApplicationList())
    .thenReturn(Arrays.asList(new ApplicationReport[] { mockReport }));
  ClientRMService mockClientSvc = mock(ClientRMService.class);
  when(mockClientSvc.getApplications(isA(GetApplicationsRequest.class),
      anyBoolean())).thenReturn(mockAppsResponse);
  ResourceManager mockRM = mock(ResourceManager.class);
  RMContextImpl rmContext = new RMContextImpl(null, null, null, null, null,
      null, null, null, null, null);
  when(mockRM.getRMContext()).thenReturn(rmContext);
  when(mockRM.getClientRMService()).thenReturn(mockClientSvc);
  rmContext.setNodeLabelManager(mock(RMNodeLabelsManager.class));

  RMWebServices webSvc = new RMWebServices(mockRM, new Configuration(),
      mock(HttpServletResponse.class));

  final Set<String> emptySet =
      Collections.unmodifiableSet(Collections.<String>emptySet());

  // verify we don't get any apps when querying
  HttpServletRequest mockHsr = mock(HttpServletRequest.class);
  AppsInfo appsInfo = webSvc.getApps(mockHsr, null, emptySet, null,
      null, null, null, null, null, null, null, emptySet, emptySet);
  assertTrue(appsInfo.getApps().isEmpty());

  // verify we don't get an NPE when specifying a final status query
  appsInfo = webSvc.getApps(mockHsr, null, emptySet, "FAILED",
      null, null, null, null, null, null, null, emptySet, emptySet);
  assertTrue(appsInfo.getApps().isEmpty());
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:39,代码来源:TestRMWebServices.java


示例19: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InvalidRequestException类代码示例发布时间:2022-05-21
下一篇:
Java ConnectorConfig类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap