From 722ee841948db1f246f0056acec9a1ac464fe1f9 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Mon, 11 Sep 2017 10:28:10 +0530 Subject: [PATCH] YARN-7163. RMContext need not to be injected to webapp and other Always Running services. Contributed by Rohith Sharma K S. --- .../yarn/server/webapp/AppAttemptBlock.java | 26 ++++++-- .../hadoop/yarn/server/webapp/AppBlock.java | 34 ++++++++-- .../hadoop/yarn/server/webapp/AppsBlock.java | 11 +++- .../yarn/server/webapp/ContainerBlock.java | 14 ++-- .../yarn/server/webapp/WebServices.java | 64 ++++++++++++++----- .../RMDelegationTokenSecretManager.java | 16 +++-- .../resourcemanager/webapp/ContainerPage.java | 3 +- .../webapp/RMAppAttemptBlock.java | 20 +++++- .../resourcemanager/webapp/RMAppBlock.java | 35 +++++++++- .../resourcemanager/webapp/RMAppsBlock.java | 17 +++-- .../webapp/RMContainerBlock.java | 47 ++++++++++++++ .../resourcemanager/webapp/RMWebApp.java | 2 - .../resourcemanager/webapp/RMWebServices.java | 52 ++++++++++++++- .../resourcemanager/TestClientRMTokens.java | 3 + .../TestTokenClientRMService.java | 3 + .../resourcemanager/webapp/TestAppPage.java | 5 +- .../resourcemanager/webapp/TestRMWebApp.java | 3 - .../webapp/TestRMWebAppFairScheduler.java | 6 -- .../webapp/TestRedirectionErrorPage.java | 3 - 19 files changed, 293 insertions(+), 71 deletions(-) create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMContainerBlock.java diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java index 87c554d4bec..cad14b67880 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppAttemptBlock.java @@ -19,8 +19,11 @@ package org.apache.hadoop.yarn.server.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ATTEMPT_ID; + +import java.io.IOException; import java.security.PrivilegedExceptionAction; import java.util.Collection; +import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.logging.Log; @@ -34,6 +37,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; import org.apache.hadoop.yarn.webapp.hamlet2.Hamlet; @@ -77,15 +81,13 @@ public class AppAttemptBlock extends HtmlBlock { GetApplicationAttemptReportRequest.newInstance(appAttemptId); if (callerUGI == null) { appAttemptReport = - appBaseProt.getApplicationAttemptReport(request) - .getApplicationAttemptReport(); + getApplicationAttemptReport(request); } else { appAttemptReport = callerUGI.doAs( new PrivilegedExceptionAction () { @Override public ApplicationAttemptReport run() throws Exception { - return appBaseProt.getApplicationAttemptReport(request) - .getApplicationAttemptReport(); + return getApplicationAttemptReport(request); } }); } @@ -108,13 +110,13 @@ public class AppAttemptBlock extends HtmlBlock { final GetContainersRequest request = GetContainersRequest.newInstance(appAttemptId); if (callerUGI == null) { - containers = appBaseProt.getContainers(request).getContainerList(); + containers = getContainers(request); } else { containers = callerUGI.doAs( new PrivilegedExceptionAction> () { @Override public Collection run() throws Exception { - return appBaseProt.getContainers(request).getContainerList(); + return getContainers(request); } }); } @@ -190,6 +192,18 @@ public class AppAttemptBlock extends HtmlBlock { tbody.__().__(); } + protected List getContainers( + final GetContainersRequest request) throws YarnException, IOException { + return appBaseProt.getContainers(request).getContainerList(); + } + + protected ApplicationAttemptReport getApplicationAttemptReport( + final GetApplicationAttemptReportRequest request) + throws YarnException, IOException { + return appBaseProt.getApplicationAttemptReport(request) + .getApplicationAttemptReport(); + } + protected void generateOverview(ApplicationAttemptReport appAttemptReport, Collection containers, AppAttemptInfo appAttempt, String node) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java index 95bc0aa614d..08e75ac8099 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppBlock.java @@ -22,8 +22,10 @@ import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.APPLICATION_ID; import static org.apache.hadoop.yarn.webapp.YarnWebParams.WEB_UI_TYPE; +import java.io.IOException; import java.security.PrivilegedExceptionAction; import java.util.Collection; +import java.util.List; import java.util.Map; import org.apache.commons.lang.StringEscapeUtils; @@ -49,6 +51,7 @@ import org.apache.hadoop.yarn.api.records.LogAggregationStatus; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; import org.apache.hadoop.yarn.server.webapp.dao.AppInfo; import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; @@ -114,8 +117,7 @@ public class AppBlock extends HtmlBlock { new PrivilegedExceptionAction () { @Override public ApplicationReport run() throws Exception { - return appBaseProt.getApplicationReport(request) - .getApplicationReport(); + return getApplicationReport(request); } }); } @@ -190,8 +192,7 @@ public class AppBlock extends HtmlBlock { ApplicationAttemptReport>>() { @Override public Collection run() throws Exception { - return appBaseProt.getApplicationAttempts(request) - .getApplicationAttemptList(); + return getApplicationAttemptsReport(request); } }); } catch (Exception e) { @@ -301,7 +302,7 @@ public class AppBlock extends HtmlBlock { appAttemptReport.getAMContainerId()); if (callerUGI == null) { containerReport = - appBaseProt.getContainerReport(request).getContainerReport(); + getContainerReport(request); } else { containerReport = callerUGI.doAs( new PrivilegedExceptionAction() { @@ -310,8 +311,7 @@ public class AppBlock extends HtmlBlock { ContainerReport report = null; if (request.getContainerId() != null) { try { - report = appBaseProt.getContainerReport(request) - .getContainerReport(); + report = getContainerReport(request); } catch (ContainerNotFoundException ex) { LOG.warn(ex.getMessage()); } @@ -364,6 +364,26 @@ public class AppBlock extends HtmlBlock { tbody.__().__(); } + protected ContainerReport getContainerReport( + final GetContainerReportRequest request) + throws YarnException, IOException { + return appBaseProt.getContainerReport(request).getContainerReport(); + } + + protected List getApplicationAttemptsReport( + final GetApplicationAttemptsRequest request) + throws YarnException, IOException { + return appBaseProt.getApplicationAttempts(request) + .getApplicationAttemptList(); + } + + protected ApplicationReport getApplicationReport( + final GetApplicationReportRequest request) + throws YarnException, IOException { + return appBaseProt.getApplicationReport(request).getApplicationReport(); + } + + private String clarifyAppState(YarnApplicationState state) { String ret = state.toString(); switch (state) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java index d836e641177..e3a47de0ec5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/AppsBlock.java @@ -30,6 +30,7 @@ import java.io.IOException; import java.security.PrivilegedExceptionAction; import java.util.Collection; import java.util.EnumSet; +import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.math.LongRange; @@ -110,20 +111,24 @@ public class AppsBlock extends HtmlBlock { new LongRange(appStartedTimeBegain, appStartedTimeEnd)); if (callerUGI == null) { - appReports = appBaseProt.getApplications(request).getApplicationList(); + appReports = getApplicationReport(request); } else { appReports = callerUGI .doAs(new PrivilegedExceptionAction>() { @Override public Collection run() throws Exception { - return appBaseProt.getApplications(request) - .getApplicationList(); + return getApplicationReport(request); } }); } } + protected List getApplicationReport( + final GetApplicationsRequest request) throws YarnException, IOException { + return appBaseProt.getApplications(request).getApplicationList(); + } + @Override public void render(Block html) { setTitle("Applications"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java index fa35a3d5273..b8c0bed87d3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/ContainerBlock.java @@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.YarnWebParams.CONTAINER_ID; +import java.io.IOException; import java.security.PrivilegedExceptionAction; import org.apache.commons.logging.Log; @@ -30,6 +31,7 @@ import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerReport; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; import org.apache.hadoop.yarn.util.Times; import org.apache.hadoop.yarn.webapp.view.HtmlBlock; @@ -70,15 +72,13 @@ public class ContainerBlock extends HtmlBlock { final GetContainerReportRequest request = GetContainerReportRequest.newInstance(containerId); if (callerUGI == null) { - containerReport = appBaseProt.getContainerReport(request) - .getContainerReport(); + containerReport = getContainerReport(request); } else { containerReport = callerUGI.doAs( new PrivilegedExceptionAction () { @Override public ContainerReport run() throws Exception { - return appBaseProt.getContainerReport(request) - .getContainerReport(); + return getContainerReport(request); } }); } @@ -126,4 +126,10 @@ public class ContainerBlock extends HtmlBlock { html.__(InfoBlock.class); } + + protected ContainerReport getContainerReport( + final GetContainerReportRequest request) + throws YarnException, IOException { + return appBaseProt.getContainerReport(request).getContainerReport(); + } } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java index 904c5118f44..6bb6c984544 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/webapp/WebServices.java @@ -18,11 +18,13 @@ package org.apache.hadoop.yarn.server.webapp; +import java.io.IOException; import java.lang.reflect.UndeclaredThrowableException; import java.security.PrivilegedExceptionAction; import java.util.Arrays; import java.util.Collection; import java.util.HashSet; +import java.util.List; import java.util.Set; import javax.servlet.http.HttpServletRequest; @@ -51,13 +53,13 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException; import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.ContainerNotFoundException; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo; import org.apache.hadoop.yarn.server.webapp.dao.AppInfo; import org.apache.hadoop.yarn.server.webapp.dao.AppsInfo; import org.apache.hadoop.yarn.server.webapp.dao.ContainerInfo; import org.apache.hadoop.yarn.server.webapp.dao.ContainersInfo; -import org.apache.hadoop.yarn.util.ConverterUtils; import org.apache.hadoop.yarn.webapp.BadRequestException; import org.apache.hadoop.yarn.webapp.ForbiddenException; import org.apache.hadoop.yarn.webapp.NotFoundException; @@ -154,13 +156,13 @@ public class WebServices { if (callerUGI == null) { // TODO: the request should take the params like what RMWebServices does // in YARN-1819. - appReports = appBaseProt.getApplications(request).getApplicationList(); + appReports = getApplicationsReport(request); } else { appReports = callerUGI.doAs( new PrivilegedExceptionAction> () { @Override public Collection run() throws Exception { - return appBaseProt.getApplications(request).getApplicationList(); + return getApplicationsReport(request); } }); } @@ -220,7 +222,7 @@ public class WebServices { if (callerUGI == null) { GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(id); - app = appBaseProt.getApplicationReport(request).getApplicationReport(); + app = getApplicationReport(request); } else { app = callerUGI.doAs( new PrivilegedExceptionAction () { @@ -228,7 +230,7 @@ public class WebServices { public ApplicationReport run() throws Exception { GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(id); - return appBaseProt.getApplicationReport(request).getApplicationReport(); + return getApplicationReport(request); } }); } @@ -251,8 +253,7 @@ public class WebServices { GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id); appAttemptReports = - appBaseProt.getApplicationAttempts(request) - .getApplicationAttemptList(); + getApplicationAttemptsReport(request); } else { appAttemptReports = callerUGI.doAs( new PrivilegedExceptionAction> () { @@ -260,8 +261,7 @@ public class WebServices { public Collection run() throws Exception { GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(id); - return appBaseProt.getApplicationAttempts(request) - .getApplicationAttemptList(); + return getApplicationAttemptsReport(request); } }); } @@ -292,8 +292,7 @@ public class WebServices { GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(aaid); appAttempt = - appBaseProt.getApplicationAttemptReport(request) - .getApplicationAttemptReport(); + getApplicationAttemptReport(request); } else { appAttempt = callerUGI.doAs( new PrivilegedExceptionAction () { @@ -301,8 +300,7 @@ public class WebServices { public ApplicationAttemptReport run() throws Exception { GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(aaid); - return appBaseProt.getApplicationAttemptReport(request) - .getApplicationAttemptReport(); + return getApplicationAttemptReport(request); } }); } @@ -327,14 +325,14 @@ public class WebServices { if (callerUGI == null) { GetContainersRequest request = GetContainersRequest.newInstance(aaid); containerReports = - appBaseProt.getContainers(request).getContainerList(); + getContainersReport(request); } else { containerReports = callerUGI.doAs( new PrivilegedExceptionAction> () { @Override public Collection run() throws Exception { GetContainersRequest request = GetContainersRequest.newInstance(aaid); - return appBaseProt.getContainers(request).getContainerList(); + return getContainersReport(request); } }); } @@ -366,7 +364,7 @@ public class WebServices { GetContainerReportRequest request = GetContainerReportRequest.newInstance(cid); container = - appBaseProt.getContainerReport(request).getContainerReport(); + getContainerReport(request); } else { container = callerUGI.doAs( new PrivilegedExceptionAction () { @@ -374,7 +372,7 @@ public class WebServices { public ContainerReport run() throws Exception { GetContainerReportRequest request = GetContainerReportRequest.newInstance(cid); - return appBaseProt.getContainerReport(request).getContainerReport(); + return getContainerReport(request); } }); } @@ -516,4 +514,36 @@ public class WebServices { } } + protected ApplicationReport getApplicationReport( + GetApplicationReportRequest request) throws YarnException, IOException { + return appBaseProt.getApplicationReport(request).getApplicationReport(); + } + + protected List getApplicationsReport( + final GetApplicationsRequest request) throws YarnException, IOException { + return appBaseProt.getApplications(request).getApplicationList(); + } + + protected ApplicationAttemptReport getApplicationAttemptReport( + GetApplicationAttemptReportRequest request) + throws YarnException, IOException { + return appBaseProt.getApplicationAttemptReport(request) + .getApplicationAttemptReport(); + } + + protected List getApplicationAttemptsReport( + GetApplicationAttemptsRequest request) throws YarnException, IOException { + return appBaseProt.getApplicationAttempts(request) + .getApplicationAttemptList(); + } + + protected ContainerReport getContainerReport( + GetContainerReportRequest request) throws YarnException, IOException { + return appBaseProt.getContainerReport(request).getContainerReport(); + } + + protected List getContainersReport( + GetContainersRequest request) throws YarnException, IOException { + return appBaseProt.getContainers(request).getContainerList(); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java index 631ca9d2e5a..53cc4716ca6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java @@ -34,6 +34,7 @@ import org.apache.hadoop.security.token.delegation.DelegationKey; import org.apache.hadoop.util.ExitUtil; import org.apache.hadoop.yarn.security.client.RMDelegationTokenIdentifier; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; +import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.recovery.RMStateStore.RMState; import org.apache.hadoop.yarn.server.resourcemanager.recovery.Recoverable; @@ -52,7 +53,7 @@ public class RMDelegationTokenSecretManager extends private static final Log LOG = LogFactory .getLog(RMDelegationTokenSecretManager.class); - protected final RMContext rmContext; + private final ResourceManager rm; /** * Create a secret manager @@ -73,7 +74,7 @@ public class RMDelegationTokenSecretManager extends RMContext rmContext) { super(delegationKeyUpdateInterval, delegationTokenMaxLifetime, delegationTokenRenewInterval, delegationTokenRemoverScanInterval); - this.rmContext = rmContext; + this.rm = rmContext.getResourceManager(); } @Override @@ -85,7 +86,7 @@ public class RMDelegationTokenSecretManager extends protected void storeNewMasterKey(DelegationKey newKey) { try { LOG.info("storing master key with keyID " + newKey.getKeyId()); - rmContext.getStateStore().storeRMDTMasterKey(newKey); + rm.getRMContext().getStateStore().storeRMDTMasterKey(newKey); } catch (Exception e) { LOG.error("Error in storing master key with KeyID: " + newKey.getKeyId()); ExitUtil.terminate(1, e); @@ -96,7 +97,7 @@ public class RMDelegationTokenSecretManager extends protected void removeStoredMasterKey(DelegationKey key) { try { LOG.info("removing master key with keyID " + key.getKeyId()); - rmContext.getStateStore().removeRMDTMasterKey(key); + rm.getRMContext().getStateStore().removeRMDTMasterKey(key); } catch (Exception e) { LOG.error("Error in removing master key with KeyID: " + key.getKeyId()); ExitUtil.terminate(1, e); @@ -109,7 +110,8 @@ public class RMDelegationTokenSecretManager extends try { LOG.info("storing RMDelegation token with sequence number: " + identifier.getSequenceNumber()); - rmContext.getStateStore().storeRMDelegationToken(identifier, renewDate); + rm.getRMContext().getStateStore().storeRMDelegationToken(identifier, + renewDate); } catch (Exception e) { LOG.error("Error in storing RMDelegationToken with sequence number: " + identifier.getSequenceNumber()); @@ -123,7 +125,7 @@ public class RMDelegationTokenSecretManager extends try { LOG.info("updating RMDelegation token with sequence number: " + id.getSequenceNumber()); - rmContext.getStateStore().updateRMDelegationToken(id, renewDate); + rm.getRMContext().getStateStore().updateRMDelegationToken(id, renewDate); } catch (Exception e) { LOG.error("Error in updating persisted RMDelegationToken" + " with sequence number: " + id.getSequenceNumber()); @@ -137,7 +139,7 @@ public class RMDelegationTokenSecretManager extends try { LOG.info("removing RMDelegation token with sequence number: " + ident.getSequenceNumber()); - rmContext.getStateStore().removeRMDelegationToken(ident); + rm.getRMContext().getStateStore().removeRMDelegationToken(ident); } catch (Exception e) { LOG.error("Error in removing RMDelegationToken with sequence number: " + ident.getSequenceNumber()); 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/ContainerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ContainerPage.java index 2cd209b6eae..0204989fed1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ContainerPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ContainerPage.java @@ -20,7 +20,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; import static org.apache.hadoop.yarn.util.StringHelper.join; -import org.apache.hadoop.yarn.server.webapp.ContainerBlock; import org.apache.hadoop.yarn.webapp.SubView; import org.apache.hadoop.yarn.webapp.YarnWebParams; @@ -38,7 +37,7 @@ public class ContainerPage extends RmView { @Override protected Class content() { - return ContainerBlock.class; + return RMContainerBlock.class; } } \ No newline at end of file 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/RMAppAttemptBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java index 82ddb54b70d..b26eb0951ed 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppAttemptBlock.java @@ -23,18 +23,22 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI._INFO_WRAP; import static org.apache.hadoop.yarn.webapp.view.JQueryUI._ODD; import static org.apache.hadoop.yarn.webapp.view.JQueryUI._TH; +import java.io.IOException; import java.util.Collection; import java.util.List; import org.apache.commons.lang.StringEscapeUtils; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceRequest; import org.apache.hadoop.yarn.api.records.YarnApplicationAttemptState; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; @@ -61,7 +65,7 @@ public class RMAppAttemptBlock extends AppAttemptBlock{ @Inject RMAppAttemptBlock(ViewContext ctx, ResourceManager rm, Configuration conf) { - super(rm.getClientRMService(), ctx); + super(null, ctx); this.rm = rm; this.conf = conf; } @@ -275,4 +279,18 @@ public class RMAppAttemptBlock extends AppAttemptBlock{ createContainerLocalityTable(html); createResourceRequestsTable(html); } + + @Override + protected List getContainers( + final GetContainersRequest request) throws YarnException, IOException { + return rm.getClientRMService().getContainers(request).getContainerList(); + } + + @Override + protected ApplicationAttemptReport getApplicationAttemptReport( + final GetApplicationAttemptReportRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getApplicationAttemptReport(request) + .getApplicationAttemptReport(); + } } 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/RMAppBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java index cd04264d07c..e5e31e0640b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppBlock.java @@ -20,15 +20,23 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; import static org.apache.hadoop.yarn.webapp.view.JQueryUI._INFO_WRAP; +import java.io.IOException; import java.util.Collection; +import java.util.List; import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; +import org.apache.hadoop.yarn.api.records.ApplicationReport; +import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.LogAggregationStatus; import org.apache.hadoop.yarn.api.records.Resource; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics; @@ -52,7 +60,7 @@ public class RMAppBlock extends AppBlock{ @Inject RMAppBlock(ViewContext ctx, Configuration conf, ResourceManager rm) { - super(rm.getClientRMService(), ctx, conf); + super(null, ctx, conf); this.conf = conf; this.rm = rm; } @@ -187,4 +195,29 @@ public class RMAppBlock extends AppBlock{ } return rmApp.getLogAggregationStatusForAppReport(); } + + @Override + protected ContainerReport getContainerReport( + final GetContainerReportRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getContainerReport(request) + .getContainerReport(); + } + + @Override + protected List getApplicationAttemptsReport( + final GetApplicationAttemptsRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getApplicationAttempts(request) + .getApplicationAttemptList(); + } + + @Override + protected ApplicationReport getApplicationReport( + final GetApplicationReportRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getApplicationReport(request) + .getApplicationReport(); + } + } 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/RMAppsBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java index ede71e34378..d0dccab6e5c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMAppsBlock.java @@ -22,14 +22,17 @@ import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.C_PROGRESSBAR; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.C_PROGRESSBAR_VALUE; +import java.io.IOException; +import java.util.List; import java.util.Set; import org.apache.commons.lang.StringEscapeUtils; import org.apache.hadoop.util.StringUtils; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt; @@ -47,9 +50,8 @@ public class RMAppsBlock extends AppsBlock { private ResourceManager rm; @Inject - RMAppsBlock(ResourceManager rm, ApplicationBaseProtocol appBaseProt, - View.ViewContext ctx) { - super(appBaseProt, ctx); + RMAppsBlock(ResourceManager rm, View.ViewContext ctx) { + super(null, ctx); this.rm = rm; } @@ -193,4 +195,11 @@ public class RMAppsBlock extends AppsBlock { tbody.__().__(); } + + @Override + protected List getApplicationReport( + final GetApplicationsRequest request) throws YarnException, IOException { + return rm.getClientRMService().getApplications(request) + .getApplicationList(); + } } 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/RMContainerBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMContainerBlock.java new file mode 100644 index 00000000000..f589a5dafba --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMContainerBlock.java @@ -0,0 +1,47 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.yarn.server.resourcemanager.webapp; + +import java.io.IOException; + +import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; +import org.apache.hadoop.yarn.api.records.ContainerReport; +import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; +import org.apache.hadoop.yarn.server.webapp.ContainerBlock; + +import com.google.inject.Inject; + +public class RMContainerBlock extends ContainerBlock { + + private final ResourceManager rm; + + @Inject + public RMContainerBlock(ResourceManager resourceManager, ViewContext ctx) { + super(null, ctx); + this.rm = resourceManager; + } + + @Override + protected ContainerReport getContainerReport( + final GetContainerReportRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getContainerReport(request) + .getContainerReport(); + } +} \ No newline at end of file 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/RMWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java index 3367cf47334..4e36665267a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebApp.java @@ -23,7 +23,6 @@ import static org.apache.hadoop.yarn.util.StringHelper.pajoin; import java.net.InetSocketAddress; import org.apache.hadoop.ha.HAServiceProtocol.HAServiceState; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.util.RMHAUtils; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; @@ -55,7 +54,6 @@ public class RMWebApp extends WebApp implements YarnWebParams { if (rm != null) { bind(ResourceManager.class).toInstance(rm); - bind(ApplicationBaseProtocol.class).toInstance(rm.getClientRMService()); } route("/", RmController.class); route(pajoin("/nodes", NODE_STATE), RmController.class, "nodes"); 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 7ffe106f876..6dc3d9ab094 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 @@ -72,7 +72,12 @@ import org.apache.hadoop.security.token.delegation.web.DelegationTokenAuthentica import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenRequest; import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest; @@ -95,10 +100,12 @@ import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse; import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityRequest; import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest; import org.apache.hadoop.yarn.api.records.ApplicationAccessType; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType; +import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.NodeId; import org.apache.hadoop.yarn.api.records.NodeLabel; @@ -223,7 +230,8 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { @Inject public RMWebServices(final ResourceManager rm, Configuration conf) { - super(rm.getClientRMService()); + // don't inject, always take appBaseRoot from RM. + super(null); this.rm = rm; this.conf = conf; isCentralizedNodeLabelConfiguration = @@ -2404,4 +2412,46 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { app.getApplicationTimeouts().get(appTimeout.getTimeoutType())); return Response.status(Status.OK).entity(timeout).build(); } + + @Override + protected ApplicationReport getApplicationReport( + GetApplicationReportRequest request) throws YarnException, IOException { + return rm.getClientRMService().getApplicationReport(request) + .getApplicationReport(); + } + + @Override + protected List getApplicationsReport( + final GetApplicationsRequest request) throws YarnException, IOException { + return rm.getClientRMService().getApplications(request) + .getApplicationList(); + } + + @Override + protected ApplicationAttemptReport getApplicationAttemptReport( + GetApplicationAttemptReportRequest request) + throws YarnException, IOException { + return rm.getClientRMService().getApplicationAttemptReport(request) + .getApplicationAttemptReport(); + } + + @Override + protected List getApplicationAttemptsReport( + GetApplicationAttemptsRequest request) throws YarnException, IOException { + return rm.getClientRMService().getApplicationAttempts(request) + .getApplicationAttemptList(); + } + + @Override + protected ContainerReport getContainerReport( + GetContainerReportRequest request) throws YarnException, IOException { + return rm.getClientRMService().getContainerReport(request) + .getContainerReport(); + } + + @Override + protected List getContainersReport( + GetContainersRequest request) throws YarnException, IOException { + return rm.getClientRMService().getContainers(request).getContainerList(); + } } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java index 65145a4c93d..06c1c425dd8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestClientRMTokens.java @@ -533,8 +533,11 @@ public class TestClientRMTokens { private static RMDelegationTokenSecretManager createRMDelegationTokenSecretManager(long secretKeyInterval, long tokenMaxLifetime, long tokenRenewInterval) { + ResourceManager rm = mock(ResourceManager.class); RMContext rmContext = mock(RMContext.class); when(rmContext.getStateStore()).thenReturn(new NullRMStateStore()); + when(rm.getRMContext()).thenReturn(rmContext); + when(rmContext.getResourceManager()).thenReturn(rm); RMDelegationTokenSecretManager rmDtSecretManager = new RMDelegationTokenSecretManager(secretKeyInterval, tokenMaxLifetime, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestTokenClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestTokenClientRMService.java index 78271c65482..3e1ede9cd46 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestTokenClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestTokenClientRMService.java @@ -71,8 +71,11 @@ public class TestTokenClientRMService { @BeforeClass public static void setupSecretManager() throws IOException { + ResourceManager rm = mock(ResourceManager.class); RMContext rmContext = mock(RMContext.class); when(rmContext.getStateStore()).thenReturn(new NullRMStateStore()); + when(rm.getRMContext()).thenReturn(rmContext); + when(rmContext.getResourceManager()).thenReturn(rm); dtsm = new RMDelegationTokenSecretManager(60000, 60000, 60000, 60000, rmContext); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestAppPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestAppPage.java index a009bc07d47..d9ed073e95b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestAppPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestAppPage.java @@ -23,7 +23,6 @@ import static org.mockito.Mockito.when; import java.io.IOException; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.Resource; @@ -80,15 +79,13 @@ public class TestAppPage { try { ResourceManager rm = TestRMWebApp.mockRm(rmContext); binder.bind(ResourceManager.class).toInstance(rm); - binder.bind(ApplicationBaseProtocol.class).toInstance( - rm.getClientRMService()); } catch (IOException e) { throw new IllegalStateException(e); } } }); - AppBlock instance = injector.getInstance(AppBlock.class); + AppBlock instance = injector.getInstance(RMAppBlock.class); instance.set(YarnWebParams.APPLICATION_ID, APP_ID.toString()); instance.render(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java index 8a6504002a1..b1256083ef8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebApp.java @@ -32,7 +32,6 @@ import java.util.Map; import java.util.concurrent.ConcurrentMap; import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; @@ -103,8 +102,6 @@ public class TestRMWebApp { try { ResourceManager mockRm = mockRm(3, 1, 2, 8*GiB); binder.bind(ResourceManager.class).toInstance(mockRm); - binder.bind(ApplicationBaseProtocol.class) - .toInstance(mockRm.getClientRMService()); } catch (IOException e) { throw new IllegalStateException(e); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java index 78fadef03e5..8c00b39c4ba 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebAppFairScheduler.java @@ -24,7 +24,6 @@ import com.google.inject.Injector; import com.google.inject.Module; import org.apache.hadoop.util.StringUtils; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.Resource; @@ -75,8 +74,6 @@ public class TestRMWebAppFairScheduler { mockRm(rmContext); binder.bind(ResourceManager.class).toInstance (mockRmWithFairScheduler); - binder.bind(ApplicationBaseProtocol.class).toInstance( - mockRmWithFairScheduler.getClientRMService()); } catch (IOException e) { throw new IllegalStateException(e); } @@ -115,9 +112,6 @@ public class TestRMWebAppFairScheduler { mockRmWithApps(rmContext); binder.bind(ResourceManager.class).toInstance (mockRmWithFairScheduler); - binder.bind(ApplicationBaseProtocol.class).toInstance( - mockRmWithFairScheduler.getClientRMService()); - } catch (IOException e) { throw new IllegalStateException(e); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRedirectionErrorPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRedirectionErrorPage.java index 408dc9bb88a..eb0a62d783c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRedirectionErrorPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRedirectionErrorPage.java @@ -21,7 +21,6 @@ package org.apache.hadoop.yarn.server.resourcemanager.webapp; import java.io.IOException; -import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.server.resourcemanager.RMContext; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; @@ -52,8 +51,6 @@ public class TestRedirectionErrorPage { try { ResourceManager rm = TestRMWebApp.mockRm(rmContext); binder.bind(ResourceManager.class).toInstance(rm); - binder.bind(ApplicationBaseProtocol.class).toInstance( - rm.getClientRMService()); } catch (IOException e) { throw new IllegalStateException(e); }