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


Java GetClusterMetricsResponse类代码示例

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


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

示例1: getClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public GetClusterMetricsResponse getClusterMetrics(
    GetClusterMetricsRequest request) throws YarnException {
  GetClusterMetricsResponse response = recordFactory
      .newRecordInstance(GetClusterMetricsResponse.class);
  YarnClusterMetrics ymetrics = recordFactory
      .newRecordInstance(YarnClusterMetrics.class);
  ymetrics.setNumNodeManagers(this.rmContext.getRMNodes().size());
  ClusterMetrics clusterMetrics = ClusterMetrics.getMetrics();
  ymetrics.setNumDecommissionedNodeManagers(clusterMetrics
    .getNumDecommisionedNMs());
  ymetrics.setNumActiveNodeManagers(clusterMetrics.getNumActiveNMs());
  ymetrics.setNumLostNodeManagers(clusterMetrics.getNumLostNMs());
  ymetrics.setNumUnhealthyNodeManagers(clusterMetrics.getUnhealthyNMs());
  ymetrics.setNumRebootedNodeManagers(clusterMetrics.getNumRebootedNMs());
  response.setClusterMetrics(ymetrics);
  return response;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:19,代码来源:ClientRMService.java

示例2: getClusterMetrics

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

示例3: getClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public GetClusterMetricsResponse getClusterMetrics(
    GetClusterMetricsRequest request) throws YarnException {
  GetClusterMetricsResponse response = recordFactory
      .newRecordInstance(GetClusterMetricsResponse.class);
  YarnClusterMetrics ymetrics = recordFactory
      .newRecordInstance(YarnClusterMetrics.class);
  ymetrics.setNumNodeManagers(this.rmContext.getRMNodes().size());
  response.setClusterMetrics(ymetrics);
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:ClientRMService.java

示例4: getYarnClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public YarnClusterMetrics getYarnClusterMetrics() throws YarnException,
    IOException {
  GetClusterMetricsRequest request =
      Records.newRecord(GetClusterMetricsRequest.class);
  GetClusterMetricsResponse response = rmClient.getClusterMetrics(request);
  return response.getClusterMetrics();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:YarnClientImpl.java

示例5: getClusterMetrics

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

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

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

示例6: testResourceMgrDelegate

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Test(timeout=20000)
public void testResourceMgrDelegate() throws Exception {
  /* we not want a mock of resource mgr delegate */
  final ApplicationClientProtocol clientRMProtocol = mock(ApplicationClientProtocol.class);
  ResourceMgrDelegate delegate = new ResourceMgrDelegate(conf) {
    @Override
    protected void serviceStart() throws Exception {
      assertTrue(this.client instanceof YarnClientImpl);
      ((YarnClientImpl) this.client).setRMClient(clientRMProtocol);
    }
  };
  /* make sure kill calls finish application master */
  when(clientRMProtocol.forceKillApplication(any(KillApplicationRequest.class)))
  .thenReturn(KillApplicationResponse.newInstance(true));
  delegate.killApplication(appId);
  verify(clientRMProtocol).forceKillApplication(any(KillApplicationRequest.class));

  /* make sure getalljobs calls get all applications */
  when(clientRMProtocol.getApplications(any(GetApplicationsRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetApplicationsResponse.class));
  delegate.getAllJobs();
  verify(clientRMProtocol).getApplications(any(GetApplicationsRequest.class));

  /* make sure getapplication report is called */
  when(clientRMProtocol.getApplicationReport(any(GetApplicationReportRequest.class)))
  .thenReturn(recordFactory.newRecordInstance(GetApplicationReportResponse.class));
  delegate.getApplicationReport(appId);
  verify(clientRMProtocol).getApplicationReport(any(GetApplicationReportRequest.class));

  /* make sure metrics is called */
  GetClusterMetricsResponse clusterMetricsResponse = recordFactory.newRecordInstance
      (GetClusterMetricsResponse.class);
  clusterMetricsResponse.setClusterMetrics(recordFactory.newRecordInstance(
      YarnClusterMetrics.class));
  when(clientRMProtocol.getClusterMetrics(any(GetClusterMetricsRequest.class)))
  .thenReturn(clusterMetricsResponse);
  delegate.getClusterMetrics();
  verify(clientRMProtocol).getClusterMetrics(any(GetClusterMetricsRequest.class));

  when(clientRMProtocol.getClusterNodes(any(GetClusterNodesRequest.class))).
  thenReturn(recordFactory.newRecordInstance(GetClusterNodesResponse.class));
  delegate.getActiveTrackers();
  verify(clientRMProtocol).getClusterNodes(any(GetClusterNodesRequest.class));
  
  GetNewApplicationResponse newAppResponse = recordFactory.newRecordInstance(
      GetNewApplicationResponse.class);
  newAppResponse.setApplicationId(appId);
  when(clientRMProtocol.getNewApplication(any(GetNewApplicationRequest.class))).
  thenReturn(newAppResponse);
  delegate.getNewJobID();
  verify(clientRMProtocol).getNewApplication(any(GetNewApplicationRequest.class));
  
  GetQueueInfoResponse queueInfoResponse = recordFactory.newRecordInstance(
      GetQueueInfoResponse.class);
  queueInfoResponse.setQueueInfo(recordFactory.newRecordInstance(QueueInfo.class));
  when(clientRMProtocol.getQueueInfo(any(GetQueueInfoRequest.class))).
  thenReturn(queueInfoResponse);
  delegate.getQueues();
  verify(clientRMProtocol).getQueueInfo(any(GetQueueInfoRequest.class));

  GetQueueUserAclsInfoResponse aclResponse = recordFactory.newRecordInstance(
      GetQueueUserAclsInfoResponse.class);
  when(clientRMProtocol.getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class)))
  .thenReturn(aclResponse);
  delegate.getQueueAclsForCurrentUser();
  verify(clientRMProtocol).getQueueUserAcls(any(GetQueueUserAclsInfoRequest.class));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:68,代码来源:TestYARNRunner.java

示例7: getClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public GetClusterMetricsResponse getClusterMetrics(
    GetClusterMetricsRequest request) throws IOException {
  return null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:6,代码来源:TestClientRedirect.java

示例8: getClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public GetClusterMetricsResponse getClusterMetrics(
    GetClusterMetricsRequest request) throws YarnException, IOException {
  YarnClusterMetrics clusterMetrics = appClient.getClusterMetrics();
  return GetClusterMetricsResponse.newInstance(clusterMetrics);
}
 
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:7,代码来源:HPCApplicationClientProtocolImpl.java

示例9: getClusterMetrics

import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; //导入依赖的package包/类
@Override
public GetClusterMetricsResponse getClusterMetrics(
    GetClusterMetricsRequest request) throws YarnException, IOException {
  throw new NotImplementedException();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:6,代码来源:MockResourceManagerFacade.java


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