YARN-8221. RMWebServices also need to honor yarn.resourcemanager.display.per-user-apps. Contributed by Sunil G.

This commit is contained in:
Rohith Sharma K S 2018-04-27 22:58:10 +05:30
parent bff3d7b0cf
commit ef3ecc308d

View File

@ -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 RMWebServices(final ResourceManager rm, Configuration conf) {
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,
@ -608,7 +612,14 @@ public AppsInfo getApps(@Context HttpServletRequest hsr,
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);
}