From 647874206c683ade6ea43a390670913b7e0d6467 Mon Sep 17 00:00:00 2001 From: Zhijie Shen Date: Thu, 9 Oct 2014 17:57:50 -0700 Subject: [PATCH] YARN-2617. Fixed ApplicationSubmissionContext to still set resource for backward compatibility. Contributed by Wangda Tan. (cherry picked from commit e532ed8faa8db4b008a5b8d3f82b48a1b314fa6c) --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../yarn/api/records/ApplicationSubmissionContext.java | 1 + .../java/org/apache/hadoop/yarn/api/TestPBImplRecords.java | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 18d08c7e954..a3961a49f07 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -548,6 +548,9 @@ Release 2.6.0 - UNRELEASED YARN-2598 GHS should show N/A instead of null for the inaccessible information (Zhijie Shen via mayank) + YARN-2617. Fixed ApplicationSubmissionContext to still set resource for + backward compatibility. (Wangda Tan via zjshen) + Release 2.5.1 - 2014-09-05 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java index f186650e0c5..f1ebbfea292 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java @@ -89,6 +89,7 @@ public abstract class ApplicationSubmissionContext { context.setApplicationType(applicationType); context.setKeepContainersAcrossApplicationAttempts(keepContainers); context.setNodeLabelExpression(appLabelExpression); + context.setResource(resource); ResourceRequest amReq = Records.newRecord(ResourceRequest.class); amReq.setResourceName(ResourceRequest.ANY); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java index 451d39b7786..b8f6e9c79e4 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java @@ -45,6 +45,7 @@ import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.*; import org.apache.hadoop.yarn.proto.YarnProtos.*; import org.apache.hadoop.yarn.proto.YarnServiceProtos.*; import org.apache.hadoop.yarn.server.api.protocolrecords.impl.pb.*; +import org.apache.hadoop.yarn.util.resource.Resources; import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Ignore; @@ -654,6 +655,12 @@ public class TestPBImplRecords { public void testApplicationSubmissionContextPBImpl() throws Exception { validatePBImplRecord(ApplicationSubmissionContextPBImpl.class, ApplicationSubmissionContextProto.class); + + ApplicationSubmissionContext ctx = + ApplicationSubmissionContext.newInstance(null, null, null, null, null, + false, false, 0, Resources.none(), null, false, null, null); + + Assert.assertNotNull(ctx.getResource()); } @Test