YARN-8221. RMWebServices also need to honor yarn.resourcemanager.display.per-user-apps. Contributed by Sunil G.
(cherry picked from commit ef3ecc308dbea41c6a88bd4d16739c7bbc10cdda) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/250ea479 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/250ea479 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/250ea479 Branch: refs/heads/YARN-8200 Commit: 250ea47985cd3fcc8d3b4a053e24daffeec8493b Parents: b47275f Author: Rohith Sharma K S <rohithsharm...@apache.org> Authored: Fri Apr 27 22:58:10 2018 +0530 Committer: Rohith Sharma K S <rohithsharm...@apache.org> Committed: Fri Apr 27 23:00:19 2018 +0530 ---------------------------------------------------------------------- .../server/resourcemanager/webapp/RMWebServices.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/250ea479/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java index 5266581..44af1ba 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServices.java @@ -228,6 +228,7 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { @VisibleForTesting boolean isCentralizedNodeLabelConfiguration = true; + private boolean displayPerUserApps = false; public final static String DELEGATION_TOKEN_HEADER = "Hadoop-YARN-RM-Delegation-Token"; @@ -240,6 +241,9 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { this.conf = conf; isCentralizedNodeLabelConfiguration = YarnConfiguration.isCentralizedNodeLabelConfiguration(conf); + this.displayPerUserApps = conf.getBoolean( + YarnConfiguration.DISPLAY_APPS_FOR_LOGGED_IN_USER, + YarnConfiguration.DEFAULT_DISPLAY_APPS_FOR_LOGGED_IN_USER); } RMWebServices(ResourceManager rm, Configuration conf, @@ -600,7 +604,14 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { DeSelectFields deSelectFields = new DeSelectFields(); deSelectFields.initFields(unselectedFields); - AppInfo app = new AppInfo(rm, rmapp, hasAccess(rmapp, hsr), + boolean allowAccess = hasAccess(rmapp, hsr); + // Given RM is configured to display apps per user, skip apps to which + // this caller doesn't have access to view. + if (displayPerUserApps && !allowAccess) { + continue; + } + + AppInfo app = new AppInfo(rm, rmapp, allowAccess, WebAppUtils.getHttpSchemePrefix(conf), deSelectFields); allApps.add(app); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org