From 570eee30e5ab5cf37b1a758934987cbf61140f6a Mon Sep 17 00:00:00 2001 From: Weiwei Yang Date: Tue, 2 Jul 2019 09:55:25 +0800 Subject: [PATCH] YARN-9655. AllocateResponse in FederationInterceptor lost applicationPriority. Contributed by hunshenshi. --- .../server/nodemanager/amrmproxy/FederationInterceptor.java | 5 +++++ .../nodemanager/amrmproxy/TestFederationInterceptor.java | 1 + 2 files changed, 6 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java index 992dc823df..5d165c9958 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/FederationInterceptor.java @@ -1446,6 +1446,11 @@ protected void mergeAllocateResponse(AllocateResponse homeResponse, } } + if (otherResponse.getApplicationPriority() != null) { + homeResponse.setApplicationPriority( + otherResponse.getApplicationPriority()); + } + homeResponse.setNumClusterNodes( homeResponse.getNumClusterNodes() + otherResponse.getNumClusterNodes()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/TestFederationInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/TestFederationInterceptor.java index ecaeaae7bf..3288382b26 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/TestFederationInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/TestFederationInterceptor.java @@ -748,6 +748,7 @@ public void testAllocateResponse() throws Exception { Assert.assertEquals(1, response.getNMTokens().size()); Assert.assertEquals(1, response.getUpdatedContainers().size()); Assert.assertEquals(1, response.getUpdateErrors().size()); + Assert.assertNotNull(response.getApplicationPriority()); } @Test