|
@@ -33,6 +33,7 @@ import org.apache.hadoop.yarn.api.records.ContainerStatus;
|
|
|
import org.apache.hadoop.yarn.api.records.NMToken;
|
|
|
import org.apache.hadoop.yarn.api.records.NodeReport;
|
|
|
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
|
|
|
+import org.apache.hadoop.yarn.api.records.Priority;
|
|
|
import org.apache.hadoop.yarn.api.records.Resource;
|
|
|
import org.apache.hadoop.yarn.api.records.Token;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerPBImpl;
|
|
@@ -40,6 +41,7 @@ import org.apache.hadoop.yarn.api.records.impl.pb.ContainerStatusPBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.NMTokenPBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.NodeReportPBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.PreemptionMessagePBImpl;
|
|
|
+import org.apache.hadoop.yarn.api.records.impl.pb.PriorityPBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
|
|
|
import org.apache.hadoop.yarn.api.records.impl.pb.TokenPBImpl;
|
|
@@ -47,6 +49,7 @@ import org.apache.hadoop.yarn.proto.YarnProtos.ContainerProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStatusProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnProtos.NodeReportProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnProtos.PreemptionMessageProto;
|
|
|
+import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateResponseProto;
|
|
|
import org.apache.hadoop.yarn.proto.YarnServiceProtos.AllocateResponseProtoOrBuilder;
|
|
@@ -72,7 +75,8 @@ public class AllocateResponsePBImpl extends AllocateResponse {
|
|
|
private List<NodeReport> updatedNodes = null;
|
|
|
private PreemptionMessage preempt;
|
|
|
private Token amrmToken = null;
|
|
|
-
|
|
|
+ private Priority appPriority = null;
|
|
|
+
|
|
|
public AllocateResponsePBImpl() {
|
|
|
builder = AllocateResponseProto.newBuilder();
|
|
|
}
|
|
@@ -154,6 +158,9 @@ public class AllocateResponsePBImpl extends AllocateResponse {
|
|
|
if (this.amrmToken != null) {
|
|
|
builder.setAmRmToken(convertToProtoFormat(this.amrmToken));
|
|
|
}
|
|
|
+ if (this.appPriority != null) {
|
|
|
+ builder.setApplicationPriority(convertToProtoFormat(this.appPriority));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private synchronized void mergeLocalToProto() {
|
|
@@ -378,6 +385,27 @@ public class AllocateResponsePBImpl extends AllocateResponse {
|
|
|
this.amrmToken = amRMToken;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Priority getApplicationPriority() {
|
|
|
+ AllocateResponseProtoOrBuilder p = viaProto ? proto : builder;
|
|
|
+ if (this.appPriority != null) {
|
|
|
+ return this.appPriority;
|
|
|
+ }
|
|
|
+ if (!p.hasApplicationPriority()) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ this.appPriority = convertFromProtoFormat(p.getApplicationPriority());
|
|
|
+ return this.appPriority;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void setApplicationPriority(Priority priority) {
|
|
|
+ maybeInitBuilder();
|
|
|
+ if (priority == null)
|
|
|
+ builder.clearApplicationPriority();
|
|
|
+ this.appPriority = priority;
|
|
|
+ }
|
|
|
+
|
|
|
private synchronized void initLocalIncreasedContainerList() {
|
|
|
if (this.increasedContainers != null) {
|
|
|
return;
|
|
@@ -644,4 +672,12 @@ public class AllocateResponsePBImpl extends AllocateResponse {
|
|
|
private TokenProto convertToProtoFormat(Token t) {
|
|
|
return ((TokenPBImpl)t).getProto();
|
|
|
}
|
|
|
-}
|
|
|
+
|
|
|
+ private PriorityPBImpl convertFromProtoFormat(PriorityProto p) {
|
|
|
+ return new PriorityPBImpl(p);
|
|
|
+ }
|
|
|
+
|
|
|
+ private PriorityProto convertToProtoFormat(Priority t) {
|
|
|
+ return ((PriorityPBImpl)t).getProto();
|
|
|
+ }
|
|
|
+}
|