|
@@ -27,6 +27,8 @@ import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb
|
|
.AddToClusterNodeLabelsRequestPBImpl;
|
|
.AddToClusterNodeLabelsRequestPBImpl;
|
|
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb
|
|
import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb
|
|
.ReplaceLabelsOnNodeRequestPBImpl;
|
|
.ReplaceLabelsOnNodeRequestPBImpl;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
@@ -40,6 +42,8 @@ import java.util.Set;
|
|
*/
|
|
*/
|
|
public class NodeLabelMirrorOp
|
|
public class NodeLabelMirrorOp
|
|
extends FSNodeStoreLogOp<CommonNodeLabelsManager> {
|
|
extends FSNodeStoreLogOp<CommonNodeLabelsManager> {
|
|
|
|
+ private static final Logger LOG = LoggerFactory.getLogger(
|
|
|
|
+ NodeLabelMirrorOp.class);
|
|
|
|
|
|
public NodeLabelMirrorOp() {
|
|
public NodeLabelMirrorOp() {
|
|
super();
|
|
super();
|
|
@@ -66,15 +70,20 @@ public class NodeLabelMirrorOp
|
|
.parseDelimitedFrom(is)).getNodeLabels();
|
|
.parseDelimitedFrom(is)).getNodeLabels();
|
|
mgr.addToCluserNodeLabels(labels);
|
|
mgr.addToCluserNodeLabels(labels);
|
|
|
|
|
|
- if (mgr.isCentralizedConfiguration()) {
|
|
|
|
- // Only load node to labels mapping while using centralized
|
|
|
|
- // configuration
|
|
|
|
- Map<NodeId, Set<String>> nodeToLabels =
|
|
|
|
- new ReplaceLabelsOnNodeRequestPBImpl(
|
|
|
|
- YarnServerResourceManagerServiceProtos
|
|
|
|
- .ReplaceLabelsOnNodeRequestProto
|
|
|
|
- .parseDelimitedFrom(is)).getNodeToLabels();
|
|
|
|
- mgr.replaceLabelsOnNode(nodeToLabels);
|
|
|
|
|
|
+ try {
|
|
|
|
+ if (mgr.isCentralizedConfiguration() && is.available() != 0) {
|
|
|
|
+ // Only load node to labels mapping while using centralized
|
|
|
|
+ // configuration
|
|
|
|
+ Map<NodeId, Set<String>> nodeToLabels =
|
|
|
|
+ new ReplaceLabelsOnNodeRequestPBImpl(
|
|
|
|
+ YarnServerResourceManagerServiceProtos
|
|
|
|
+ .ReplaceLabelsOnNodeRequestProto
|
|
|
|
+ .parseDelimitedFrom(is)).getNodeToLabels();
|
|
|
|
+ mgr.replaceLabelsOnNode(nodeToLabels);
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ LOG.error("Errors on loading node to labels mapping while using "
|
|
|
|
+ + "centralized configuration", e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|