From 768ee22e9e73543d2fb193d9b6ec34a247cb0411 Mon Sep 17 00:00:00 2001 From: Szilard Nemeth Date: Mon, 6 Jan 2020 16:26:33 +0100 Subject: [PATCH] YARN-10035. Add ability to filter the Cluster Applications API request by name. Contributed by Adam Antal --- .../GetApplicationsRequest.java | 18 +++++++++++++ .../src/main/proto/yarn_service_protos.proto | 1 + .../impl/pb/GetApplicationsRequestPBImpl.java | 25 +++++++++++++++++++ .../webapp/AHSWebServices.java | 6 +++-- .../yarn/server/webapp/WebServices.java | 7 +++++- .../resourcemanager/ClientRMService.java | 5 ++++ .../webapp/ApplicationsRequestBuilder.java | 9 +++++++ .../resourcemanager/webapp/RMWSConsts.java | 1 + .../webapp/RMWebServiceProtocol.java | 3 ++- .../resourcemanager/webapp/RMWebServices.java | 2 ++ .../webapp/TestRMWebServices.java | 9 ++++--- .../webapp/DefaultRequestInterceptorREST.java | 2 +- .../webapp/FederationInterceptorREST.java | 4 +-- .../router/webapp/RouterWebServices.java | 3 ++- .../webapp/BaseRouterWebServicesTest.java | 3 ++- .../MockDefaultRequestInterceptorREST.java | 2 +- .../webapp/MockRESTRequestInterceptor.java | 2 +- .../PassThroughRESTRequestInterceptor.java | 4 +-- .../webapp/TestFederationInterceptorREST.java | 2 +- .../TestFederationInterceptorRESTRetry.java | 6 ++--- .../src/site/markdown/ResourceManagerRest.md | 1 + 21 files changed, 95 insertions(+), 20 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsRequest.java index a52b4059126..81d98b56048 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsRequest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsRequest.java @@ -393,4 +393,22 @@ public abstract class GetApplicationsRequest { @Private @Unstable public abstract void setScope(ApplicationsRequestScope scope); + + /** + * Set the name to filter applications. + * + * @return the name + */ + @Private + @Unstable + public abstract String getName(); + + /** + * Get the name to filter applications. + * + * @param name of the application + */ + @Private + @Unstable + public abstract void setName(String name); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto index d562cdb12f2..8a0273d7a79 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto @@ -206,6 +206,7 @@ message GetApplicationsRequestProto { optional int64 finish_end = 9; repeated string applicationTags = 10; optional ApplicationsRequestScopeProto scope = 11 [default = ALL]; + optional string name = 12; } message GetApplicationsResponseProto { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java index 4c5fee0e7fd..9c3045e17d8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/GetApplicationsRequestPBImpl.java @@ -55,6 +55,7 @@ public class GetApplicationsRequestPBImpl extends GetApplicationsRequest { Range finish = null; private Set applicationTags; private ApplicationsRequestScope scope; + private String name; public GetApplicationsRequestPBImpl() { builder = GetApplicationsRequestProto.newBuilder(); @@ -121,6 +122,9 @@ public class GetApplicationsRequestPBImpl extends GetApplicationsRequest { builder.clearQueues(); builder.addAllQueues(queues); } + if (name != null) { + builder.setName(name); + } } private void maybeInitBuilder() { @@ -370,6 +374,27 @@ public class GetApplicationsRequestPBImpl extends GetApplicationsRequest { this.finish = Range.between(begin, end); } + @Override + public synchronized String getName() { + GetApplicationsRequestProtoOrBuilder p = viaProto ? proto : builder; + if (this.name != null) { + return this.name; + } + if (p.hasName()) { + this.name = p.getName(); + } + return this.name; + } + + @Override + public synchronized void setName(String name) { + maybeInitBuilder(); + if (name == null) { + builder.clearName(); + } + this.name = name; + } + @Override public int hashCode() { return getProto().hashCode(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java index e30d6c6c76d..d9918d3f36d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java @@ -107,7 +107,8 @@ public class AHSWebServices extends WebServices { public AppsInfo get(@Context HttpServletRequest req, @Context HttpServletResponse res) { return getApps(req, res, null, Collections. emptySet(), null, null, - null, null, null, null, null, null, Collections. emptySet()); + null, null, null, null, null, null, null, + Collections. emptySet()); } @GET @@ -126,12 +127,13 @@ public class AHSWebServices extends WebServices { @QueryParam("startedTimeEnd") String startedEnd, @QueryParam("finishedTimeBegin") String finishBegin, @QueryParam("finishedTimeEnd") String finishEnd, + @QueryParam("name") String name, @QueryParam("applicationTypes") Set applicationTypes) { initForReadableEndpoints(res); validateStates(stateQuery, statesQuery); return super.getApps(req, res, stateQuery, statesQuery, finalStatusQuery, userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin, - finishEnd, applicationTypes); + finishEnd, name, applicationTypes); } @GET 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 5bb5448492a..9f6065f810c 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 @@ -75,7 +75,7 @@ public class WebServices { public AppsInfo getApps(HttpServletRequest req, HttpServletResponse res, String stateQuery, Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, - String startedEnd, String finishBegin, String finishEnd, + String startedEnd, String finishBegin, String finishEnd, String nameQuery, Set applicationTypes) { UserGroupInformation callerUGI = getUser(req); boolean checkEnd = false; @@ -207,6 +207,11 @@ public class WebServices { && (appReport.getFinishTime() < fBegin || appReport.getFinishTime() > fEnd)) { continue; } + + if (nameQuery != null && !nameQuery.equals(appReport.getName())) { + continue; + } + AppInfo app = new AppInfo(appReport); allApps.add(app); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java index f9681e08560..a52a78881f3 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java @@ -865,6 +865,7 @@ public class ClientRMService extends AbstractService implements Range start = request.getStartRange(); Range finish = request.getFinishRange(); ApplicationsRequestScope scope = request.getScope(); + String name = request.getName(); final Map apps = rmContext.getRMApps(); Iterator appsIter = apps.values().iterator(); @@ -943,6 +944,10 @@ public class ClientRMService extends AbstractService implements continue; } + if (name != null && !name.equals(application.getName())) { + continue; + } + reports.add(application.createAndGetApplicationReport( callerUGI.getUserName(), allowAccess)); } 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/ApplicationsRequestBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ApplicationsRequestBuilder.java index 876d04479c0..38a43d576a7 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ApplicationsRequestBuilder.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/ApplicationsRequestBuilder.java @@ -44,6 +44,7 @@ public class ApplicationsRequestBuilder { private long finishTimeEnd = Long.MAX_VALUE; private Set appTypes = Sets.newHashSet(); private Set appTags = Sets.newHashSet(); + private String name = null; private ResourceManager rm; private ApplicationsRequestBuilder() { @@ -137,6 +138,11 @@ public class ApplicationsRequestBuilder { return this; } + public ApplicationsRequestBuilder withName(String applicationName) { + name = applicationName; + return this; + } + private void validate() { queues.forEach(q -> validateQueueExists(rm, q)); validateLimit(); @@ -225,6 +231,9 @@ public class ApplicationsRequestBuilder { if (!appTags.isEmpty()) { request.setApplicationTags(appTags); } + if (name != null) { + request.setName(name); + } return request; } 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/RMWSConsts.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java index ab481403bd0..b7381038855 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWSConsts.java @@ -245,6 +245,7 @@ public final class RMWSConsts { public static final String COMMAND = "command"; public static final String ACTIONS = "actions"; public static final String SUMMARIZE = "summarize"; + public static final String NAME = "name"; private RMWSConsts() { // not called 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/RMWebServiceProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java index a5bd93bbbed..a41208e6073 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RMWebServiceProtocol.java @@ -186,6 +186,7 @@ public interface RMWebServiceProtocol { * @param finishEnd filter the result by finish end time. It is a QueryParam. * @param applicationTypes filter the result by types. It is a QueryParam. * @param applicationTags filter the result by tags. It is a QueryParam. + * @param name filter the name of the application. It is a QueryParam. * @param unselectedFields De-selected params to avoid from report. It is a * QueryParam. * @return all apps in the cluster @@ -195,7 +196,7 @@ public interface RMWebServiceProtocol { Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields); + Set applicationTags, String name, Set unselectedFields); /** * This method retrieve all the activities in a specific node, and it is 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 5ff4b06acc3..e63dc068d17 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 @@ -610,6 +610,7 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { @QueryParam(RMWSConsts.FINISHED_TIME_END) String finishEnd, @QueryParam(RMWSConsts.APPLICATION_TYPES) Set applicationTypes, @QueryParam(RMWSConsts.APPLICATION_TAGS) Set applicationTags, + @QueryParam(RMWSConsts.NAME) String name, @QueryParam(RMWSConsts.DESELECTS) Set unselectedFields) { initForReadableEndpoints(); @@ -627,6 +628,7 @@ public class RMWebServices extends WebServices implements RMWebServiceProtocol { .withFinishTimeEnd(finishEnd) .withApplicationTypes(applicationTypes) .withApplicationTags(applicationTags) + .withName(name) .build(); List appReports; 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/TestRMWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java index e73462f9638..e4726830e93 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/TestRMWebServices.java @@ -703,12 +703,14 @@ public class TestRMWebServices extends JerseyTestBase { // verify we don't get any apps when querying HttpServletRequest mockHsr = mock(HttpServletRequest.class); AppsInfo appsInfo = webSvc.getApps(mockHsr, null, emptySet, null, - null, null, null, null, null, null, null, emptySet, emptySet, null); + null, null, null, null, null, null, null, emptySet, emptySet, null, + null); assertTrue(appsInfo.getApps().isEmpty()); // verify we don't get an NPE when specifying a final status query appsInfo = webSvc.getApps(mockHsr, null, emptySet, "FAILED", - null, null, null, null, null, null, null, emptySet, emptySet, null); + null, null, null, null, null, null, null, emptySet, emptySet, null, + null); assertTrue(appsInfo.getApps().isEmpty()); } @@ -947,7 +949,8 @@ public class TestRMWebServices extends JerseyTestBase { Set emptySet = Collections.unmodifiableSet(Collections.emptySet()); AppsInfo appsInfo = webSvc.getApps(mockHsr, null, emptySet, null, - null, null, null, null, null, null, null, emptySet, emptySet, null); + null, null, null, null, null, null, null, emptySet, emptySet, + null, null); assertEquals("Incorrect Number of Apps", 1, appsInfo.getApps().size()); assertEquals("Invalid XML Characters Present", diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java index bf0dee6c872..3dc4fddb922 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/DefaultRequestInterceptorREST.java @@ -172,7 +172,7 @@ public class DefaultRequestInterceptorREST Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields) { + Set applicationTags, String name, Set unselectedFields) { // all the params are specified inside hsr return RouterWebServiceUtil.genericForward(webAppAddress, hsr, AppsInfo.class, HTTPMethods.GET, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java index 1ed5f5929d9..a1b004c088b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/FederationInterceptorREST.java @@ -672,7 +672,7 @@ public class FederationInterceptorREST extends AbstractRESTRequestInterceptor { Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields) { + Set applicationTags, String name, Set unselectedFields) { AppsInfo apps = new AppsInfo(); long startTime = clock.getTime(); @@ -701,7 +701,7 @@ public class FederationInterceptorREST extends AbstractRESTRequestInterceptor { AppsInfo rmApps = interceptor.getApps(hsrCopy, stateQuery, statesQuery, finalStatusQuery, userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin, finishEnd, - applicationTypes, applicationTags, unselectedFields); + applicationTypes, applicationTags, name, unselectedFields); if (rmApps == null) { routerMetrics.incrMultipleAppsFailedRetrieved(); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java index 93275476555..4c694fb4c85 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/main/java/org/apache/hadoop/yarn/server/router/webapp/RouterWebServices.java @@ -433,13 +433,14 @@ public class RouterWebServices implements RMWebServiceProtocol { @QueryParam(RMWSConsts.FINISHED_TIME_END) String finishEnd, @QueryParam(RMWSConsts.APPLICATION_TYPES) Set applicationTypes, @QueryParam(RMWSConsts.APPLICATION_TAGS) Set applicationTags, + @QueryParam(RMWSConsts.NAME) String name, @QueryParam(RMWSConsts.DESELECTS) Set unselectedFields) { init(); RequestInterceptorChainWrapper pipeline = getInterceptorChain(hsr); return pipeline.getRootInterceptor().getApps(hsr, stateQuery, statesQuery, finalStatusQuery, userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin, finishEnd, applicationTypes, applicationTags, - unselectedFields); + name, unselectedFields); } @GET diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java index 78aab5a961b..b626a8a21de 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/BaseRouterWebServicesTest.java @@ -169,7 +169,8 @@ public abstract class BaseRouterWebServicesTest { protected AppsInfo getApps(String user) throws IOException, InterruptedException { return routerWebService.getApps(createHttpServletRequest(user), null, null, - null, null, null, null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null, null, null, + null); } protected ActivitiesInfo getActivities(String user) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockDefaultRequestInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockDefaultRequestInterceptorREST.java index c81a6ddbc2f..b96aa5a581c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockDefaultRequestInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockDefaultRequestInterceptorREST.java @@ -117,7 +117,7 @@ public class MockDefaultRequestInterceptorREST Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields) { + Set applicationTags, String name, Set unselectedFields) { if (!isRunning) { throw new RuntimeException("RM is stopped"); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java index 50200ed2b71..f6dbb7ff388 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/MockRESTRequestInterceptor.java @@ -128,7 +128,7 @@ public class MockRESTRequestInterceptor extends AbstractRESTRequestInterceptor { Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields) { + Set applicationTags, String name, Set unselectedFields) { return new AppsInfo(); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java index eb7222f9f3d..55de7a4a5a9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/PassThroughRESTRequestInterceptor.java @@ -153,11 +153,11 @@ public class PassThroughRESTRequestInterceptor Set statesQuery, String finalStatusQuery, String userQuery, String queueQuery, String count, String startedBegin, String startedEnd, String finishBegin, String finishEnd, Set applicationTypes, - Set applicationTags, Set unselectedFields) { + Set applicationTags, String name, Set unselectedFields) { return getNextInterceptor().getApps(hsr, stateQuery, statesQuery, finalStatusQuery, userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin, finishEnd, applicationTypes, applicationTags, - unselectedFields); + name, unselectedFields); } @Override diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorREST.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorREST.java index 0a2d9f54b39..54474e5802d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorREST.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorREST.java @@ -391,7 +391,7 @@ public class TestFederationInterceptorREST extends BaseRouterWebServicesTest { throws YarnException, IOException, InterruptedException { AppsInfo responseGet = interceptor.getApps(null, null, null, null, null, - null, null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null, null); Assert.assertNotNull(responseGet); Assert.assertEquals(NUM_SUBCLUSTER, responseGet.getApps().size()); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorRESTRetry.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorRESTRetry.java index e7b28b2f416..e563d5a5820 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorRESTRetry.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-router/src/test/java/org/apache/hadoop/yarn/server/router/webapp/TestFederationInterceptorRESTRetry.java @@ -287,7 +287,7 @@ public class TestFederationInterceptorRESTRetry setupCluster(Arrays.asList(bad2)); AppsInfo response = interceptor.getApps(null, null, null, null, null, null, - null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null); Assert.assertNull(response); } @@ -301,7 +301,7 @@ public class TestFederationInterceptorRESTRetry setupCluster(Arrays.asList(bad1, bad2)); AppsInfo response = interceptor.getApps(null, null, null, null, null, null, - null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null); Assert.assertNull(response); } @@ -315,7 +315,7 @@ public class TestFederationInterceptorRESTRetry setupCluster(Arrays.asList(good, bad2)); AppsInfo response = interceptor.getApps(null, null, null, null, null, null, - null, null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null, null); Assert.assertNotNull(response); Assert.assertEquals(1, response.getApps().size()); } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md index 8f0b46430ca..f50a3edfe16 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-site/src/site/markdown/ResourceManagerRest.md @@ -1564,6 +1564,7 @@ Multiple parameters can be specified for GET operations. The started and finishe * finishedTimeEnd - applications with finish time ending with this time, specified in ms since epoch * applicationTypes - applications matching the given application types, specified as a comma-separated list. * applicationTags - applications matching any of the given application tags, specified as a comma-separated list. + * name - name of the application * deSelects - a generic fields which will be skipped in the result. ### Elements of the *apps* (Applications) object