Search in sources :

Example 1 with NodeIdPBImpl

use of org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl in project hadoop by apache.

the class GetLabelsToNodesResponsePBImpl method initLabelsToNodes.

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);
        }
    }
}
Also used : GetLabelsToNodesResponseProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServiceProtos.GetLabelsToNodesResponseProtoOrBuilder) Set(java.util.Set) HashSet(java.util.HashSet) NodeId(org.apache.hadoop.yarn.api.records.NodeId) NodeIdPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl) NodeIdProto(org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto) LabelsToNodeIdsProto(org.apache.hadoop.yarn.proto.YarnProtos.LabelsToNodeIdsProto) HashSet(java.util.HashSet)

Example 2 with NodeIdPBImpl

use of org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl in project hadoop by apache.

the class GetNodesToLabelsResponsePBImpl method initNodeToLabels.

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()));
    }
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) GetNodesToLabelsResponseProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServiceProtos.GetNodesToLabelsResponseProtoOrBuilder) NodeId(org.apache.hadoop.yarn.api.records.NodeId) NodeIdPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl) NodeIdToLabelsProto(org.apache.hadoop.yarn.proto.YarnProtos.NodeIdToLabelsProto)

Example 3 with NodeIdPBImpl

use of org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl in project hadoop by apache.

the class ReplaceLabelsOnNodeRequestPBImpl method initNodeToLabels.

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()));
    }
}
Also used : ReplaceLabelsOnNodeRequestProtoOrBuilder(org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceLabelsOnNodeRequestProtoOrBuilder) Set(java.util.Set) NodeId(org.apache.hadoop.yarn.api.records.NodeId) NodeIdPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl) NodeIdToLabelsProto(org.apache.hadoop.yarn.proto.YarnProtos.NodeIdToLabelsProto)

Example 4 with NodeIdPBImpl

use of org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl in project incubator-myriad by apache.

the class OfferLifeCycleManagerTest method setUp.

@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()));
}
Also used : MyriadDriver(org.apache.myriad.scheduler.MyriadDriver) MockRMContext(org.apache.myriad.state.MockRMContext) FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode) SchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode) FiCaSchedulerNode(org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode) NodeIdPBImpl(org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl) NodeIdProto(org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto) ResourcePBImpl(org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl) NodeBase(org.apache.hadoop.net.NodeBase) RMNode(org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode) RMNodeImpl(org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl) MockSchedulerDriver(org.apache.myriad.scheduler.MockSchedulerDriver) Before(org.junit.Before)

Aggregations

NodeIdPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl)4 Set (java.util.Set)3 NodeId (org.apache.hadoop.yarn.api.records.NodeId)3 HashSet (java.util.HashSet)2 NodeIdProto (org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto)2 NodeIdToLabelsProto (org.apache.hadoop.yarn.proto.YarnProtos.NodeIdToLabelsProto)2 NodeBase (org.apache.hadoop.net.NodeBase)1 ResourcePBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl)1 LabelsToNodeIdsProto (org.apache.hadoop.yarn.proto.YarnProtos.LabelsToNodeIdsProto)1 ReplaceLabelsOnNodeRequestProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceLabelsOnNodeRequestProtoOrBuilder)1 GetLabelsToNodesResponseProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.GetLabelsToNodesResponseProtoOrBuilder)1 GetNodesToLabelsResponseProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.GetNodesToLabelsResponseProtoOrBuilder)1 RMNode (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode)1 RMNodeImpl (org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl)1 SchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNode)1 FiCaSchedulerNode (org.apache.hadoop.yarn.server.resourcemanager.scheduler.common.fica.FiCaSchedulerNode)1 MockSchedulerDriver (org.apache.myriad.scheduler.MockSchedulerDriver)1 MyriadDriver (org.apache.myriad.scheduler.MyriadDriver)1 MockRMContext (org.apache.myriad.state.MockRMContext)1 Before (org.junit.Before)1