org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl Java Examples

The following examples show how to use org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GetLabelsToNodesResponsePBImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void initLabelsToNodes() {
  if (this.labelsToNodes != null) {
    return;
  }
  GetLabelsToNodesResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<LabelsToNodeIdsProto> list = p.getLabelsToNodesList();
  this.labelsToNodes = new HashMap<String, Set<NodeId>>();

  for (LabelsToNodeIdsProto c : list) {
    Set<NodeId> setNodes = new HashSet<NodeId>();
    for(NodeIdProto n : c.getNodeIdList()) {
      NodeId node = new NodeIdPBImpl(n);
      setNodes.add(node);
    }
    if(!setNodes.isEmpty()) {
      this.labelsToNodes.put(c.getNodeLabels(), setNodes);
    }
  }
}
 
Example #2
Source File: ContainerStartDataPBImpl.java    From ambari-metrics with Apache License 2.0 6 votes vote down vote up
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
 
Example #3
Source File: GetLabelsToNodesResponsePBImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void initLabelsToNodes() {
  if (this.labelsToNodes != null) {
    return;
  }
  GetLabelsToNodesResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<LabelsToNodeIdsProto> list = p.getLabelsToNodesList();
  this.labelsToNodes = new HashMap<String, Set<NodeId>>();

  for (LabelsToNodeIdsProto c : list) {
    Set<NodeId> setNodes = new HashSet<NodeId>();
    for(NodeIdProto n : c.getNodeIdList()) {
      NodeId node = new NodeIdPBImpl(n);
      setNodes.add(node);
    }
    if(!setNodes.isEmpty()) {
      this.labelsToNodes.put(c.getNodeLabels(), setNodes);
    }
  }
}
 
Example #4
Source File: ContainerStartDataPBImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
 
Example #5
Source File: ContainerStartDataPBImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private void mergeLocalToBuilder() {
  if (this.containerId != null
      && !((ContainerIdPBImpl) this.containerId).getProto().equals(
        builder.getContainerId())) {
    builder.setContainerId(convertToProtoFormat(this.containerId));
  }
  if (this.resource != null
      && !((ResourcePBImpl) this.resource).getProto().equals(
        builder.getAllocatedResource())) {
    builder.setAllocatedResource(convertToProtoFormat(this.resource));
  }
  if (this.nodeId != null
      && !((NodeIdPBImpl) this.nodeId).getProto().equals(
        builder.getAssignedNodeId())) {
    builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
  }
  if (this.priority != null
      && !((PriorityPBImpl) this.priority).getProto().equals(
        builder.getPriority())) {
    builder.setPriority(convertToProtoFormat(this.priority));
  }
}
 
Example #6
Source File: OfferLifeCycleManagerTest.java    From incubator-myriad with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
  NodeStore store = new NodeStore();
  NodeIdProto nodeId = NodeIdProto.newBuilder().setHost("localhost").setPort(8000).build();
  RMNode rmNode = new RMNodeImpl(new NodeIdPBImpl(nodeId), new MockRMContext(), "localhost", 8000, 8070, new NodeBase(),
          new ResourcePBImpl(), "1.0");
  SchedulerNode node = new FiCaSchedulerNode(rmNode, false);
  store.add(node);
  manager = new OfferLifecycleManager(store, new MyriadDriver(new MockSchedulerDriver()));
}
 
Example #7
Source File: GetNodesToLabelsResponsePBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void initNodeToLabels() {
  if (this.nodeToLabels != null) {
    return;
  }
  GetNodesToLabelsResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<NodeIdToLabelsProto> list = p.getNodeToLabelsList();
  this.nodeToLabels = new HashMap<NodeId, Set<String>>();

  for (NodeIdToLabelsProto c : list) {
    this.nodeToLabels.put(new NodeIdPBImpl(c.getNodeId()),
        Sets.newHashSet(c.getNodeLabelsList()));
  }
}
 
