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

Java GetNodesToLabelsRequest类代码示例

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

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



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

示例1: getNodeToLabels

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


示例2: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabels());
  return response;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:ClientRMService.java


示例3: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabelsInfo());
  return response;
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:ClientRMService.java


示例4: testGetNodeLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Test
public void testGetNodeLabels() throws Exception {
  MockRM rm = new MockRM() {
    protected ClientRMService createClientRMService() {
      return new ClientRMService(this.rmContext, scheduler,
          this.rmAppManager, this.applicationACLsManager,
          this.queueACLsManager, this.getRMContext()
              .getRMDelegationTokenSecretManager());
    };
  };
  rm.start();
  RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager();
  labelsMgr.addToCluserNodeLabels(ImmutableSet.of("x", "y"));

  Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>();
  map.put(NodeId.newInstance("host1", 0), ImmutableSet.of("x"));
  map.put(NodeId.newInstance("host2", 0), ImmutableSet.of("y"));
  labelsMgr.replaceLabelsOnNode(map);

  // Create a client.
  Configuration conf = new Configuration();
  YarnRPC rpc = YarnRPC.create(conf);
  InetSocketAddress rmAddress = rm.getClientRMService().getBindAddress();
  LOG.info("Connecting to ResourceManager at " + rmAddress);
  ApplicationClientProtocol client =
      (ApplicationClientProtocol) rpc.getProxy(
          ApplicationClientProtocol.class, rmAddress, conf);

  // Get node labels collection
  GetClusterNodeLabelsResponse response =
      client.getClusterNodeLabels(GetClusterNodeLabelsRequest.newInstance());
  Assert.assertTrue(response.getNodeLabels().containsAll(
      Arrays.asList("x", "y")));

  // Get node labels mapping
  GetNodesToLabelsResponse response1 =
      client.getNodeToLabels(GetNodesToLabelsRequest.newInstance());
  Map<NodeId, Set<String>> nodeToLabels = response1.getNodeToLabels();
  Assert.assertTrue(nodeToLabels.keySet().containsAll(
      Arrays.asList(NodeId.newInstance("host1", 0),
          NodeId.newInstance("host2", 0))));
  Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host1", 0))
      .containsAll(Arrays.asList("x")));
  Assert.assertTrue(nodeToLabels.get(NodeId.newInstance("host2", 0))
      .containsAll(Arrays.asList("y")));
  
  rpc.stopProxy(client, conf);
  rm.close();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:50,代码来源:TestClientRMService.java


示例5: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public Map<NodeId, Set<String>> getNodeToLabels() throws YarnException,
    IOException {
  return rmClient.getNodeToLabels(GetNodesToLabelsRequest.newInstance())
      .getNodeToLabels();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:7,代码来源:YarnClientImpl.java


示例6: getNodeToLabels

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


示例7: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public GetNodesToLabelsResponse getNodeToLabels(GetNodesToLabelsRequest arg0)
		throws YarnException, IOException {
	// TODO Auto-generated method stub
	return null;
}
 
开发者ID:intel-hpdd,项目名称:scheduling-connector-for-hadoop,代码行数:7,代码来源:HPCApplicationClientProtocolImpl.java


示例8: getNodeToLabels

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


示例9: testGetNodeLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Test
public void testGetNodeLabels() throws Exception {
  MockRM rm = new MockRM() {
    protected ClientRMService createClientRMService() {
      return new ClientRMService(this.rmContext, scheduler,
          this.rmAppManager, this.applicationACLsManager,
          this.queueACLsManager, this.getRMContext()
              .getRMDelegationTokenSecretManager());
    };
  };
  rm.start();
  NodeLabel labelX = NodeLabel.newInstance("x", false);
  NodeLabel labelY = NodeLabel.newInstance("y");
  RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager();
  labelsMgr.addToCluserNodeLabels(ImmutableSet.of(labelX, labelY));

  NodeId node1 = NodeId.newInstance("host1", 1234);
  NodeId node2 = NodeId.newInstance("host2", 1234);
  Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>();
  map.put(node1, ImmutableSet.of("x"));
  map.put(node2, ImmutableSet.of("y"));
  labelsMgr.replaceLabelsOnNode(map);

  // Create a client.
  Configuration conf = new Configuration();
  YarnRPC rpc = YarnRPC.create(conf);
  InetSocketAddress rmAddress = rm.getClientRMService().getBindAddress();
  LOG.info("Connecting to ResourceManager at " + rmAddress);
  ApplicationClientProtocol client = (ApplicationClientProtocol) rpc
      .getProxy(ApplicationClientProtocol.class, rmAddress, conf);

  // Get node labels collection
  GetClusterNodeLabelsResponse response = client
      .getClusterNodeLabels(GetClusterNodeLabelsRequest.newInstance());
  Assert.assertTrue(response.getNodeLabels().containsAll(
      Arrays.asList(labelX, labelY)));

  // Get node labels mapping
  GetNodesToLabelsResponse response1 = client
      .getNodeToLabels(GetNodesToLabelsRequest.newInstance());
  Map<NodeId, Set<NodeLabel>> nodeToLabels = response1.getNodeToLabels();
  Assert.assertTrue(nodeToLabels.keySet().containsAll(
      Arrays.asList(node1, node2)));
  Assert.assertTrue(nodeToLabels.get(node1)
      .containsAll(Arrays.asList(labelX)));
  Assert.assertTrue(nodeToLabels.get(node2)
      .containsAll(Arrays.asList(labelY)));
  // Verify whether labelX's exclusivity is false
  for (NodeLabel x : nodeToLabels.get(node1)) {
    Assert.assertFalse(x.isExclusive());
  }
  // Verify whether labelY's exclusivity is true
  for (NodeLabel y : nodeToLabels.get(node2)) {
    Assert.assertTrue(y.isExclusive());
  }
  // Below label "x" is not present in the response as exclusivity is true
  Assert.assertFalse(nodeToLabels.get(node1).containsAll(
      Arrays.asList(NodeLabel.newInstance("x"))));

  rpc.stopProxy(client, conf);
  rm.close();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:63,代码来源:TestClientRMService.java


示例10: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public Map<NodeId, Set<NodeLabel>> getNodeToLabels() throws YarnException,
    IOException {
  return rmClient.getNodeToLabels(GetNodesToLabelsRequest.newInstance())
      .getNodeToLabels();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:7,代码来源:YarnClientImpl.java


示例11: testGetNodeLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Test
public void testGetNodeLabels() throws Exception {
  MockRM rm = new MockRM() {
    protected ClientRMService createClientRMService() {
      return new ClientRMService(this.rmContext, scheduler,
          this.rmAppManager, this.applicationACLsManager,
          this.queueACLsManager, this.getRMContext()
              .getRMDelegationTokenSecretManager());
    };
  };
  rm.start();
  NodeLabel labelX = NodeLabel.newInstance("x", false);
  NodeLabel labelY = NodeLabel.newInstance("y");
  RMNodeLabelsManager labelsMgr = rm.getRMContext().getNodeLabelManager();
  labelsMgr.addToCluserNodeLabels(ImmutableSet.of(labelX, labelY));

  NodeId node1 = NodeId.newInstance("host1", 1234);
  NodeId node2 = NodeId.newInstance("host2", 1234);
  Map<NodeId, Set<String>> map = new HashMap<NodeId, Set<String>>();
  map.put(node1, ImmutableSet.of("x"));
  map.put(node2, ImmutableSet.of("y"));
  labelsMgr.replaceLabelsOnNode(map);

  // Create a client.
  Configuration conf = new Configuration();
  YarnRPC rpc = YarnRPC.create(conf);
  InetSocketAddress rmAddress = rm.getClientRMService().getBindAddress();
  LOG.info("Connecting to ResourceManager at " + rmAddress);
  ApplicationClientProtocol client = (ApplicationClientProtocol) rpc
      .getProxy(ApplicationClientProtocol.class, rmAddress, conf);

  // Get node labels collection
  GetClusterNodeLabelsResponse response = client
      .getClusterNodeLabels(GetClusterNodeLabelsRequest.newInstance());
  Assert.assertTrue(response.getNodeLabelList().containsAll(
      Arrays.asList(labelX, labelY)));

  // Get node labels mapping
  GetNodesToLabelsResponse response1 = client
      .getNodeToLabels(GetNodesToLabelsRequest.newInstance());
  Map<NodeId, Set<String>> nodeToLabels = response1.getNodeToLabels();
  Assert.assertTrue(nodeToLabels.keySet().containsAll(
      Arrays.asList(node1, node2)));
  Assert.assertTrue(nodeToLabels.get(node1)
      .containsAll(Arrays.asList(labelX.getName())));
  Assert.assertTrue(nodeToLabels.get(node2)
      .containsAll(Arrays.asList(labelY.getName())));
  // Below label "x" is not present in the response as exclusivity is true
  Assert.assertFalse(nodeToLabels.get(node1).containsAll(
      Arrays.asList(NodeLabel.newInstance("x"))));

  rpc.stopProxy(client, conf);
  rm.stop();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:55,代码来源:TestClientRMService.java


示例12: start

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
@Override
public void start() {
  rmClient = mock(ApplicationClientProtocol.class);
  GetApplicationReportResponse mockResponse =
      mock(GetApplicationReportResponse.class);
  mockReport = mock(ApplicationReport.class);
  try{
    when(rmClient.getApplicationReport(any(
        GetApplicationReportRequest.class))).thenReturn(mockResponse);
    when(rmClient.getApplications(any(GetApplicationsRequest.class)))
        .thenReturn(mockAppResponse);
    // return false for 1st kill request, and true for the 2nd.
    when(rmClient.forceKillApplication(any(
      KillApplicationRequest.class)))
      .thenReturn(KillApplicationResponse.newInstance(false)).thenReturn(
        KillApplicationResponse.newInstance(true));
    when(
        rmClient
            .getApplicationAttemptReport(any(GetApplicationAttemptReportRequest.class)))
        .thenReturn(mockAttemptResponse);
    when(
        rmClient
            .getApplicationAttempts(any(GetApplicationAttemptsRequest.class)))
        .thenReturn(mockAppAttemptsResponse);
    when(rmClient.getContainers(any(GetContainersRequest.class)))
        .thenReturn(mockContainersResponse);

    when(rmClient.getContainerReport(any(GetContainerReportRequest.class)))
        .thenReturn(mockContainerResponse);

    when(rmClient.getLabelsToNodes(any(GetLabelsToNodesRequest.class)))
        .thenReturn(mockLabelsToNodesResponse);
    
    when(rmClient.getNodeToLabels(any(GetNodesToLabelsRequest.class)))
        .thenReturn(mockNodeToLabelsResponse);

    historyClient = mock(AHSClient.class);

  } catch (Exception e) {
    Assert.fail("Unexpected exception caught: " + e);
  }

  when(mockResponse.getApplicationReport()).thenReturn(mockReport);
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:45,代码来源:TestYarnClient.java


示例13: getNodeToLabels

import org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsRequest; //导入依赖的package包/类
/**
 * <p>
 * The interface used by client to get node to labels mappings in existing cluster
 * </p>
 *
 * @param request
 * @return node to labels mappings
 * @throws YarnException
 * @throws IOException
 */
@Public
@Unstable
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException;
 
开发者ID:naver,项目名称:hadoop,代码行数:15,代码来源:ApplicationClientProtocol.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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