Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 73F5717963 for ; Thu, 12 Mar 2015 23:04:25 +0000 (UTC) Received: (qmail 36526 invoked by uid 500); 12 Mar 2015 23:04:20 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 36253 invoked by uid 500); 12 Mar 2015 23:04:20 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 35840 invoked by uid 99); 12 Mar 2015 23:04:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Mar 2015 23:04:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6AE14E1901; Thu, 12 Mar 2015 23:04:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zjshen@apache.org To: common-commits@hadoop.apache.org Date: Thu, 12 Mar 2015 23:04:22 -0000 Message-Id: In-Reply-To: <8a5b670b2d5c4b2c82ac2917e75b2ce0@git.apache.org> References: <8a5b670b2d5c4b2c82ac2917e75b2ce0@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [03/49] hadoop git commit: YARN-1809. Synchronize RM and TimeLineServer Web-UIs. Contributed by Zhijie Shen and Xuan Gong YARN-1809. Synchronize RM and TimeLineServer Web-UIs. Contributed by Zhijie Shen and Xuan Gong Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/95bfd087 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/95bfd087 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/95bfd087 Branch: refs/heads/YARN-2928 Commit: 95bfd087dc89e57a93340604cc8b96042fa1a05a Parents: 952640f Author: Jian He Authored: Thu Mar 5 21:14:41 2015 -0800 Committer: Jian He Committed: Thu Mar 5 21:20:09 2015 -0800 ---------------------------------------------------------------------- hadoop-yarn-project/CHANGES.txt | 3 + .../dev-support/findbugs-exclude.xml | 5 +- .../yarn/api/ApplicationBaseProtocol.java | 355 +++++++++++++++++++ .../yarn/api/ApplicationClientProtocol.java | 290 +-------------- .../yarn/api/ApplicationHistoryProtocol.java | 303 +--------------- .../apache/hadoop/yarn/webapp/ResponseInfo.java | 6 +- .../hadoop/yarn/webapp/YarnWebParams.java | 4 + .../hadoop/yarn/webapp/view/HtmlBlock.java | 2 + .../ApplicationHistoryClientService.java | 185 +++++----- .../ApplicationHistoryManager.java | 126 ++++++- .../ApplicationHistoryServer.java | 2 +- .../webapp/AHSView.java | 28 +- .../webapp/AHSWebApp.java | 16 +- .../webapp/AHSWebServices.java | 6 +- .../webapp/AppAttemptPage.java | 15 +- .../webapp/AppPage.java | 21 +- .../TestApplicationHistoryClientService.java | 12 +- .../webapp/TestAHSWebApp.java | 27 +- .../webapp/TestAHSWebServices.java | 26 +- .../yarn/server/api/ApplicationContext.java | 122 ------- .../yarn/server/webapp/AppAttemptBlock.java | 119 ++++--- .../hadoop/yarn/server/webapp/AppBlock.java | 274 ++++++++++++-- .../hadoop/yarn/server/webapp/AppsBlock.java | 53 ++- .../yarn/server/webapp/ContainerBlock.java | 29 +- .../hadoop/yarn/server/webapp/WebPageUtils.java | 86 +++++ .../hadoop/yarn/server/webapp/WebServices.java | 68 +++- .../hadoop/yarn/server/webapp/dao/AppInfo.java | 11 +- .../resourcemanager/webapp/AppAttemptPage.java | 55 +++ .../server/resourcemanager/webapp/AppBlock.java | 344 ------------------ .../server/resourcemanager/webapp/AppPage.java | 25 +- .../resourcemanager/webapp/AppsBlock.java | 132 ------- .../webapp/AppsBlockWithMetrics.java | 1 + .../webapp/CapacitySchedulerPage.java | 1 + .../resourcemanager/webapp/ContainerPage.java | 44 +++ .../webapp/DefaultSchedulerPage.java | 1 + .../webapp/FairSchedulerPage.java | 21 +- .../server/resourcemanager/webapp/RMWebApp.java | 5 + .../resourcemanager/webapp/RmController.java | 8 + .../server/resourcemanager/webapp/RmView.java | 31 +- .../resourcemanager/webapp/TestAppPage.java | 8 +- .../resourcemanager/webapp/TestRMWebApp.java | 48 ++- .../webapp/TestRMWebAppFairScheduler.java | 14 +- 42 files changed, 1376 insertions(+), 1556 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/CHANGES.txt ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index dcf328f..accde78 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -360,6 +360,9 @@ Release 2.7.0 - UNRELEASED YARN-3122. Metrics for container's actual CPU usage. (Anubhav Dhoot via kasha) + YARN-1809. Synchronize RM and TimeLineServer Web-UIs. (Zhijie Shen and + Xuan Gong via jianhe) + OPTIMIZATIONS YARN-2990. FairScheduler's delay-scheduling always waits for node-local and http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml index 1c3f201..a89884a 100644 --- a/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml +++ b/hadoop-yarn-project/hadoop-yarn/dev-support/findbugs-exclude.xml @@ -63,9 +63,12 @@ - + + + + http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationBaseProtocol.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationBaseProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationBaseProtocol.java new file mode 100644 index 0000000..2a8a283 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationBaseProtocol.java @@ -0,0 +1,355 @@ +/** + * 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.api; + +import java.io.IOException; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Stable; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.io.retry.Idempotent; +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.GetApplicationAttemptReportResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; +import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest; +import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse; +import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest; +import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +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.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerReport; +import org.apache.hadoop.yarn.api.records.Token; +import org.apache.hadoop.yarn.exceptions.YarnException; + +/** + *

+ * The protocol between clients and the ResourceManager or + * ApplicationHistoryServer to get information on applications, + * application attempts and containers. + *

+ * + */ +@Private +@Unstable +public interface ApplicationBaseProtocol { + + /** + *

+ * The interface used by clients to get a report of an Application from the + * ResourceManager or ApplicationHistoryServer. + *

+ * + *

+ * The client, via {@link GetApplicationReportRequest} provides the + * {@link ApplicationId} of the application. + *

+ * + *

+ * In secure mode,the ResourceManager or + * ApplicationHistoryServer verifies access to the application, + * queue etc. before accepting the request. + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetApplicationReportResponse} which includes the + * {@link ApplicationReport} for the application. + *

+ * + *

+ * If the user does not have VIEW_APP access then the following + * fields in the report will be set to stubbed values: + *

    + *
  • host - set to "N/A"
  • + *
  • RPC port - set to -1
  • + *
  • client token - set to "N/A"
  • + *
  • diagnostics - set to "N/A"
  • + *
  • tracking URL - set to "N/A"
  • + *
  • original tracking URL - set to "N/A"
  • + *
  • resource usage report - all values are -1
  • + *
+ *

+ * + * @param request + * request for an application report + * @return application report + * @throws YarnException + * @throws IOException + */ + @Public + @Stable + @Idempotent + public GetApplicationReportResponse getApplicationReport( + GetApplicationReportRequest request) throws YarnException, IOException; + + /** + *

+ * The interface used by clients to get a report of Applications matching the + * filters defined by {@link GetApplicationsRequest} in the cluster from the + * ResourceManager or ApplicationHistoryServer. + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetApplicationsResponse} which includes the + * {@link ApplicationReport} for the applications. + *

+ * + *

+ * If the user does not have VIEW_APP access for an application + * then the corresponding report will be filtered as described in + * {@link #getApplicationReport(GetApplicationReportRequest)}. + *

+ * + * @param request + * request for report on applications + * @return report on applications matching the given application types defined + * in the request + * @throws YarnException + * @throws IOException + * @see GetApplicationsRequest + */ + @Public + @Stable + @Idempotent + public GetApplicationsResponse + getApplications(GetApplicationsRequest request) throws YarnException, + IOException; + + /** + *

+ * The interface used by clients to get a report of an Application Attempt + * from the ResourceManager or + * ApplicationHistoryServer + *

+ * + *

+ * The client, via {@link GetApplicationAttemptReportRequest} provides the + * {@link ApplicationAttemptId} of the application attempt. + *

+ * + *

+ * In secure mode,the ResourceManager or + * ApplicationHistoryServer verifies access to the method before + * accepting the request. + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetApplicationAttemptReportResponse} which includes + * the {@link ApplicationAttemptReport} for the application attempt. + *

+ * + *

+ * If the user does not have VIEW_APP access then the following + * fields in the report will be set to stubbed values: + *

    + *
  • host
  • + *
  • RPC port
  • + *
  • client token
  • + *
  • diagnostics - set to "N/A"
  • + *
  • tracking URL
  • + *
+ *

+ * + * @param request + * request for an application attempt report + * @return application attempt report + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + @Idempotent + public GetApplicationAttemptReportResponse getApplicationAttemptReport( + GetApplicationAttemptReportRequest request) throws YarnException, + IOException; + + /** + *

+ * The interface used by clients to get a report of all Application attempts + * in the cluster from the ResourceManager or + * ApplicationHistoryServer + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetApplicationAttemptsRequest} which includes the + * {@link ApplicationAttemptReport} for all the applications attempts of a + * specified application attempt. + *

+ * + *

+ * If the user does not have VIEW_APP access for an application + * then the corresponding report will be filtered as described in + * {@link #getApplicationAttemptReport(GetApplicationAttemptReportRequest)}. + *

+ * + * @param request + * request for reports on all application attempts of an application + * @return reports on all application attempts of an application + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + @Idempotent + public GetApplicationAttemptsResponse getApplicationAttempts( + GetApplicationAttemptsRequest request) throws YarnException, IOException; + + /** + *

+ * The interface used by clients to get a report of an Container from the + * ResourceManager or ApplicationHistoryServer + *

+ * + *

+ * The client, via {@link GetContainerReportRequest} provides the + * {@link ContainerId} of the container. + *

+ * + *

+ * In secure mode,the ResourceManager or + * ApplicationHistoryServer verifies access to the method before + * accepting the request. + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetContainerReportResponse} which includes the + * {@link ContainerReport} for the container. + *

+ * + * @param request + * request for a container report + * @return container report + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + @Idempotent + public GetContainerReportResponse getContainerReport( + GetContainerReportRequest request) throws YarnException, IOException; + + /** + *

+ * The interface used by clients to get a report of Containers for an + * application attempt from the ResourceManager or + * ApplicationHistoryServer + *

+ * + *

+ * The client, via {@link GetContainersRequest} provides the + * {@link ApplicationAttemptId} of the application attempt. + *

+ * + *

+ * In secure mode,the ResourceManager or + * ApplicationHistoryServer verifies access to the method before + * accepting the request. + *

+ * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with a {@link GetContainersResponse} which includes a list of + * {@link ContainerReport} for all the containers of a specific application + * attempt. + *

+ * + * @param request + * request for a list of container reports of an application attempt. + * @return reports on all containers of an application attempt + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + @Idempotent + public GetContainersResponse getContainers(GetContainersRequest request) + throws YarnException, IOException; + + /** + *

+ * The interface used by clients to get delegation token, enabling the + * containers to be able to talk to the service using those tokens. + * + *

+ * The ResourceManager or ApplicationHistoryServer + * responds with the delegation {@link Token} that can be used by the client + * to speak to this service. + * + * @param request + * request to get a delegation token for the client. + * @return delegation token that can be used to talk to this service + * @throws YarnException + * @throws IOException + */ + @Public + @Stable + @Idempotent + public GetDelegationTokenResponse getDelegationToken( + GetDelegationTokenRequest request) throws YarnException, IOException; + + /** + * Renew an existing delegation {@link Token}. + * + * @param request + * the delegation token to be renewed. + * @return the new expiry time for the delegation token. + * @throws YarnException + * @throws IOException + */ + @Private + @Unstable + @Idempotent + public RenewDelegationTokenResponse renewDelegationToken( + RenewDelegationTokenRequest request) throws YarnException, IOException; + + /** + * Cancel an existing delegation {@link Token}. + * + * @param request + * the delegation token to be cancelled. + * @return an empty response. + * @throws YarnException + * @throws IOException + */ + @Private + @Unstable + @Idempotent + public CancelDelegationTokenResponse cancelDelegationToken( + CancelDelegationTokenRequest request) throws YarnException, IOException; + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java index b5f5cc0..0a7d415 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationClientProtocol.java @@ -20,33 +20,17 @@ package org.apache.hadoop.yarn.api; import java.io.IOException; -import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Stable; import org.apache.hadoop.classification.InterfaceStability.Unstable; import org.apache.hadoop.io.retry.Idempotent; -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.GetApplicationAttemptReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterMetricsResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodeLabelsRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodeLabelsResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetLabelsToNodesRequest; import org.apache.hadoop.yarn.api.protocolrecords.GetLabelsToNodesResponse; import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest; @@ -61,8 +45,6 @@ import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationRequest; import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse; import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesRequest; import org.apache.hadoop.yarn.api.protocolrecords.MoveApplicationAcrossQueuesResponse; -import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest; -import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse; import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest; import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse; import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest; @@ -71,19 +53,13 @@ import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest; import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse; import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest; import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse; -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -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.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; -import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.api.records.NodeReport; import org.apache.hadoop.yarn.api.records.ReservationId; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.ResourceRequest; -import org.apache.hadoop.yarn.api.records.Token; import org.apache.hadoop.yarn.api.records.YarnClusterMetrics; import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException; import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException; @@ -96,7 +72,7 @@ import org.apache.hadoop.yarn.exceptions.YarnException; */ @Public @Stable -public interface ApplicationClientProtocol { +public interface ApplicationClientProtocol extends ApplicationBaseProtocol { /** *

The interface used by clients to obtain a new {@link ApplicationId} for * submitting new applications.

@@ -199,44 +175,6 @@ public interface ApplicationClientProtocol { throws YarnException, IOException; /** - *

The interface used by clients to get a report of an Application from - * the ResourceManager.

- * - *

The client, via {@link GetApplicationReportRequest} provides the - * {@link ApplicationId} of the application.

- * - *

In secure mode,the ResourceManager verifies access to the - * application, queue etc. before accepting the request.

- * - *

The ResourceManager responds with a - * {@link GetApplicationReportResponse} which includes the - * {@link ApplicationReport} for the application.

- * - *

If the user does not have VIEW_APP access then the - * following fields in the report will be set to stubbed values: - *

    - *
  • host - set to "N/A"
  • - *
  • RPC port - set to -1
  • - *
  • client token - set to "N/A"
  • - *
  • diagnostics - set to "N/A"
  • - *
  • tracking URL - set to "N/A"
  • - *
  • original tracking URL - set to "N/A"
  • - *
  • resource usage report - all values are -1
  • - *

- * - * @param request request for an application report - * @return application report - * @throws YarnException - * @throws IOException - */ - @Public - @Stable - @Idempotent - public GetApplicationReportResponse getApplicationReport( - GetApplicationReportRequest request) - throws YarnException, IOException; - - /** *

The interface used by clients to get metrics about the cluster from * the ResourceManager.

* @@ -256,35 +194,7 @@ public interface ApplicationClientProtocol { public GetClusterMetricsResponse getClusterMetrics( GetClusterMetricsRequest request) throws YarnException, IOException; - - /** - *

The interface used by clients to get a report of Applications - * matching the filters defined by {@link GetApplicationsRequest} - * in the cluster from the ResourceManager.

- * - *

The ResourceManager responds with a - * {@link GetApplicationsResponse} which includes the - * {@link ApplicationReport} for the applications.

- * - *

If the user does not have VIEW_APP access for an - * application then the corresponding report will be filtered as - * described in {@link #getApplicationReport(GetApplicationReportRequest)}. - *

- * - * @param request request for report on applications - * @return report on applications matching the given application types - * defined in the request - * @throws YarnException - * @throws IOException - * @see GetApplicationsRequest - */ - @Public - @Stable - @Idempotent - public GetApplicationsResponse getApplications( - GetApplicationsRequest request) - throws YarnException, IOException; - + /** *

The interface used by clients to get a report of all nodes * in the cluster from the ResourceManager.

@@ -346,57 +256,8 @@ public interface ApplicationClientProtocol { public GetQueueUserAclsInfoResponse getQueueUserAcls( GetQueueUserAclsInfoRequest request) throws YarnException, IOException; - - /** - *

The interface used by clients to get delegation token, enabling the - * containers to be able to talk to the service using those tokens. - * - *

The ResourceManager responds with the delegation - * {@link Token} that can be used by the client to speak to this - * service. - * @param request request to get a delegation token for the client. - * @return delegation token that can be used to talk to this service - * @throws YarnException - * @throws IOException - */ - @Public - @Stable - @Idempotent - public GetDelegationTokenResponse getDelegationToken( - GetDelegationTokenRequest request) - throws YarnException, IOException; - - /** - * Renew an existing delegation {@link Token}. - * - * @param request the delegation token to be renewed. - * @return the new expiry time for the delegation token. - * @throws YarnException - * @throws IOException - */ - @Private - @Unstable - @Idempotent - public RenewDelegationTokenResponse renewDelegationToken( - RenewDelegationTokenRequest request) throws YarnException, - IOException; /** - * Cancel an existing delegation {@link Token}. - * - * @param request the delegation token to be cancelled. - * @return an empty response. - * @throws YarnException - * @throws IOException - */ - @Private - @Unstable - @Idempotent - public CancelDelegationTokenResponse cancelDelegationToken( - CancelDelegationTokenRequest request) throws YarnException, - IOException; - - /** * Move an application to a new queue. * * @param request the application ID and the target queue @@ -412,153 +273,6 @@ public interface ApplicationClientProtocol { /** *

- * The interface used by clients to get a report of an Application Attempt - * from the ResourceManager - *

- * - *

- * The client, via {@link GetApplicationAttemptReportRequest} provides the - * {@link ApplicationAttemptId} of the application attempt. - *

- * - *

- * In secure mode,the ResourceManager verifies access to - * the method before accepting the request. - *

- * - *

- * The ResourceManager responds with a - * {@link GetApplicationAttemptReportResponse} which includes the - * {@link ApplicationAttemptReport} for the application attempt. - *

- * - *

- * If the user does not have VIEW_APP access then the following - * fields in the report will be set to stubbed values: - *

    - *
  • host
  • - *
  • RPC port
  • - *
  • client token
  • - *
  • diagnostics - set to "N/A"
  • - *
  • tracking URL
  • - *
- *

- * - * @param request - * request for an application attempt report - * @return application attempt report - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - @Idempotent - public GetApplicationAttemptReportResponse getApplicationAttemptReport( - GetApplicationAttemptReportRequest request) throws YarnException, - IOException; - - /** - *

- * The interface used by clients to get a report of all Application attempts - * in the cluster from the ResourceManager - *

- * - *

- * The ResourceManager responds with a - * {@link GetApplicationAttemptsRequest} which includes the - * {@link ApplicationAttemptReport} for all the applications attempts of a - * specified application attempt. - *

- * - *

- * If the user does not have VIEW_APP access for an application - * then the corresponding report will be filtered as described in - * {@link #getApplicationAttemptReport(GetApplicationAttemptReportRequest)}. - *

- * - * @param request - * request for reports on all application attempts of an application - * @return reports on all application attempts of an application - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - @Idempotent - public GetApplicationAttemptsResponse getApplicationAttempts( - GetApplicationAttemptsRequest request) throws YarnException, IOException; - - /** - *

- * The interface used by clients to get a report of an Container from the - * ResourceManager - *

- * - *

- * The client, via {@link GetContainerReportRequest} provides the - * {@link ContainerId} of the container. - *

- * - *

- * In secure mode,the ResourceManager verifies access to the - * method before accepting the request. - *

- * - *

- * The ResourceManager responds with a - * {@link GetContainerReportResponse} which includes the - * {@link ContainerReport} for the container. - *

- * - * @param request - * request for a container report - * @return container report - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - @Idempotent - public GetContainerReportResponse getContainerReport( - GetContainerReportRequest request) throws YarnException, IOException; - - /** - *

- * The interface used by clients to get a report of Containers for an - * application attempt from the ResourceManager - *

- * - *

- * The client, via {@link GetContainersRequest} provides the - * {@link ApplicationAttemptId} of the application attempt. - *

- * - *

- * In secure mode,the ResourceManager verifies access to the - * method before accepting the request. - *

- * - *

- * The ResourceManager responds with a - * {@link GetContainersResponse} which includes a list of - * {@link ContainerReport} for all the containers of a specific application - * attempt. - *

- * - * @param request - * request for a list of container reports of an application attempt. - * @return reports on all containers of an application attempt - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - @Idempotent - public GetContainersResponse getContainers(GetContainersRequest request) - throws YarnException, IOException; - - /** - *

* The interface used by clients to submit a new reservation to the * {@code ResourceManager}. *

http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationHistoryProtocol.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationHistoryProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationHistoryProtocol.java index 0bfd2ed..fc8e885 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationHistoryProtocol.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationHistoryProtocol.java @@ -18,37 +18,8 @@ package org.apache.hadoop.yarn.api; -import java.io.IOException; - -import org.apache.hadoop.classification.InterfaceAudience.Private; import org.apache.hadoop.classification.InterfaceAudience.Public; import org.apache.hadoop.classification.InterfaceStability.Unstable; -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.GetApplicationAttemptReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse; -import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest; -import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse; -import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest; -import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse; -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -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.ContainerId; -import org.apache.hadoop.yarn.api.records.ContainerReport; -import org.apache.hadoop.yarn.api.records.Token; -import org.apache.hadoop.yarn.exceptions.YarnException; /** *

@@ -58,277 +29,5 @@ import org.apache.hadoop.yarn.exceptions.YarnException; */ @Public @Unstable -public interface ApplicationHistoryProtocol { - - /** - *

- * The interface used by clients to get a report of an Application from the - * ResourceManager. - *

- * - *

- * The client, via {@link GetApplicationReportRequest} provides the - * {@link ApplicationId} of the application. - *

- * - *

- * In secure mode,the ApplicationHistoryServer verifies access to - * the application, queue etc. before accepting the request. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetApplicationReportResponse} which includes the - * {@link ApplicationReport} for the application. - *

- * - *

- * If the user does not have VIEW_APP access then the following - * fields in the report will be set to stubbed values: - *

    - *
  • host - set to "N/A"
  • - *
  • RPC port - set to -1
  • - *
  • client token - set to "N/A"
  • - *
  • diagnostics - set to "N/A"
  • - *
  • tracking URL - set to "N/A"
  • - *
  • original tracking URL - set to "N/A"
  • - *
  • resource usage report - all values are -1
  • - *
- *

- * - * @param request - * request for an application report - * @return application report - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetApplicationReportResponse getApplicationReport( - GetApplicationReportRequest request) throws YarnException, IOException; - - /** - *

- * The interface used by clients to get a report of all Applications in the - * cluster from the ApplicationHistoryServer. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetApplicationsResponse} which includes a list of - * {@link ApplicationReport} for all the applications. - *

- * - *

- * If the user does not have VIEW_APP access for an application - * then the corresponding report will be filtered as described in - * {@link #getApplicationReport(GetApplicationReportRequest)}. - *

- * - * @param request - * request for reports on all the applications - * @return report on applications matching the given application types defined - * in the request - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetApplicationsResponse - getApplications(GetApplicationsRequest request) throws YarnException, - IOException; - - /** - *

- * The interface used by clients to get a report of an Application Attempt - * from the ApplicationHistoryServer. - *

- * - *

- * The client, via {@link GetApplicationAttemptReportRequest} provides the - * {@link ApplicationAttemptId} of the application attempt. - *

- * - *

- * In secure mode,the ApplicationHistoryServer verifies access to - * the method before accepting the request. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetApplicationAttemptReportResponse} which includes the - * {@link ApplicationAttemptReport} for the application attempt. - *

- * - *

- * If the user does not have VIEW_APP access then the following - * fields in the report will be set to stubbed values: - *

    - *
  • host
  • - *
  • RPC port
  • - *
  • client token
  • - *
  • diagnostics - set to "N/A"
  • - *
  • tracking URL
  • - *
- *

- * - * @param request - * request for an application attempt report - * @return application attempt report - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetApplicationAttemptReportResponse getApplicationAttemptReport( - GetApplicationAttemptReportRequest request) throws YarnException, - IOException; - - /** - *

- * The interface used by clients to get a report of all Application attempts - * in the cluster from the ApplicationHistoryServer. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetApplicationAttemptsRequest} which includes the - * {@link ApplicationAttemptReport} for all the applications attempts of a - * specified application attempt. - *

- * - *

- * If the user does not have VIEW_APP access for an application - * then the corresponding report will be filtered as described in - * {@link #getApplicationAttemptReport(GetApplicationAttemptReportRequest)}. - *

- * - * @param request - * request for reports on all application attempts of an application - * @return reports on all application attempts of an application - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetApplicationAttemptsResponse getApplicationAttempts( - GetApplicationAttemptsRequest request) throws YarnException, IOException; - - /** - *

- * The interface used by clients to get a report of an Container from the - * ApplicationHistoryServer. - *

- * - *

- * The client, via {@link GetContainerReportRequest} provides the - * {@link ContainerId} of the container. - *

- * - *

- * In secure mode,the ApplicationHistoryServer verifies access to - * the method before accepting the request. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetContainerReportResponse} which includes the - * {@link ContainerReport} for the container. - *

- * - * @param request - * request for a container report - * @return container report - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetContainerReportResponse getContainerReport( - GetContainerReportRequest request) throws YarnException, IOException; - - /** - *

- * The interface used by clients to get a report of Containers for an - * application attempt from the ApplciationHistoryServer. - *

- * - *

- * The client, via {@link GetContainersRequest} provides the - * {@link ApplicationAttemptId} of the application attempt. - *

- * - *

- * In secure mode,the ApplicationHistoryServer verifies access to - * the method before accepting the request. - *

- * - *

- * The ApplicationHistoryServer responds with a - * {@link GetContainersResponse} which includes a list of - * {@link ContainerReport} for all the containers of a specific application - * attempt. - *

- * - * @param request - * request for a list of container reports of an application attempt. - * @return reports on all containers of an application attempt - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetContainersResponse getContainers(GetContainersRequest request) - throws YarnException, IOException; - - /** - *

- * The interface used by clients to get delegation token, enabling the - * containers to be able to talk to the service using those tokens. - *

- * - *

- * The ApplicationHistoryServer responds with the delegation - * token {@link Token} that can be used by the client to speak to this - * service. - *

- * - * @param request - * request to get a delegation token for the client. - * @return delegation token that can be used to talk to this service - * @throws YarnException - * @throws IOException - */ - @Public - @Unstable - public GetDelegationTokenResponse getDelegationToken( - GetDelegationTokenRequest request) throws YarnException, IOException; - - /** - * Renew an existing delegation token. - * - * @param request - * the delegation token to be renewed. - * @return the new expiry time for the delegation token. - * @throws YarnException - * @throws IOException - */ - @Private - @Unstable - public RenewDelegationTokenResponse renewDelegationToken( - RenewDelegationTokenRequest request) throws YarnException, IOException; - - /** - * Cancel an existing delegation token. - * - * @param request - * the delegation token to be cancelled. - * @return an empty response. - * @throws YarnException - * @throws IOException - */ - @Private - @Unstable - public CancelDelegationTokenResponse cancelDelegationToken( - CancelDelegationTokenRequest request) throws YarnException, IOException; +public interface ApplicationHistoryProtocol extends ApplicationBaseProtocol { } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ResponseInfo.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ResponseInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ResponseInfo.java index 7e836b5..b04bc5d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ResponseInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/ResponseInfo.java @@ -81,7 +81,11 @@ public class ResponseInfo implements Iterable { } public ResponseInfo _(String key, String url, Object anchor) { - items.add(Item.of(key, url, anchor)); + if (url == null) { + items.add(Item.of(key, anchor, false)); + } else { + items.add(Item.of(key, url, anchor)); + } return this; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnWebParams.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnWebParams.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnWebParams.java index 62c3c7a..1200690 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnWebParams.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnWebParams.java @@ -22,6 +22,9 @@ import org.apache.hadoop.classification.InterfaceAudience; @InterfaceAudience.LimitedPrivate({"YARN", "MapReduce"}) public interface YarnWebParams { + static final String RM_WEB_UI = "ResourceManager"; + static final String APP_HISTORY_WEB_UI = "ApplicationHistoryServer"; + String NM_NODENAME = "nm.id"; String APPLICATION_ID = "app.id"; String APPLICATION_ATTEMPT_ID = "appattempt.id"; @@ -33,4 +36,5 @@ public interface YarnWebParams { String QUEUE_NAME = "queue.name"; String NODE_STATE = "node.state"; String NODE_LABEL = "node.label"; + String WEB_UI_TYPE = "web.ui.type"; } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlBlock.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlBlock.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlBlock.java index 6ee0d1c..a785c0c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlBlock.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/view/HtmlBlock.java @@ -30,6 +30,8 @@ import org.apache.hadoop.yarn.webapp.hamlet.Hamlet; @InterfaceAudience.LimitedPrivate({"YARN", "MapReduce"}) public abstract class HtmlBlock extends TextView implements SubView { + protected static final String UNAVAILABLE = "N/A"; + public class Block extends Hamlet { Block(PrintWriter out, int level, boolean wasInline) { super(out, level, wasInline); http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java index 8da1ea1..e64ca14 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryClientService.java @@ -56,27 +56,23 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ContainerId; import org.apache.hadoop.yarn.api.records.ContainerReport; import org.apache.hadoop.yarn.conf.YarnConfiguration; -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.ipc.YarnRPC; import org.apache.hadoop.yarn.server.timeline.security.authorize.TimelinePolicyProvider; import com.google.common.base.Preconditions; -public class ApplicationHistoryClientService extends AbstractService { +public class ApplicationHistoryClientService extends AbstractService implements + ApplicationHistoryProtocol { private static final Log LOG = LogFactory .getLog(ApplicationHistoryClientService.class); private ApplicationHistoryManager history; - private ApplicationHistoryProtocol protocolHandler; private Server server; private InetSocketAddress bindAddress; public ApplicationHistoryClientService(ApplicationHistoryManager history) { super("ApplicationHistoryClientService"); this.history = history; - this.protocolHandler = new ApplicationHSClientProtocolHandler(); } protected void serviceStart() throws Exception { @@ -95,7 +91,7 @@ public class ApplicationHistoryClientService extends AbstractService { YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT); server = - rpc.getServer(ApplicationHistoryProtocol.class, protocolHandler, + rpc.getServer(ApplicationHistoryProtocol.class, this, address, conf, null, conf.getInt( YarnConfiguration.TIMELINE_SERVICE_HANDLER_THREAD_COUNT, YarnConfiguration.DEFAULT_TIMELINE_SERVICE_CLIENT_THREAD_COUNT)); @@ -127,11 +123,6 @@ public class ApplicationHistoryClientService extends AbstractService { } @Private - public ApplicationHistoryProtocol getClientHandler() { - return this.protocolHandler; - } - - @Private public InetSocketAddress getBindAddress() { return this.bindAddress; } @@ -141,109 +132,97 @@ public class ApplicationHistoryClientService extends AbstractService { this.server.refreshServiceAcl(configuration, policyProvider); } - private class ApplicationHSClientProtocolHandler implements - ApplicationHistoryProtocol { - - @Override - public CancelDelegationTokenResponse cancelDelegationToken( - CancelDelegationTokenRequest request) throws YarnException, IOException { - // TODO Auto-generated method stub - return null; - } - - @Override - public GetApplicationAttemptReportResponse getApplicationAttemptReport( - GetApplicationAttemptReportRequest request) throws YarnException, - IOException { - ApplicationAttemptId appAttemptId = request.getApplicationAttemptId(); - try { - GetApplicationAttemptReportResponse response = - GetApplicationAttemptReportResponse.newInstance(history - .getApplicationAttempt(appAttemptId)); - return response; - } catch (IOException e) { - String msg = "ApplicationAttempt with id '" + appAttemptId + - "' doesn't exist in the history store."; - LOG.error(msg, e); - throw new ApplicationAttemptNotFoundException(msg); - } - } + @Override + public CancelDelegationTokenResponse cancelDelegationToken( + CancelDelegationTokenRequest request) throws YarnException, IOException { + // TODO Auto-generated method stub + return null; + } - @Override - public GetApplicationAttemptsResponse getApplicationAttempts( - GetApplicationAttemptsRequest request) throws YarnException, - IOException { - GetApplicationAttemptsResponse response = - GetApplicationAttemptsResponse - .newInstance(new ArrayList(history - .getApplicationAttempts(request.getApplicationId()).values())); + @Override + public GetApplicationAttemptReportResponse getApplicationAttemptReport( + GetApplicationAttemptReportRequest request) throws YarnException, + IOException { + ApplicationAttemptId appAttemptId = request.getApplicationAttemptId(); + try { + GetApplicationAttemptReportResponse response = + GetApplicationAttemptReportResponse.newInstance(history + .getApplicationAttempt(appAttemptId)); return response; + } catch (IOException e) { + LOG.error(e.getMessage(), e); + throw e; } + } - @Override - public GetApplicationReportResponse getApplicationReport( - GetApplicationReportRequest request) throws YarnException, IOException { - ApplicationId applicationId = request.getApplicationId(); - try { - GetApplicationReportResponse response = - GetApplicationReportResponse.newInstance(history - .getApplication(applicationId)); - return response; - } catch (IOException e) { - String msg = "Application with id '" + applicationId + - "' doesn't exist in the history store."; - LOG.error(msg, e); - throw new ApplicationNotFoundException(msg); - } - } + @Override + public GetApplicationAttemptsResponse getApplicationAttempts( + GetApplicationAttemptsRequest request) throws YarnException, IOException { + GetApplicationAttemptsResponse response = + GetApplicationAttemptsResponse + .newInstance(new ArrayList(history + .getApplicationAttempts(request.getApplicationId()).values())); + return response; + } - @Override - public GetApplicationsResponse getApplications( - GetApplicationsRequest request) throws YarnException, IOException { - GetApplicationsResponse response = - GetApplicationsResponse.newInstance(new ArrayList( - history.getAllApplications().values())); + @Override + public GetApplicationReportResponse getApplicationReport( + GetApplicationReportRequest request) throws YarnException, IOException { + ApplicationId applicationId = request.getApplicationId(); + try { + GetApplicationReportResponse response = + GetApplicationReportResponse.newInstance(history + .getApplication(applicationId)); return response; + } catch (IOException e) { + LOG.error(e.getMessage(), e); + throw e; } + } - @Override - public GetContainerReportResponse getContainerReport( - GetContainerReportRequest request) throws YarnException, IOException { - ContainerId containerId = request.getContainerId(); - try { - GetContainerReportResponse response = - GetContainerReportResponse.newInstance( - history.getContainer(containerId)); - return response; - } catch (IOException e) { - String msg = "Container with id '" + containerId + - "' doesn't exist in the history store."; - LOG.error(msg, e); - throw new ContainerNotFoundException(msg); - } - } + @Override + public GetApplicationsResponse + getApplications(GetApplicationsRequest request) throws YarnException, + IOException { + GetApplicationsResponse response = + GetApplicationsResponse.newInstance(new ArrayList( + history.getAllApplications().values())); + return response; + } - @Override - public GetContainersResponse getContainers(GetContainersRequest request) - throws YarnException, IOException { - GetContainersResponse response = - GetContainersResponse.newInstance(new ArrayList( - history.getContainers(request.getApplicationAttemptId()).values())); + @Override + public GetContainerReportResponse getContainerReport( + GetContainerReportRequest request) throws YarnException, IOException { + ContainerId containerId = request.getContainerId(); + try { + GetContainerReportResponse response = + GetContainerReportResponse.newInstance(history + .getContainer(containerId)); return response; + } catch (IOException e) { + LOG.error(e.getMessage(), e); + throw e; } + } - @Override - public GetDelegationTokenResponse getDelegationToken( - GetDelegationTokenRequest request) throws YarnException, IOException { - // TODO Auto-generated method stub - return null; - } + @Override + public GetContainersResponse getContainers(GetContainersRequest request) + throws YarnException, IOException { + GetContainersResponse response = + GetContainersResponse.newInstance(new ArrayList( + history.getContainers(request.getApplicationAttemptId()).values())); + return response; + } - @Override - public RenewDelegationTokenResponse renewDelegationToken( - RenewDelegationTokenRequest request) throws YarnException, IOException { - // TODO Auto-generated method stub - return null; - } + @Override + public GetDelegationTokenResponse getDelegationToken( + GetDelegationTokenRequest request) throws YarnException, IOException { + return null; + } + + @Override + public RenewDelegationTokenResponse renewDelegationToken( + RenewDelegationTokenRequest request) throws YarnException, IOException { + return null; } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManager.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManager.java index db25d29..041c31b 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManager.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryManager.java @@ -18,11 +18,125 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice; -import org.apache.hadoop.classification.InterfaceAudience; -import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.yarn.server.api.ApplicationContext; +import java.io.IOException; +import java.util.Map; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; +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.ContainerId; +import org.apache.hadoop.yarn.api.records.ContainerReport; +import org.apache.hadoop.yarn.exceptions.YarnException; + +@Private +@Unstable +public interface ApplicationHistoryManager { + /** + * This method returns Application {@link ApplicationReport} for the specified + * {@link ApplicationId}. + * + * @param appId + * + * @return {@link ApplicationReport} for the ApplicationId. + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + ApplicationReport getApplication(ApplicationId appId) throws YarnException, + IOException; + + /** + * This method returns all Application {@link ApplicationReport}s + * + * @return map of {@link ApplicationId} to {@link ApplicationReport}s. + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + Map getAllApplications() + throws YarnException, IOException; + + /** + * Application can have multiple application attempts + * {@link ApplicationAttemptReport}. This method returns the all + * {@link ApplicationAttemptReport}s for the Application. + * + * @param appId + * + * @return all {@link ApplicationAttemptReport}s for the Application. + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + Map getApplicationAttempts( + ApplicationId appId) throws YarnException, IOException; + + /** + * This method returns {@link ApplicationAttemptReport} for specified + * {@link ApplicationId}. + * + * @param appAttemptId + * {@link ApplicationAttemptId} + * @return {@link ApplicationAttemptReport} for ApplicationAttemptId + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + ApplicationAttemptReport getApplicationAttempt( + ApplicationAttemptId appAttemptId) throws YarnException, IOException; + + /** + * This method returns {@link ContainerReport} for specified + * {@link ContainerId}. + * + * @param containerId + * {@link ContainerId} + * @return {@link ContainerReport} for ContainerId + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + ContainerReport getContainer(ContainerId containerId) throws YarnException, + IOException; + + /** + * This method returns {@link ContainerReport} for specified + * {@link ApplicationAttemptId}. + * + * @param appAttemptId + * {@link ApplicationAttemptId} + * @return {@link ContainerReport} for ApplicationAttemptId + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + ContainerReport getAMContainer(ApplicationAttemptId appAttemptId) + throws YarnException, IOException; + + /** + * This method returns Map of {@link ContainerId} to {@link ContainerReport} + * for specified {@link ApplicationAttemptId}. + * + * @param appAttemptId + * {@link ApplicationAttemptId} + * @return Map of {@link ContainerId} to {@link ContainerReport} for + * ApplicationAttemptId + * @throws YarnException + * @throws IOException + */ + @Public + @Unstable + Map getContainers( + ApplicationAttemptId appAttemptId) throws YarnException, IOException; -@InterfaceAudience.Public -@InterfaceStability.Unstable -public interface ApplicationHistoryManager extends ApplicationContext { } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java index 0bafd36..88cd153 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/ApplicationHistoryServer.java @@ -272,7 +272,7 @@ public class ApplicationHistoryServer extends CompositeService { .$for("applicationhistory", ApplicationHistoryClientService.class, ahsClientService, "ws") .with(conf).at(bindAddress).start( - new AHSWebApp(timelineDataManager, historyManager)); + new AHSWebApp(timelineDataManager, ahsClientService)); } catch (Exception e) { String msg = "AHSWebApp failed to start."; LOG.error(msg, e); http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java ---------------------------------------------------------------------- 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/AHSView.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java index 4baa75d..152364e 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSView.java @@ -25,9 +25,8 @@ import static org.apache.hadoop.yarn.webapp.view.JQueryUI.ACCORDION_ID; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; - import org.apache.hadoop.yarn.server.webapp.AppsBlock; +import org.apache.hadoop.yarn.server.webapp.WebPageUtils; import org.apache.hadoop.yarn.webapp.SubView; import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout; @@ -41,7 +40,7 @@ public class AHSView extends TwoColumnLayout { protected void preHead(Page.HTML<_> html) { commonPreHead(html); set(DATATABLES_ID, "apps"); - set(initID(DATATABLES, "apps"), appsTableInit()); + set(initID(DATATABLES, "apps"), WebPageUtils.appsTableInit()); setTableStyles(html, "apps", ".queue {width:6em}", ".ui {width:8em}"); // Set the correct title. @@ -64,27 +63,4 @@ public class AHSView extends TwoColumnLayout { protected Class content() { return AppsBlock.class; } - - private String appsTableInit() { - // id, user, name, queue, starttime, finishtime, state, status, progress, ui - return tableInit().append(", 'aaData': appsTableData") - .append(", bDeferRender: true").append(", bProcessing: true") - - .append("\n, aoColumnDefs: ").append(getAppsTableColumnDefs()) - - // Sort by id upon page load - .append(", aaSorting: [[0, 'desc']]}").toString(); - } - - protected String getAppsTableColumnDefs() { - StringBuilder sb = new StringBuilder(); - return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") - .append(", 'mRender': parseHadoopID }") - - .append("\n, {'sType':'numeric', 'aTargets': [5, 6]") - .append(", 'mRender': renderHadoopDate }") - - .append("\n, {'sType':'numeric', bSearchable:false, 'aTargets': [9]") - .append(", 'mRender': parseHadoopProgress }]").toString(); - } } http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java ---------------------------------------------------------------------- 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/AHSWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java index 814752b..4b579c6 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebApp.java @@ -19,8 +19,8 @@ package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; import static org.apache.hadoop.yarn.util.StringHelper.pajoin; -import org.apache.hadoop.yarn.server.api.ApplicationContext; -import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryManager; +import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; +import org.apache.hadoop.yarn.server.applicationhistoryservice.ApplicationHistoryClientService; import org.apache.hadoop.yarn.server.timeline.TimelineDataManager; import org.apache.hadoop.yarn.server.timeline.webapp.TimelineWebServices; import org.apache.hadoop.yarn.webapp.GenericExceptionHandler; @@ -30,17 +30,17 @@ import org.apache.hadoop.yarn.webapp.YarnWebParams; public class AHSWebApp extends WebApp implements YarnWebParams { - private ApplicationHistoryManager applicationHistoryManager; + private final ApplicationHistoryClientService historyClientService; private TimelineDataManager timelineDataManager; public AHSWebApp(TimelineDataManager timelineDataManager, - ApplicationHistoryManager applicationHistoryManager) { + ApplicationHistoryClientService historyClientService) { this.timelineDataManager = timelineDataManager; - this.applicationHistoryManager = applicationHistoryManager; + this.historyClientService = historyClientService; } - public ApplicationHistoryManager getApplicationHistoryManager() { - return applicationHistoryManager; + public ApplicationHistoryClientService getApplicationHistoryClientService() { + return historyClientService; } public TimelineDataManager getTimelineDataManager() { @@ -53,7 +53,7 @@ public class AHSWebApp extends WebApp implements YarnWebParams { bind(AHSWebServices.class); bind(TimelineWebServices.class); bind(GenericExceptionHandler.class); - bind(ApplicationContext.class).toInstance(applicationHistoryManager); + bind(ApplicationBaseProtocol.class).toInstance(historyClientService); bind(TimelineDataManager.class).toInstance(timelineDataManager); route("/", AHSController.class); route(pajoin("/apps", APP_STATE), AHSController.class); http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AHSWebServices.java ---------------------------------------------------------------------- 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 2af4027..9edc9ab 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 @@ -33,7 +33,7 @@ import javax.ws.rs.core.MediaType; import org.apache.hadoop.util.StringUtils; import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.server.api.ApplicationContext; +import org.apache.hadoop.yarn.api.ApplicationBaseProtocol; import org.apache.hadoop.yarn.server.webapp.WebServices; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptInfo; import org.apache.hadoop.yarn.server.webapp.dao.AppAttemptsInfo; @@ -51,8 +51,8 @@ import com.google.inject.Singleton; public class AHSWebServices extends WebServices { @Inject - public AHSWebServices(ApplicationContext appContext) { - super(appContext); + public AHSWebServices(ApplicationBaseProtocol appBaseProt) { + super(appBaseProt); } @GET http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java ---------------------------------------------------------------------- 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/AppAttemptPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java index 63b44bd..1e0a342 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppAttemptPage.java @@ -21,9 +21,8 @@ import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; - import org.apache.hadoop.yarn.server.webapp.AppAttemptBlock; +import org.apache.hadoop.yarn.server.webapp.WebPageUtils; import org.apache.hadoop.yarn.webapp.SubView; import org.apache.hadoop.yarn.webapp.YarnWebParams; @@ -41,7 +40,7 @@ public class AppAttemptPage extends AHSView { $(YarnWebParams.APPLICATION_ATTEMPT_ID))); set(DATATABLES_ID, "containers"); - set(initID(DATATABLES, "containers"), containersTableInit()); + set(initID(DATATABLES, "containers"), WebPageUtils.containersTableInit()); setTableStyles(html, "containers", ".queue {width:6em}", ".ui {width:8em}"); } @@ -50,16 +49,6 @@ public class AppAttemptPage extends AHSView { return AppAttemptBlock.class; } - private String containersTableInit() { - return tableInit().append(", 'aaData': containersTableData") - .append(", bDeferRender: true").append(", bProcessing: true") - - .append("\n, aoColumnDefs: ").append(getContainersTableColumnDefs()) - - // Sort by id upon page load - .append(", aaSorting: [[0, 'desc']]}").toString(); - } - protected String getContainersTableColumnDefs() { StringBuilder sb = new StringBuilder(); return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java ---------------------------------------------------------------------- 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/AppPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java index 96ca659..cf92c1d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AppPage.java @@ -22,9 +22,8 @@ import static org.apache.hadoop.yarn.util.StringHelper.join; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.DATATABLES_ID; import static org.apache.hadoop.yarn.webapp.view.JQueryUI.initID; -import static org.apache.hadoop.yarn.webapp.view.JQueryUI.tableInit; - import org.apache.hadoop.yarn.server.webapp.AppBlock; +import org.apache.hadoop.yarn.server.webapp.WebPageUtils; import org.apache.hadoop.yarn.webapp.SubView; import org.apache.hadoop.yarn.webapp.YarnWebParams; @@ -40,9 +39,13 @@ public class AppPage extends AHSView { appId.isEmpty() ? "Bad request: missing application ID" : join( "Application ", $(YarnWebParams.APPLICATION_ID))); - set(DATATABLES_ID, "attempts"); - set(initID(DATATABLES, "attempts"), attemptsTableInit()); + set(DATATABLES_ID, "attempts ResourceRequests"); + set(initID(DATATABLES, "attempts"), WebPageUtils.attemptsTableInit()); setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}"); + + setTableStyles(html, "ResourceRequests"); + + set(YarnWebParams.WEB_UI_TYPE, YarnWebParams.APP_HISTORY_WEB_UI); } @Override @@ -50,16 +53,6 @@ public class AppPage extends AHSView { return AppBlock.class; } - private String attemptsTableInit() { - return tableInit().append(", 'aaData': attemptsTableData") - .append(", bDeferRender: true").append(", bProcessing: true") - - .append("\n, aoColumnDefs: ").append(getAttemptsTableColumnDefs()) - - // Sort by id upon page load - .append(", aaSorting: [[0, 'desc']]}").toString(); - } - protected String getAttemptsTableColumnDefs() { StringBuilder sb = new StringBuilder(); return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]") http://git-wip-us.apache.org/repos/asf/hadoop/blob/95bfd087/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java index 32d011e..d03b26d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/test/java/org/apache/hadoop/yarn/server/applicationhistoryservice/TestApplicationHistoryClientService.java @@ -77,7 +77,7 @@ public class TestApplicationHistoryClientService { GetApplicationReportRequest request = GetApplicationReportRequest.newInstance(appId); GetApplicationReportResponse response = - clientService.getClientHandler().getApplicationReport(request); + clientService.getApplicationReport(request); ApplicationReport appReport = response.getApplicationReport(); Assert.assertNotNull(appReport); Assert.assertEquals(123, appReport.getApplicationResourceUsageReport() @@ -98,7 +98,7 @@ public class TestApplicationHistoryClientService { ApplicationId appId1 = ApplicationId.newInstance(0, 2); GetApplicationsRequest request = GetApplicationsRequest.newInstance(); GetApplicationsResponse response = - clientService.getClientHandler().getApplications(request); + clientService.getApplications(request); List appReport = response.getApplicationList(); Assert.assertNotNull(appReport); Assert.assertEquals(appId, appReport.get(0).getApplicationId()); @@ -113,7 +113,7 @@ public class TestApplicationHistoryClientService { GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest.newInstance(appAttemptId); GetApplicationAttemptReportResponse response = - clientService.getClientHandler().getApplicationAttemptReport(request); + clientService.getApplicationAttemptReport(request); ApplicationAttemptReport attemptReport = response.getApplicationAttemptReport(); Assert.assertNotNull(attemptReport); @@ -131,7 +131,7 @@ public class TestApplicationHistoryClientService { GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest.newInstance(appId); GetApplicationAttemptsResponse response = - clientService.getClientHandler().getApplicationAttempts(request); + clientService.getApplicationAttempts(request); List attemptReports = response.getApplicationAttemptList(); Assert.assertNotNull(attemptReports); @@ -150,7 +150,7 @@ public class TestApplicationHistoryClientService { GetContainerReportRequest request = GetContainerReportRequest.newInstance(containerId); GetContainerReportResponse response = - clientService.getClientHandler().getContainerReport(request); + clientService.getContainerReport(request); ContainerReport container = response.getContainerReport(); Assert.assertNotNull(container); Assert.assertEquals(containerId, container.getContainerId()); @@ -169,7 +169,7 @@ public class TestApplicationHistoryClientService { GetContainersRequest request = GetContainersRequest.newInstance(appAttemptId); GetContainersResponse response = - clientService.getClientHandler().getContainers(request); + clientService.getContainers(request); List containers = response.getContainerList(); Assert.assertNotNull(containers); Assert.assertEquals(containerId, containers.get(0).getContainerId());