Example #8
Source File: NMTokenIdentifier.java    From big-c with Apache License 2.0 5 votes vote down vote up
public NMTokenIdentifier(ApplicationAttemptId appAttemptId, 
    NodeId nodeId, String applicationSubmitter, int masterKeyId) {
  NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  if (nodeId != null) {
    builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
  }
  builder.setAppSubmitter(applicationSubmitter);
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
 
Example #9
Source File: ReplaceLabelsOnNodeRequestPBImpl.java    From big-c with Apache License 2.0 5 votes vote down vote up
private void initNodeToLabels() {
  if (this.nodeIdToLabels != null) {
    return;
  }
  ReplaceLabelsOnNodeRequestProtoOrBuilder p = viaProto ? proto : builder;
  List<NodeIdToLabelsProto> list = p.getNodeToLabelsList();
  this.nodeIdToLabels = new HashMap<NodeId, Set<String>>();

  for (NodeIdToLabelsProto c : list) {
    this.nodeIdToLabels.put(new NodeIdPBImpl(c.getNodeId()),
        Sets.newHashSet(c.getNodeLabelsList()));
  }
}
 
Example #10
Source File: ReplaceLabelsOnNodeRequestPBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void initNodeToLabels() {
  if (this.nodeIdToLabels != null) {
    return;
  }
  ReplaceLabelsOnNodeRequestProtoOrBuilder p = viaProto ? proto : builder;
  List<NodeIdToLabelsProto> list = p.getNodeToLabelsList();
  this.nodeIdToLabels = new HashMap<NodeId, Set<String>>();

  for (NodeIdToLabelsProto c : list) {
    this.nodeIdToLabels.put(new NodeIdPBImpl(c.getNodeId()),
        Sets.newHashSet(c.getNodeLabelsList()));
  }
}
 
Example #11
Source File: GetNodesToLabelsResponsePBImpl.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private void initNodeToLabels() {
  if (this.nodeToLabels != null) {
    return;
  }
  GetNodesToLabelsResponseProtoOrBuilder p = viaProto ? proto : builder;
  List<NodeIdToLabelsProto> list = p.getNodeToLabelsList();
  this.nodeToLabels = new HashMap<NodeId, Set<String>>();

  for (NodeIdToLabelsProto c : list) {
    this.nodeToLabels.put(new NodeIdPBImpl(c.getNodeId()),
        Sets.newHashSet(c.getNodeLabelsList()));
  }
}
 
Example #12
Source File: NMTokenIdentifier.java    From hadoop with Apache License 2.0 5 votes vote down vote up
public NMTokenIdentifier(ApplicationAttemptId appAttemptId, 
    NodeId nodeId, String applicationSubmitter, int masterKeyId) {
  NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
  if (appAttemptId != null) {
    builder.setAppAttemptId(
        ((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
  }
  if (nodeId != null) {
    builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
  }
  builder.setAppSubmitter(applicationSubmitter);
  builder.setKeyId(masterKeyId);
  proto = builder.build();
}
 
Example #13
Source File: NodeStatusPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeId convertFromProtoFormat(NodeIdProto proto) {
  return new NodeIdPBImpl(proto);
}
 
Example #14
Source File: NodeStatusPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId nodeId) {
  return ((NodeIdPBImpl)nodeId).getProto();
}
 
Example #15
Source File: RegisterNodeManagerRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId t) {
  return ((NodeIdPBImpl)t).getProto();
}
 
Example #16
Source File: RegisterNodeManagerRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdPBImpl convertFromProtoFormat(NodeIdProto p) {
  return new NodeIdPBImpl(p);
}
 
Example #17
Source File: UpdateNodeResourceRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeId convertFromProtoFormat(NodeIdProto proto) {
  return new NodeIdPBImpl(proto);
}
 
Example #18
Source File: UpdateNodeResourceRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId nodeId) {
  return ((NodeIdPBImpl)nodeId).getProto();
}
 
Example #19
Source File: ReplaceLabelsOnNodeRequestPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId t) {
  return ((NodeIdPBImpl) t).getProto();
}
 
Example #20
Source File: NMTokenIdentifierNewForTest.java    From big-c with Apache License 2.0 4 votes vote down vote up
public NodeId getNodeId() {
  return new NodeIdPBImpl(proto.getNodeId());
}
 
Example #21
Source File: GetNodesToLabelsResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId t) {
  return ((NodeIdPBImpl)t).getProto();
}
 
Example #22
Source File: ContainerStartDataPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId nodeId) {
  return ((NodeIdPBImpl) nodeId).getProto();
}
 
Example #23
Source File: ContainerStartDataPBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdPBImpl convertFromProtoFormat(NodeIdProto nodeId) {
  return new NodeIdPBImpl(nodeId);
}
 
Example #24
Source File: ContainerStartDataPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeIdPBImpl convertFromProtoFormat(NodeIdProto nodeId) {
  return new NodeIdPBImpl(nodeId);
}
 
Example #25
Source File: GetLabelsToNodesResponsePBImpl.java    From big-c with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId t) {
  return ((NodeIdPBImpl)t).getProto();
}
 
Example #26
Source File: NMTokenIdentifier.java    From big-c with Apache License 2.0 4 votes vote down vote up
public NodeId getNodeId() {
  if (!proto.hasNodeId()) {
    return null;
  }
  return new NodeIdPBImpl(proto.getNodeId());
}
 
Example #27
Source File: ContainerStartDataPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId nodeId) {
  return ((NodeIdPBImpl) nodeId).getProto();
}
 
Example #28
Source File: NMTokenIdentifierNewForTest.java    From hadoop with Apache License 2.0 4 votes vote down vote up
public NodeId getNodeId() {
  return new NodeIdPBImpl(proto.getNodeId());
}
 
Example #29
Source File: NodeStatusPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeId convertFromProtoFormat(NodeIdProto proto) {
  return new NodeIdPBImpl(proto);
}
 
Example #30
Source File: NodeStatusPBImpl.java    From hadoop with Apache License 2.0 4 votes vote down vote up
private NodeIdProto convertToProtoFormat(NodeId nodeId) {
  return ((NodeIdPBImpl)nodeId).getProto();
}