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); } } }
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)); } }
private void initLabelsToNodes() { if (this.labelsToNodes != null) { return; } GetLabelsToNodesResponseProtoOrBuilder p = viaProto ? proto : builder; List<LabelsToNodeIdsProto> list = p.getLabelsToNodesList(); this.labelsToNodes = new HashMap<NodeLabel, 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(new NodeLabelPBImpl(c.getNodeLabels()), setNodes); } } }
private void initNodeToLabels() { if (this.nodeToLabels != null) { return; } GetNodesToLabelsResponseProtoOrBuilder p = viaProto ? proto : builder; List<NodeIdToLabelsInfoProto> list = p.getNodeToLabelsList(); this.nodeToLabels = new HashMap<NodeId, Set<NodeLabel>>(); for (NodeIdToLabelsInfoProto c : list) { Set<NodeLabel> labels = new HashSet<NodeLabel>(); for (NodeLabelProto l : c.getNodeLabelsList()) { labels.add(new NodeLabelPBImpl(l)); } this.nodeToLabels.put(new NodeIdPBImpl(c.getNodeId()), labels); } }
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); } } }
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(); }
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())); } }
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())); } }
private void initNodeToLabels() { if (this.nodeIdToLabels != null) { return; } ReplaceLabelsOnNodeRequestProtoOrBuilder p = viaProto ? proto : builder; List<NodeIdToLabelsNameProto> list = p.getNodeToLabelsList(); this.nodeIdToLabels = new HashMap<NodeId, Set<String>>(); for (NodeIdToLabelsNameProto c : list) { this.nodeIdToLabels.put(new NodeIdPBImpl(c.getNodeId()), Sets.newHashSet(c.getNodeLabelsList())); } }
@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())); }
public NodeId getNodeId() { if (!proto.hasNodeId()) { return null; } return new NodeIdPBImpl(proto.getNodeId()); }
private NodeIdProto convertToProtoFormat(NodeId t) { return ((NodeIdPBImpl)t).getProto(); }
private NodeIdProto convertToProtoFormat(NodeId t) { return ((NodeIdPBImpl) t).getProto(); }
private NodeIdProto convertToProtoFormat(NodeId nodeId) { return ((NodeIdPBImpl)nodeId).getProto(); }
private NodeId convertFromProtoFormat(NodeIdProto proto) { return new NodeIdPBImpl(proto); }
private NodeIdPBImpl convertFromProtoFormat(NodeIdProto p) { return new NodeIdPBImpl(p); }
public NodeId getNodeId() { return new NodeIdPBImpl(proto.getNodeId()); }
private NodeIdProto convertToProtoFormat(NodeId nodeId) { return ((NodeIdPBImpl) nodeId).getProto(); }
private NodeIdPBImpl convertFromProtoFormat(NodeIdProto nodeId) { return new NodeIdPBImpl(nodeId); }