Search in sources :

Example 1 with GetLabelsToNodesResponseProtoOrBuilder

use of org.apache.hadoop.yarn.proto.YarnServiceProtos.GetLabelsToNodesResponseProtoOrBuilder 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)

Aggregations

HashSet (java.util.HashSet)1 Set (java.util.Set)1 NodeId (org.apache.hadoop.yarn.api.records.NodeId)1 NodeIdPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl)1 LabelsToNodeIdsProto (org.apache.hadoop.yarn.proto.YarnProtos.LabelsToNodeIdsProto)1 NodeIdProto (org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto)1 GetLabelsToNodesResponseProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.GetLabelsToNodesResponseProtoOrBuilder)1