YARN-8221. RMWebServices also need to honor yarn.resourcemanager.display.per-user-apps. Contributed by Sunil G.
This commit is contained in:
parent
bff3d7b0cf
commit
ef3ecc308d
|
@ -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,
|
||||
|
@ -608,7 +612,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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue