Java 类org.apache.hadoop.yarn.api.protocolrecords.GetNodesToLabelsResponse 实例源码

项目:hadoop    文件:ApplicationClientProtocolPBClientImpl.java   
@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;
  }
}
项目:hadoop    文件:ClientRMService.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabels());
  return response;
}
项目:aliyun-oss-hadoop-fs    文件:ApplicationClientProtocolPBClientImpl.java   
@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;
  }
}
项目:aliyun-oss-hadoop-fs    文件:ClientRMService.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabelsInfo());
  return response;
}
项目:big-c    文件:ApplicationClientProtocolPBClientImpl.java   
@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;
  }
}
项目:big-c    文件:ClientRMService.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabels());
  return response;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationClientProtocolPBClientImpl.java   
@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;
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ClientRMService.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabels());
  return response;
}
项目:hops    文件:ApplicationClientProtocolPBClientImpl.java   
@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;
  }
}
项目:hops    文件:ClientRMService.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  RMNodeLabelsManager labelsMgr = rmContext.getNodeLabelManager();
  GetNodesToLabelsResponse response =
      GetNodesToLabelsResponse.newInstance(labelsMgr.getNodeLabels());
  return response;
}
项目:hadoop    文件:TestClientRMService.java   
@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();
}
项目:hadoop    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:scheduling-connector-for-hadoop    文件:HPCApplicationClientProtocolImpl.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(GetNodesToLabelsRequest arg0)
        throws YarnException, IOException {
    // TODO Auto-generated method stub
    return null;
}
项目:aliyun-oss-hadoop-fs    文件:MockResourceManagerFacade.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  throw new NotImplementedException();
}
项目:aliyun-oss-hadoop-fs    文件:TestClientRMService.java   
@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();
}
项目:aliyun-oss-hadoop-fs    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:big-c    文件:TestClientRMService.java   
@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();
}
项目:big-c    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientRMService.java   
@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();
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:FlexMap    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:hops    文件:MockResourceManagerFacade.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  throw new NotImplementedException();
}
项目:hops    文件:TestClientRMService.java   
@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();
}
项目:hops    文件:TestClientRedirect.java   
@Override
public GetNodesToLabelsResponse getNodeToLabels(
    GetNodesToLabelsRequest request) throws YarnException, IOException {
  return null;
}
项目:hadoop    文件:ApplicationClientProtocol.java   
/**
 * <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;
项目:aliyun-oss-hadoop-fs    文件:ApplicationClientProtocol.java   
/**
 * <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;
项目:big-c    文件:ApplicationClientProtocol.java   
/**
 * <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;
项目:hadoop-2.6.0-cdh5.4.3    文件:ApplicationClientProtocol.java   
/**
 * <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;
项目:hops    文件:ApplicationClientProtocol.java   
/**
 * <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;