Search in sources :

Example 1 with NodeIdToLabelsProto

use of org.apache.hadoop.yarn.proto.YarnProtos.NodeIdToLabelsProto 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 2 with NodeIdToLabelsProto

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

Aggregations

Set (java.util.Set)2 NodeId (org.apache.hadoop.yarn.api.records.NodeId)2 NodeIdPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl)2 NodeIdToLabelsProto (org.apache.hadoop.yarn.proto.YarnProtos.NodeIdToLabelsProto)2 HashSet (java.util.HashSet)1 ReplaceLabelsOnNodeRequestProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceLabelsOnNodeRequestProtoOrBuilder)1 GetNodesToLabelsResponseProtoOrBuilder (org.apache.hadoop.yarn.proto.YarnServiceProtos.GetNodesToLabelsResponseProtoOrBuilder)1