|
@@ -42,12 +42,15 @@ import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.LogAggregation
|
|
|
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NMContainerStatusProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeLabelsProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.NodeLabelsProto.Builder;
|
|
|
+import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.OverAllocationInfoProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerRequestProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServerCommonServiceProtos.RegisterNodeManagerRequestProtoOrBuilder;
|
|
|
import org.apache.hadoop.yarn.server.api.protocolrecords.LogAggregationReport;
|
|
|
import org.apache.hadoop.yarn.server.api.protocolrecords.NMContainerStatus;
|
|
|
import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
|
|
|
-
|
|
|
+import org.apache.hadoop.yarn.server.api.records.OverAllocationInfo;
|
|
|
+import org.apache.hadoop.yarn.server.api.records.impl.pb.OverAllocationInfoPBImpl;
|
|
|
+
|
|
|
public class RegisterNodeManagerRequestPBImpl extends RegisterNodeManagerRequest {
|
|
|
RegisterNodeManagerRequestProto proto = RegisterNodeManagerRequestProto.getDefaultInstance();
|
|
|
RegisterNodeManagerRequestProto.Builder builder = null;
|
|
@@ -58,6 +61,7 @@ public class RegisterNodeManagerRequestPBImpl extends RegisterNodeManagerRequest
|
|
|
private List<NMContainerStatus> containerStatuses = null;
|
|
|
private List<ApplicationId> runningApplications = null;
|
|
|
private Set<NodeLabel> labels = null;
|
|
|
+ private OverAllocationInfo overAllocationInfo = null;
|
|
|
|
|
|
private List<LogAggregationReport> logAggregationReportsForApps = null;
|
|
|
|
|
@@ -107,6 +111,11 @@ public class RegisterNodeManagerRequestPBImpl extends RegisterNodeManagerRequest
|
|
|
if (this.logAggregationReportsForApps != null) {
|
|
|
addLogAggregationStatusForAppsToProto();
|
|
|
}
|
|
|
+
|
|
|
+ if (this.overAllocationInfo != null) {
|
|
|
+ builder.setOverAllocationInfo(
|
|
|
+ convertToProtoFormat(this.overAllocationInfo));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void addLogAggregationStatusForAppsToProto() {
|
|
@@ -387,7 +396,30 @@ public class RegisterNodeManagerRequestPBImpl extends RegisterNodeManagerRequest
|
|
|
builder.clearNodeLabels();
|
|
|
this.labels = nodeLabels;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public synchronized OverAllocationInfo getOverAllocationInfo() {
|
|
|
+ RegisterNodeManagerRequestProtoOrBuilder p = viaProto ? proto : builder;
|
|
|
+ if (this.overAllocationInfo != null) {
|
|
|
+ return this.overAllocationInfo;
|
|
|
+ }
|
|
|
+ if (!p.hasOverAllocationInfo()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ this.overAllocationInfo = convertFromProtoFormat(p.getOverAllocationInfo());
|
|
|
+ return this.overAllocationInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public synchronized void setOverAllocationInfo(
|
|
|
+ OverAllocationInfo overAllocationInfo) {
|
|
|
+ maybeInitBuilder();
|
|
|
+ if (this.overAllocationInfo == null) {
|
|
|
+ builder.clearOverAllocationInfo();
|
|
|
+ }
|
|
|
+ this.overAllocationInfo = overAllocationInfo;
|
|
|
+ }
|
|
|
+
|
|
|
private synchronized void initNodeLabels() {
|
|
|
if (this.labels != null) {
|
|
|
return;
|
|
@@ -475,9 +507,19 @@ public class RegisterNodeManagerRequestPBImpl extends RegisterNodeManagerRequest
|
|
|
@Override
|
|
|
public synchronized void setLogAggregationReportsForApps(
|
|
|
List<LogAggregationReport> logAggregationStatusForApps) {
|
|
|
- if(logAggregationStatusForApps == null) {
|
|
|
+ if (logAggregationStatusForApps == null) {
|
|
|
builder.clearLogAggregationReportsForApps();
|
|
|
}
|
|
|
this.logAggregationReportsForApps = logAggregationStatusForApps;
|
|
|
}
|
|
|
+
|
|
|
+ private static OverAllocationInfoProto convertToProtoFormat(
|
|
|
+ OverAllocationInfo overAllocationInfo) {
|
|
|
+ return ((OverAllocationInfoPBImpl)overAllocationInfo).getProto();
|
|
|
+ }
|
|
|
+
|
|
|
+ private static OverAllocationInfo convertFromProtoFormat(
|
|
|
+ OverAllocationInfoProto proto) {
|
|
|
+ return new OverAllocationInfoPBImpl(proto);
|
|
|
+ }
|
|
|
}
|