YARN-1605. Fixed formatting issues in the new module on branch YARN-321. Contributed by Vinod Kumar Vavilapalli.
svn merge --ignore-ancestry -c 1559004 ../YARN-321 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1562219 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4a3b6b7367
commit
1c8e403fdd
|
@ -87,6 +87,9 @@ Branch YARN-321: Generic ApplicationHistoryService
|
|||
YARN-1595. Made enabling history service configurable and fixed test failures on
|
||||
branch YARN-321. (Vinod Kumar Vavilapalli via zjshen)
|
||||
|
||||
YARN-1605. Fixed formatting issues in the new module on branch YARN-321. (Vinod
|
||||
Kumar Vavilapalli via zjshen)
|
||||
|
||||
Release 2.4.0 - UNRELEASED
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -51,41 +51,54 @@ import org.apache.hadoop.yarn.api.records.Token;
|
|||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
|
||||
/**
|
||||
* <p>The protocol between clients and the <code>ApplicationHistoryServer</code>
|
||||
* to get the information of completed applications etc.</p>
|
||||
* <p>
|
||||
* The protocol between clients and the <code>ApplicationHistoryServer</code> to
|
||||
* get the information of completed applications etc.
|
||||
* </p>
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public interface ApplicationHistoryProtocol {
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of an Application from
|
||||
* the <code>ResourceManager</code>.</p>
|
||||
*
|
||||
* <p>The client, via {@link GetApplicationReportRequest} provides the
|
||||
* {@link ApplicationId} of the application.</p>
|
||||
*
|
||||
* <p> In secure mode,the <code>ApplicationHistoryServer</code> verifies
|
||||
* access to the application, queue etc. before accepting the request.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationReportResponse} which includes the
|
||||
* {@link ApplicationReport} for the application.</p>
|
||||
*
|
||||
* <p>If the user does not have <code>VIEW_APP</code> access then the
|
||||
* following fields in the report will be set to stubbed values:
|
||||
* <p>
|
||||
* The interface used by clients to get a report of an Application from the
|
||||
* <code>ResourceManager</code>.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The client, via {@link GetApplicationReportRequest} provides the
|
||||
* {@link ApplicationId} of the application.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* In secure mode,the <code>ApplicationHistoryServer</code> verifies access to
|
||||
* the application, queue etc. before accepting the request.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationReportResponse} which includes the
|
||||
* {@link ApplicationReport} for the application.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If the user does not have <code>VIEW_APP</code> access then the following
|
||||
* fields in the report will be set to stubbed values:
|
||||
* <ul>
|
||||
* <li>host - set to "N/A"</li>
|
||||
* <li>RPC port - set to -1</li>
|
||||
* <li>client token - set to "N/A"</li>
|
||||
* <li>diagnostics - set to "N/A"</li>
|
||||
* <li>tracking URL - set to "N/A"</li>
|
||||
* <li>original tracking URL - set to "N/A"</li>
|
||||
* <li>resource usage report - all values are -1</li>
|
||||
* </ul></p>
|
||||
*
|
||||
* @param request request for an application report
|
||||
* @return application report
|
||||
* <li>host - set to "N/A"</li>
|
||||
* <li>RPC port - set to -1</li>
|
||||
* <li>client token - set to "N/A"</li>
|
||||
* <li>diagnostics - set to "N/A"</li>
|
||||
* <li>tracking URL - set to "N/A"</li>
|
||||
* <li>original tracking URL - set to "N/A"</li>
|
||||
* <li>resource usage report - all values are -1</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @param request
|
||||
* request for an application report
|
||||
* @return application report
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -95,52 +108,67 @@ public interface ApplicationHistoryProtocol {
|
|||
GetApplicationReportRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of all Applications
|
||||
* in the cluster from the <code>ApplicationHistoryServer</code>.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationsResponse} which includes a list of
|
||||
* {@link ApplicationReport} for all the applications.</p>
|
||||
*
|
||||
* <p>If the user does not have <code>VIEW_APP</code> access for an
|
||||
* application then the corresponding report will be filtered as
|
||||
* described in {@link #getApplicationReport(GetApplicationReportRequest)}.
|
||||
* <p>
|
||||
* The interface used by clients to get a report of all Applications in the
|
||||
* cluster from the <code>ApplicationHistoryServer</code>.
|
||||
* </p>
|
||||
*
|
||||
* @param request request for reports on all the applications
|
||||
* @return report on applications matching the given application types
|
||||
* defined in the request
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationsResponse} which includes a list of
|
||||
* {@link ApplicationReport} for all the applications.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If the user does not have <code>VIEW_APP</code> access for an application
|
||||
* then the corresponding report will be filtered as described in
|
||||
* {@link #getApplicationReport(GetApplicationReportRequest)}.
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
|
||||
public GetApplicationsResponse
|
||||
getApplications(GetApplicationsRequest request) throws YarnException,
|
||||
IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of an Application Attempt
|
||||
* from the <code>ApplicationHistoryServer</code>.</p>
|
||||
*
|
||||
* <p>The client, via {@link GetApplicationAttemptReportRequest} provides the
|
||||
* {@link ApplicationAttemptId} of the application attempt.</p>
|
||||
*
|
||||
* <p>In secure mode,the <code>ApplicationHistoryServer</code> verifies access
|
||||
* to the method before accepting the request.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* <p>
|
||||
* The interface used by clients to get a report of an Application Attempt
|
||||
* from the <code>ApplicationHistoryServer</code>.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The client, via {@link GetApplicationAttemptReportRequest} provides the
|
||||
* {@link ApplicationAttemptId} of the application attempt.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* In secure mode,the <code>ApplicationHistoryServer</code> verifies access to
|
||||
* the method before accepting the request.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationAttemptReportResponse} which includes the
|
||||
* {@link ApplicationAttemptReport} for the application attempt.</p>
|
||||
*
|
||||
* {@link ApplicationAttemptReport} for the application attempt.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* If the user does not have <code>VIEW_APP</code> access then the following
|
||||
* fields in the report will be set to stubbed values:
|
||||
* <ul>
|
||||
* <li>host </li>
|
||||
* <li>RPC port </li>
|
||||
* <li>client token </li>
|
||||
* <li>host</li>
|
||||
* <li>RPC port</li>
|
||||
* <li>client token</li>
|
||||
* <li>diagnostics - set to "N/A"</li>
|
||||
* <li>tracking URL </li>
|
||||
* <li>tracking URL</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
|
@ -157,17 +185,23 @@ public interface ApplicationHistoryProtocol {
|
|||
IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of all Application
|
||||
* attempts in the cluster from the <code>ApplicationHistoryServer</code>.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* <p>
|
||||
* The interface used by clients to get a report of all Application attempts
|
||||
* in the cluster from the <code>ApplicationHistoryServer</code>.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationAttemptsRequest} which includes the
|
||||
* {@link ApplicationAttemptReport} for all the applications attempts of a
|
||||
* specified application attempt.</p>
|
||||
* specified application attempt.
|
||||
* </p>
|
||||
*
|
||||
* <p>If the user does not have <code>VIEW_APP</code> access for an application
|
||||
* <p>
|
||||
* If the user does not have <code>VIEW_APP</code> access for an application
|
||||
* then the corresponding report will be filtered as described in
|
||||
* {@link #getApplicationAttemptReport(GetApplicationAttemptReportRequest)}.</p>
|
||||
* {@link #getApplicationAttemptReport(GetApplicationAttemptReportRequest)}.
|
||||
* </p>
|
||||
*
|
||||
* @param request
|
||||
* request for reports on all application attempts of an application
|
||||
|
@ -179,20 +213,28 @@ public interface ApplicationHistoryProtocol {
|
|||
@Unstable
|
||||
public GetApplicationAttemptsResponse getApplicationAttempts(
|
||||
GetApplicationAttemptsRequest request) throws YarnException, IOException;
|
||||
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of an Container from the
|
||||
* <code>ApplicationHistoryServer</code>.</p>
|
||||
* <p>
|
||||
* The interface used by clients to get a report of an Container from the
|
||||
* <code>ApplicationHistoryServer</code>.
|
||||
* </p>
|
||||
*
|
||||
* <p>The client, via {@link GetContainerReportRequest} provides the
|
||||
* {@link ContainerId} of the container.</p>
|
||||
* <p>
|
||||
* The client, via {@link GetContainerReportRequest} provides the
|
||||
* {@link ContainerId} of the container.
|
||||
* </p>
|
||||
*
|
||||
* <p>In secure mode,the <code>ApplicationHistoryServer</code> verifies access
|
||||
* to the method before accepting the request.</p>
|
||||
* <p>
|
||||
* In secure mode,the <code>ApplicationHistoryServer</code> verifies access to
|
||||
* the method before accepting the request.
|
||||
* </p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetContainerReportResponse} which includes the
|
||||
* {@link ContainerReport} for the container.</p>
|
||||
* {@link ContainerReport} for the container.
|
||||
* </p>
|
||||
*
|
||||
* @param request
|
||||
* request for a container report
|
||||
|
@ -206,19 +248,27 @@ public interface ApplicationHistoryProtocol {
|
|||
GetContainerReportRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of Containers for an
|
||||
* application attempt from the <code>ApplciationHistoryServer</code>.</p>
|
||||
* <p>
|
||||
* The interface used by clients to get a report of Containers for an
|
||||
* application attempt from the <code>ApplciationHistoryServer</code>.
|
||||
* </p>
|
||||
*
|
||||
* <p>The client, via {@link GetContainersRequest} provides the
|
||||
* {@link ApplicationAttemptId} of the application attempt.</p>
|
||||
* <p>
|
||||
* The client, via {@link GetContainersRequest} provides the
|
||||
* {@link ApplicationAttemptId} of the application attempt.
|
||||
* </p>
|
||||
*
|
||||
* <p>In secure mode,the <code>ApplicationHistoryServer</code> verifies access
|
||||
* to the method before accepting the request.</p>
|
||||
* <p>
|
||||
* In secure mode,the <code>ApplicationHistoryServer</code> verifies access to
|
||||
* the method before accepting the request.
|
||||
* </p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetContainersResponse} which includes a list of
|
||||
* {@link ContainerReport} for all the containers of a specific application
|
||||
* attempt.</p>
|
||||
* attempt.
|
||||
* </p>
|
||||
*
|
||||
* @param request
|
||||
* request for a list of container reports of an application attempt.
|
||||
|
@ -230,16 +280,21 @@ public interface ApplicationHistoryProtocol {
|
|||
@Unstable
|
||||
public GetContainersResponse getContainers(GetContainersRequest request)
|
||||
throws YarnException, IOException;
|
||||
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get delegation token, enabling the
|
||||
* containers to be able to talk to the service using those tokens.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with the delegation
|
||||
* <p>
|
||||
* The interface used by clients to get delegation token, enabling the
|
||||
* containers to be able to talk to the service using those tokens.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationHistoryServer</code> responds with the delegation
|
||||
* token {@link Token} that can be used by the client to speak to this
|
||||
* service.</p>
|
||||
*
|
||||
* @param request request to get a delegation token for the client.
|
||||
* service.
|
||||
* </p>
|
||||
*
|
||||
* @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
|
||||
|
@ -248,11 +303,12 @@ public interface ApplicationHistoryProtocol {
|
|||
@Unstable
|
||||
public GetDelegationTokenResponse getDelegationToken(
|
||||
GetDelegationTokenRequest request) throws YarnException, IOException;
|
||||
|
||||
|
||||
/**
|
||||
* Renew an existing delegation token.
|
||||
*
|
||||
* @param request the delegation token to be renewed.
|
||||
* @param request
|
||||
* the delegation token to be renewed.
|
||||
* @return the new expiry time for the delegation token.
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
|
@ -265,7 +321,8 @@ public interface ApplicationHistoryProtocol {
|
|||
/**
|
||||
* Cancel an existing delegation token.
|
||||
*
|
||||
* @param request the delegation token to be cancelled.
|
||||
* @param request
|
||||
* the delegation token to be cancelled.
|
||||
* @return an empty response.
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
|
|
|
@ -26,12 +26,16 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The request sent by a client to the <code>ResourceManager</code> to get
|
||||
* an {@link ApplicationAttemptReport} for an application attempt.</p>
|
||||
*
|
||||
* <p>The request should include the {@link ApplicationAttemptId} of the
|
||||
* application attempt.</p>
|
||||
*
|
||||
* <p>
|
||||
* The request sent by a client to the <code>ResourceManager</code> to get an
|
||||
* {@link ApplicationAttemptReport} for an application attempt.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The request should include the {@link ApplicationAttemptId} of the
|
||||
* application attempt.
|
||||
* </p>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
|
||||
*/
|
||||
|
@ -51,7 +55,7 @@ public abstract class GetApplicationAttemptReportRequest {
|
|||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptId</code> of an application attempt.
|
||||
*
|
||||
*
|
||||
* @return <code>ApplicationAttemptId</code> of an application attempt
|
||||
*/
|
||||
@Public
|
||||
|
@ -60,9 +64,9 @@ public abstract class GetApplicationAttemptReportRequest {
|
|||
|
||||
/**
|
||||
* Set the <code>ApplicationAttemptId</code> of an application attempt
|
||||
*
|
||||
* @param applicationAttemptId <code>ApplicationAttemptId</code> of an
|
||||
* application attempt
|
||||
*
|
||||
* @param applicationAttemptId
|
||||
* <code>ApplicationAttemptId</code> of an application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -25,12 +25,16 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The response sent by the <code>ResourceManager</code> to a client requesting
|
||||
* an application attempt report.</p>
|
||||
*
|
||||
* <p>The response includes an {@link ApplicationAttemptReport} which has the
|
||||
* details about the particular application attempt</p>
|
||||
*
|
||||
* <p>
|
||||
* The response sent by the <code>ResourceManager</code> to a client requesting
|
||||
* an application attempt report.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The response includes an {@link ApplicationAttemptReport} which has the
|
||||
* details about the particular application attempt
|
||||
* </p>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
|
||||
*/
|
||||
|
@ -59,9 +63,9 @@ public abstract class GetApplicationAttemptReportResponse {
|
|||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptReport</code> for the application attempt.
|
||||
*
|
||||
* @param applicationAttemptReport <code>ApplicationAttemptReport</code> for
|
||||
* the application attempt
|
||||
*
|
||||
* @param applicationAttemptReport
|
||||
* <code>ApplicationAttemptReport</code> for the application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The request from clients to get a list of application attempt reports of
|
||||
* an application from the <code>ResourceManager</code>.</p>
|
||||
*
|
||||
* <p>
|
||||
* The request from clients to get a list of application attempt reports of an
|
||||
* application from the <code>ResourceManager</code>.
|
||||
* </p>
|
||||
*
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
|
||||
*/
|
||||
@Public
|
||||
|
@ -46,7 +48,7 @@ public abstract class GetApplicationAttemptsRequest {
|
|||
|
||||
/**
|
||||
* Get the <code>ApplicationId</code> of an application
|
||||
*
|
||||
*
|
||||
* @return <code>ApplicationId</code> of an application
|
||||
*/
|
||||
@Public
|
||||
|
@ -55,8 +57,9 @@ public abstract class GetApplicationAttemptsRequest {
|
|||
|
||||
/**
|
||||
* Set the <code>ApplicationId</code> of an application
|
||||
*
|
||||
* @param applicationId <code>ApplicationId</code> of an application
|
||||
*
|
||||
* @param applicationId
|
||||
* <code>ApplicationId</code> of an application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -27,15 +27,18 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The response sent by the <code>ResourceManager</code> to a client
|
||||
* requesting a list of {@link ApplicationAttemptReport} for application
|
||||
* attempts.</p>
|
||||
*
|
||||
* <p>The <code>ApplicationAttemptReport</code> for each application includes
|
||||
* the details of an application attempt.</p>
|
||||
*
|
||||
* <p>
|
||||
* The response sent by the <code>ResourceManager</code> to a client requesting
|
||||
* a list of {@link ApplicationAttemptReport} for application attempts.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ApplicationAttemptReport</code> for each application includes the
|
||||
* details of an application attempt.
|
||||
* </p>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -63,8 +66,8 @@ public abstract class GetApplicationAttemptsResponse {
|
|||
/**
|
||||
* Get a list of <code>ApplicationReport</code> of an application.
|
||||
*
|
||||
* @param applicationAttempts a list of <code>ApplicationReport</code> of an
|
||||
* application
|
||||
* @param applicationAttempts
|
||||
* a list of <code>ApplicationReport</code> of an application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -25,8 +25,10 @@ import org.apache.hadoop.yarn.api.records.ContainerReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The request sent by a client to the <code>ResourceManager</code> to
|
||||
* get an {@link ContainerReport} for a container.</p>
|
||||
* <p>
|
||||
* The request sent by a client to the <code>ResourceManager</code> to get an
|
||||
* {@link ContainerReport} for a container.
|
||||
* </p>
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -35,7 +37,8 @@ public abstract class GetContainerReportRequest {
|
|||
@Public
|
||||
@Unstable
|
||||
public static GetContainerReportRequest newInstance(ContainerId containerId) {
|
||||
GetContainerReportRequest request = Records.newRecord(GetContainerReportRequest.class);
|
||||
GetContainerReportRequest request =
|
||||
Records.newRecord(GetContainerReportRequest.class);
|
||||
request.setContainerId(containerId);
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -24,11 +24,15 @@ import org.apache.hadoop.yarn.api.records.ContainerReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The response sent by the <code>ResourceManager</code> to a client
|
||||
* requesting a container report.</p>
|
||||
* <p>
|
||||
* The response sent by the <code>ResourceManager</code> to a client requesting
|
||||
* a container report.
|
||||
* </p>
|
||||
*
|
||||
* <p>The response includes a {@link ContainerReport} which has details of a
|
||||
* container.</p>
|
||||
* <p>
|
||||
* The response includes a {@link ContainerReport} which has details of a
|
||||
* container.
|
||||
* </p>
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
|
|
|
@ -25,9 +25,11 @@ import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The request from clients to get a list of container reports, which belong
|
||||
* to an application attempt from the <code>ResourceManager</code>.</p>
|
||||
*
|
||||
* <p>
|
||||
* The request from clients to get a list of container reports, which belong to
|
||||
* an application attempt from the <code>ResourceManager</code>.
|
||||
* </p>
|
||||
*
|
||||
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
|
||||
*/
|
||||
@Public
|
||||
|
@ -55,8 +57,8 @@ public abstract class GetContainersRequest {
|
|||
/**
|
||||
* Set the <code>ApplicationAttemptId</code> of an application attempt
|
||||
*
|
||||
* @param applicationAttemptId <code>ApplicationAttemptId</code> of an
|
||||
* application attempt
|
||||
* @param applicationAttemptId
|
||||
* <code>ApplicationAttemptId</code> of an application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -27,12 +27,16 @@ import org.apache.hadoop.yarn.api.records.ContainerReport;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* <p>The response sent by the <code>ResourceManager</code> to a client
|
||||
* requesting a list of {@link ContainerReport} for containers.</p>
|
||||
*
|
||||
* <p>The <code>ContainerReport</code> for each container includes the container
|
||||
* details.</p>
|
||||
*
|
||||
* <p>
|
||||
* The response sent by the <code>ResourceManager</code> to a client requesting
|
||||
* a list of {@link ContainerReport} for containers.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* The <code>ContainerReport</code> for each container includes the container
|
||||
* details.
|
||||
* </p>
|
||||
*
|
||||
* @see ContainerReport
|
||||
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
|
||||
*/
|
||||
|
@ -42,7 +46,8 @@ public abstract class GetContainersResponse {
|
|||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetContainersResponse newInstance(List<ContainerReport> containers) {
|
||||
public static GetContainersResponse newInstance(
|
||||
List<ContainerReport> containers) {
|
||||
GetContainersResponse response =
|
||||
Records.newRecord(GetContainersResponse.class);
|
||||
response.setContainerList(containers);
|
||||
|
@ -53,9 +58,9 @@ public abstract class GetContainersResponse {
|
|||
* Get a list of <code>ContainerReport</code> for all the containers of an
|
||||
* application attempt.
|
||||
*
|
||||
* @return a list of <code>ContainerReport</code> for all the containers of
|
||||
* an application attempt
|
||||
*
|
||||
* @return a list of <code>ContainerReport</code> for all the containers of an
|
||||
* application attempt
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -65,9 +70,10 @@ public abstract class GetContainersResponse {
|
|||
* Set a list of <code>ContainerReport</code> for all the containers of an
|
||||
* application attempt.
|
||||
*
|
||||
* @param containers a list of <code>ContainerReport</code> for all the
|
||||
* containers of an application attempt
|
||||
*
|
||||
* @param containers
|
||||
* a list of <code>ContainerReport</code> for all the containers of
|
||||
* an application attempt
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.apache.hadoop.yarn.util.Records;
|
|||
* <p>
|
||||
* <code>ApplicationAttemptReport</code> is a report of an application attempt.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* It includes details such as:
|
||||
* <ul>
|
||||
|
@ -41,7 +41,7 @@ import org.apache.hadoop.yarn.util.Records;
|
|||
* <li>{@link ContainerId} of the master Container.</li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -67,7 +67,7 @@ public abstract class ApplicationAttemptReport {
|
|||
|
||||
/**
|
||||
* Get the <em>YarnApplicationAttemptState</em> of the application attempt.
|
||||
*
|
||||
*
|
||||
* @return <em>YarnApplicationAttemptState</em> of the application attempt
|
||||
*/
|
||||
@Public
|
||||
|
@ -81,7 +81,7 @@ public abstract class ApplicationAttemptReport {
|
|||
|
||||
/**
|
||||
* Get the <em>RPC port</em> of this attempt <code>ApplicationMaster</code>.
|
||||
*
|
||||
*
|
||||
* @return <em>RPC port</em> of this attempt <code>ApplicationMaster</code>
|
||||
*/
|
||||
@Public
|
||||
|
@ -95,7 +95,7 @@ public abstract class ApplicationAttemptReport {
|
|||
/**
|
||||
* Get the <em>host</em> on which this attempt of
|
||||
* <code>ApplicationMaster</code> is running.
|
||||
*
|
||||
*
|
||||
* @return <em>host</em> on which this attempt of
|
||||
* <code>ApplicationMaster</code> is running
|
||||
*/
|
||||
|
@ -110,7 +110,7 @@ public abstract class ApplicationAttemptReport {
|
|||
/**
|
||||
* Get the <em>diagnositic information</em> of the application attempt in case
|
||||
* of errors.
|
||||
*
|
||||
*
|
||||
* @return <em>diagnositic information</em> of the application attempt in case
|
||||
* of errors
|
||||
*/
|
||||
|
@ -124,7 +124,7 @@ public abstract class ApplicationAttemptReport {
|
|||
|
||||
/**
|
||||
* Get the <em>tracking url</em> for the application attempt.
|
||||
*
|
||||
*
|
||||
* @return <em>tracking url</em> for the application attempt
|
||||
*/
|
||||
@Public
|
||||
|
@ -138,7 +138,7 @@ public abstract class ApplicationAttemptReport {
|
|||
/**
|
||||
* Get the <code>ApplicationAttemptId</code> of this attempt of the
|
||||
* application
|
||||
*
|
||||
*
|
||||
* @return <code>ApplicationAttemptId</code> of the attempt
|
||||
*/
|
||||
@Public
|
||||
|
@ -152,7 +152,7 @@ public abstract class ApplicationAttemptReport {
|
|||
|
||||
/**
|
||||
* Get the <code>ContainerId</code> of AMContainer for this attempt
|
||||
*
|
||||
*
|
||||
* @return <code>ContainerId</code> of the attempt
|
||||
*/
|
||||
@Public
|
||||
|
|
|
@ -33,16 +33,16 @@ public enum YarnApplicationAttemptState {
|
|||
/** AppAttempt has been submitted. */
|
||||
SUBMITTED,
|
||||
|
||||
/**AppAttempt was scheduled*/
|
||||
/** AppAttempt was scheduled */
|
||||
SCHEDULED,
|
||||
|
||||
/**Acquired AM Container from Scheduler and Saving AppAttempt Data*/
|
||||
/** Acquired AM Container from Scheduler and Saving AppAttempt Data */
|
||||
ALLOCATED_SAVING,
|
||||
|
||||
/**AppAttempt Data was saved*/
|
||||
/** AppAttempt Data was saved */
|
||||
ALLOCATED,
|
||||
|
||||
/**AppAttempt was launched*/
|
||||
/** AppAttempt was launched */
|
||||
LAUNCHED,
|
||||
|
||||
/** AppAttempt failed. */
|
||||
|
@ -51,7 +51,7 @@ public enum YarnApplicationAttemptState {
|
|||
/** AppAttempt is currently running. */
|
||||
RUNNING,
|
||||
|
||||
/** AppAttempt is waiting for state bing saved*/
|
||||
/** AppAttempt is waiting for state bing saved */
|
||||
FINAL_SAVING,
|
||||
|
||||
/** AppAttempt is finishing. */
|
||||
|
|
|
@ -25,8 +25,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportReq
|
|||
|
||||
/**
|
||||
* This exception is thrown on
|
||||
* {@link ApplicationHistoryProtocol#getApplicationAttemptReport
|
||||
* (GetApplicationAttemptReportRequest)}
|
||||
* {@link ApplicationHistoryProtocol#getApplicationAttemptReport (GetApplicationAttemptReportRequest)}
|
||||
* API when the Application Attempt doesn't exist in Application History Server
|
||||
*/
|
||||
@Public
|
||||
|
|
|
@ -25,8 +25,7 @@ import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
|
|||
|
||||
/**
|
||||
* This exception is thrown on
|
||||
* {@link ApplicationHistoryProtocol#getContainerReport
|
||||
* (GetContainerReportRequest)}
|
||||
* {@link ApplicationHistoryProtocol#getContainerReport (GetContainerReportRequest)}
|
||||
* API when the container doesn't exist in AHS
|
||||
*/
|
||||
@Public
|
||||
|
|
|
@ -126,7 +126,8 @@ public abstract class AHSClient extends AbstractService {
|
|||
* @throws IOException
|
||||
*/
|
||||
public abstract ApplicationAttemptReport getApplicationAttemptReport(
|
||||
ApplicationAttemptId applicationAttemptId) throws YarnException, IOException;
|
||||
ApplicationAttemptId applicationAttemptId) throws YarnException,
|
||||
IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
|
@ -50,7 +50,6 @@ import org.apache.hadoop.yarn.client.api.AHSClient;
|
|||
import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
|
||||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
|
|
|
@ -77,8 +77,8 @@ public class TestAHSClient {
|
|||
client.init(conf);
|
||||
client.start();
|
||||
|
||||
List<ApplicationReport> expectedReports = ((MockAHSClient) client)
|
||||
.getReports();
|
||||
List<ApplicationReport> expectedReports =
|
||||
((MockAHSClient) client).getReports();
|
||||
|
||||
List<ApplicationReport> reports = client.getApplications();
|
||||
Assert.assertEquals(reports, expectedReports);
|
||||
|
@ -95,13 +95,13 @@ public class TestAHSClient {
|
|||
client.init(conf);
|
||||
client.start();
|
||||
|
||||
List<ApplicationReport> expectedReports = ((MockAHSClient) client)
|
||||
.getReports();
|
||||
List<ApplicationReport> expectedReports =
|
||||
((MockAHSClient) client).getReports();
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationReport report = client.getApplicationReport(applicationId);
|
||||
Assert.assertEquals(report, expectedReports.get(0));
|
||||
Assert.assertEquals(report.getApplicationId().toString(), expectedReports
|
||||
.get(0).getApplicationId().toString());
|
||||
.get(0).getApplicationId().toString());
|
||||
client.stop();
|
||||
}
|
||||
|
||||
|
@ -113,13 +113,13 @@ public class TestAHSClient {
|
|||
client.start();
|
||||
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
List<ApplicationAttemptReport> reports = client
|
||||
.getApplicationAttempts(applicationId);
|
||||
List<ApplicationAttemptReport> reports =
|
||||
client.getApplicationAttempts(applicationId);
|
||||
Assert.assertNotNull(reports);
|
||||
Assert.assertEquals(reports.get(0).getApplicationAttemptId(),
|
||||
ApplicationAttemptId.newInstance(applicationId, 1));
|
||||
ApplicationAttemptId.newInstance(applicationId, 1));
|
||||
Assert.assertEquals(reports.get(1).getApplicationAttemptId(),
|
||||
ApplicationAttemptId.newInstance(applicationId, 2));
|
||||
ApplicationAttemptId.newInstance(applicationId, 2));
|
||||
client.stop();
|
||||
}
|
||||
|
||||
|
@ -130,17 +130,17 @@ public class TestAHSClient {
|
|||
client.init(conf);
|
||||
client.start();
|
||||
|
||||
List<ApplicationReport> expectedReports = ((MockAHSClient) client)
|
||||
.getReports();
|
||||
List<ApplicationReport> expectedReports =
|
||||
((MockAHSClient) client).getReports();
|
||||
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(
|
||||
applicationId, 1);
|
||||
ApplicationAttemptReport report = client
|
||||
.getApplicationAttemptReport(appAttemptId);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(applicationId, 1);
|
||||
ApplicationAttemptReport report =
|
||||
client.getApplicationAttemptReport(appAttemptId);
|
||||
Assert.assertNotNull(report);
|
||||
Assert.assertEquals(report.getApplicationAttemptId().toString(),
|
||||
expectedReports.get(0).getCurrentApplicationAttemptId().toString());
|
||||
expectedReports.get(0).getCurrentApplicationAttemptId().toString());
|
||||
client.stop();
|
||||
}
|
||||
|
||||
|
@ -152,14 +152,14 @@ public class TestAHSClient {
|
|||
client.start();
|
||||
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(
|
||||
applicationId, 1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(applicationId, 1);
|
||||
List<ContainerReport> reports = client.getContainers(appAttemptId);
|
||||
Assert.assertNotNull(reports);
|
||||
Assert.assertEquals(reports.get(0).getContainerId(), (ContainerId
|
||||
.newInstance(appAttemptId, 1)));
|
||||
Assert.assertEquals(reports.get(1).getContainerId(), (ContainerId
|
||||
.newInstance(appAttemptId, 2)));
|
||||
Assert.assertEquals(reports.get(0).getContainerId(),
|
||||
(ContainerId.newInstance(appAttemptId, 1)));
|
||||
Assert.assertEquals(reports.get(1).getContainerId(),
|
||||
(ContainerId.newInstance(appAttemptId, 2)));
|
||||
client.stop();
|
||||
}
|
||||
|
||||
|
@ -170,40 +170,41 @@ public class TestAHSClient {
|
|||
client.init(conf);
|
||||
client.start();
|
||||
|
||||
List<ApplicationReport> expectedReports = ((MockAHSClient) client)
|
||||
.getReports();
|
||||
List<ApplicationReport> expectedReports =
|
||||
((MockAHSClient) client).getReports();
|
||||
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(
|
||||
applicationId, 1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(applicationId, 1);
|
||||
ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
|
||||
ContainerReport report = client.getContainerReport(containerId);
|
||||
Assert.assertNotNull(report);
|
||||
Assert.assertEquals(report.getContainerId().toString(),
|
||||
(ContainerId.newInstance(expectedReports.get(0)
|
||||
.getCurrentApplicationAttemptId(), 1)).toString());
|
||||
Assert.assertEquals(report.getContainerId().toString(), (ContainerId
|
||||
.newInstance(expectedReports.get(0).getCurrentApplicationAttemptId(), 1))
|
||||
.toString());
|
||||
client.stop();
|
||||
}
|
||||
|
||||
private static class MockAHSClient extends AHSClientImpl {
|
||||
// private ApplicationReport mockReport;
|
||||
private List<ApplicationReport> reports = new ArrayList<ApplicationReport>();
|
||||
private HashMap<ApplicationId, List<ApplicationAttemptReport>> attempts =
|
||||
new HashMap<ApplicationId, List<ApplicationAttemptReport>>();
|
||||
private HashMap<ApplicationAttemptId, List<ContainerReport>> containers =
|
||||
new HashMap<ApplicationAttemptId, List<ContainerReport>>();
|
||||
private List<ApplicationReport> reports =
|
||||
new ArrayList<ApplicationReport>();
|
||||
private HashMap<ApplicationId, List<ApplicationAttemptReport>> attempts =
|
||||
new HashMap<ApplicationId, List<ApplicationAttemptReport>>();
|
||||
private HashMap<ApplicationAttemptId, List<ContainerReport>> containers =
|
||||
new HashMap<ApplicationAttemptId, List<ContainerReport>>();
|
||||
GetApplicationsResponse mockAppResponse =
|
||||
mock(GetApplicationsResponse.class);
|
||||
GetApplicationReportResponse mockResponse =
|
||||
mock(GetApplicationReportResponse.class);
|
||||
mock(GetApplicationsResponse.class);
|
||||
GetApplicationReportResponse mockResponse =
|
||||
mock(GetApplicationReportResponse.class);
|
||||
GetApplicationAttemptsResponse mockAppAttemptsResponse =
|
||||
mock(GetApplicationAttemptsResponse.class);
|
||||
GetApplicationAttemptReportResponse mockAttemptResponse =
|
||||
mock(GetApplicationAttemptReportResponse.class);
|
||||
GetContainersResponse mockContainersResponse =
|
||||
mock(GetContainersResponse.class);
|
||||
GetContainerReportResponse mockContainerResponse =
|
||||
mock(GetContainerReportResponse.class);
|
||||
mock(GetApplicationAttemptsResponse.class);
|
||||
GetApplicationAttemptReportResponse mockAttemptResponse =
|
||||
mock(GetApplicationAttemptReportResponse.class);
|
||||
GetContainersResponse mockContainersResponse =
|
||||
mock(GetContainersResponse.class);
|
||||
GetContainerReportResponse mockContainerResponse =
|
||||
mock(GetContainerReportResponse.class);
|
||||
|
||||
public MockAHSClient() {
|
||||
super();
|
||||
|
@ -216,24 +217,24 @@ public class TestAHSClient {
|
|||
|
||||
try {
|
||||
when(
|
||||
ahsClient
|
||||
.getApplicationReport(any(GetApplicationReportRequest.class)))
|
||||
.thenReturn(mockResponse);
|
||||
ahsClient
|
||||
.getApplicationReport(any(GetApplicationReportRequest.class)))
|
||||
.thenReturn(mockResponse);
|
||||
when(ahsClient.getApplications(any(GetApplicationsRequest.class)))
|
||||
.thenReturn(mockAppResponse);
|
||||
.thenReturn(mockAppResponse);
|
||||
when(
|
||||
ahsClient
|
||||
.getApplicationAttemptReport(any(GetApplicationAttemptReportRequest.class)))
|
||||
.thenReturn(mockAttemptResponse);
|
||||
ahsClient
|
||||
.getApplicationAttemptReport(any(GetApplicationAttemptReportRequest.class)))
|
||||
.thenReturn(mockAttemptResponse);
|
||||
when(
|
||||
ahsClient
|
||||
.getApplicationAttempts(any(GetApplicationAttemptsRequest.class)))
|
||||
.thenReturn(mockAppAttemptsResponse);
|
||||
ahsClient
|
||||
.getApplicationAttempts(any(GetApplicationAttemptsRequest.class)))
|
||||
.thenReturn(mockAppAttemptsResponse);
|
||||
when(ahsClient.getContainers(any(GetContainersRequest.class)))
|
||||
.thenReturn(mockContainersResponse);
|
||||
.thenReturn(mockContainersResponse);
|
||||
|
||||
when(ahsClient.getContainerReport(any(GetContainerReportRequest.class)))
|
||||
.thenReturn(mockContainerResponse);
|
||||
.thenReturn(mockContainerResponse);
|
||||
|
||||
} catch (YarnException e) {
|
||||
Assert.fail("Exception is not expected.");
|
||||
|
@ -260,7 +261,7 @@ public class TestAHSClient {
|
|||
public List<ApplicationAttemptReport> getApplicationAttempts(
|
||||
ApplicationId appId) throws YarnException, IOException {
|
||||
when(mockAppAttemptsResponse.getApplicationAttemptList()).thenReturn(
|
||||
getAttempts(appId));
|
||||
getAttempts(appId));
|
||||
return super.getApplicationAttempts(appId);
|
||||
}
|
||||
|
||||
|
@ -268,15 +269,16 @@ public class TestAHSClient {
|
|||
public ApplicationAttemptReport getApplicationAttemptReport(
|
||||
ApplicationAttemptId appAttemptId) throws YarnException, IOException {
|
||||
when(mockAttemptResponse.getApplicationAttemptReport()).thenReturn(
|
||||
getAttempt(appAttemptId));
|
||||
getAttempt(appAttemptId));
|
||||
return super.getApplicationAttemptReport(appAttemptId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContainerReport> getContainers(ApplicationAttemptId appAttemptId)
|
||||
throws YarnException, IOException {
|
||||
public List<ContainerReport>
|
||||
getContainers(ApplicationAttemptId appAttemptId) throws YarnException,
|
||||
IOException {
|
||||
when(mockContainersResponse.getContainerList()).thenReturn(
|
||||
getContainersReport(appAttemptId));
|
||||
getContainersReport(appAttemptId));
|
||||
return super.getContainers(appAttemptId);
|
||||
}
|
||||
|
||||
|
@ -284,7 +286,7 @@ public class TestAHSClient {
|
|||
public ContainerReport getContainerReport(ContainerId containerId)
|
||||
throws YarnException, IOException {
|
||||
when(mockContainerResponse.getContainerReport()).thenReturn(
|
||||
getContainer(containerId));
|
||||
getContainer(containerId));
|
||||
return super.getContainerReport(containerId);
|
||||
}
|
||||
|
||||
|
@ -295,7 +297,7 @@ public class TestAHSClient {
|
|||
public ApplicationReport getReport(ApplicationId appId) {
|
||||
for (int i = 0; i < reports.size(); ++i) {
|
||||
if (appId.toString().equalsIgnoreCase(
|
||||
reports.get(i).getApplicationId().toString())) {
|
||||
reports.get(i).getApplicationId().toString())) {
|
||||
return reports.get(i);
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +308,8 @@ public class TestAHSClient {
|
|||
return attempts.get(appId);
|
||||
}
|
||||
|
||||
public ApplicationAttemptReport getAttempt(ApplicationAttemptId appAttemptId) {
|
||||
public ApplicationAttemptReport
|
||||
getAttempt(ApplicationAttemptId appAttemptId) {
|
||||
return attempts.get(appAttemptId.getApplicationId()).get(0);
|
||||
}
|
||||
|
||||
|
@ -325,68 +328,86 @@ public class TestAHSClient {
|
|||
|
||||
private void createAppReports() {
|
||||
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
|
||||
ApplicationReport newApplicationReport = ApplicationReport
|
||||
.newInstance(applicationId, ApplicationAttemptId.newInstance(
|
||||
applicationId, 1), "user", "queue", "appname", "host", 124, null,
|
||||
YarnApplicationState.RUNNING, "diagnostics", "url", 0, 0,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.53789f, "YARN",
|
||||
null);
|
||||
List<ApplicationReport> applicationReports = new ArrayList<ApplicationReport>();
|
||||
ApplicationReport newApplicationReport =
|
||||
ApplicationReport.newInstance(applicationId,
|
||||
ApplicationAttemptId.newInstance(applicationId, 1), "user",
|
||||
"queue", "appname", "host", 124, null,
|
||||
YarnApplicationState.RUNNING, "diagnostics", "url", 0, 0,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.53789f, "YARN",
|
||||
null);
|
||||
List<ApplicationReport> applicationReports =
|
||||
new ArrayList<ApplicationReport>();
|
||||
applicationReports.add(newApplicationReport);
|
||||
List<ApplicationAttemptReport> appAttempts = new ArrayList<ApplicationAttemptReport>();
|
||||
ApplicationAttemptReport attempt = ApplicationAttemptReport.newInstance(
|
||||
ApplicationAttemptId.newInstance(applicationId, 1), "host", 124,
|
||||
"url", "diagnostics", YarnApplicationAttemptState.FINISHED,
|
||||
ContainerId.newInstance(newApplicationReport
|
||||
.getCurrentApplicationAttemptId(), 1));
|
||||
List<ApplicationAttemptReport> appAttempts =
|
||||
new ArrayList<ApplicationAttemptReport>();
|
||||
ApplicationAttemptReport attempt =
|
||||
ApplicationAttemptReport.newInstance(
|
||||
ApplicationAttemptId.newInstance(applicationId, 1),
|
||||
"host",
|
||||
124,
|
||||
"url",
|
||||
"diagnostics",
|
||||
YarnApplicationAttemptState.FINISHED,
|
||||
ContainerId.newInstance(
|
||||
newApplicationReport.getCurrentApplicationAttemptId(), 1));
|
||||
appAttempts.add(attempt);
|
||||
ApplicationAttemptReport attempt1 = ApplicationAttemptReport.newInstance(
|
||||
ApplicationAttemptId.newInstance(applicationId, 2), "host", 124,
|
||||
"url", "diagnostics", YarnApplicationAttemptState.FINISHED,
|
||||
ContainerId.newInstance(newApplicationReport
|
||||
.getCurrentApplicationAttemptId(), 2));
|
||||
ApplicationAttemptReport attempt1 =
|
||||
ApplicationAttemptReport.newInstance(
|
||||
ApplicationAttemptId.newInstance(applicationId, 2),
|
||||
"host",
|
||||
124,
|
||||
"url",
|
||||
"diagnostics",
|
||||
YarnApplicationAttemptState.FINISHED,
|
||||
ContainerId.newInstance(
|
||||
newApplicationReport.getCurrentApplicationAttemptId(), 2));
|
||||
appAttempts.add(attempt1);
|
||||
attempts.put(applicationId, appAttempts);
|
||||
|
||||
List<ContainerReport> containerReports = new ArrayList<ContainerReport>();
|
||||
ContainerReport container = ContainerReport.newInstance(ContainerId
|
||||
.newInstance(attempt.getApplicationAttemptId(), 1), null, NodeId
|
||||
.newInstance("host", 1234), Priority.UNDEFINED, 1234, 5678,
|
||||
"diagnosticInfo", "logURL", 0, ContainerState.COMPLETE);
|
||||
ContainerReport container =
|
||||
ContainerReport.newInstance(
|
||||
ContainerId.newInstance(attempt.getApplicationAttemptId(), 1),
|
||||
null, NodeId.newInstance("host", 1234), Priority.UNDEFINED, 1234,
|
||||
5678, "diagnosticInfo", "logURL", 0, ContainerState.COMPLETE);
|
||||
containerReports.add(container);
|
||||
|
||||
ContainerReport container1 = ContainerReport.newInstance(ContainerId
|
||||
.newInstance(attempt.getApplicationAttemptId(), 2), null, NodeId
|
||||
.newInstance("host", 1234), Priority.UNDEFINED, 1234, 5678,
|
||||
"diagnosticInfo", "logURL", 0, ContainerState.COMPLETE);
|
||||
ContainerReport container1 =
|
||||
ContainerReport.newInstance(
|
||||
ContainerId.newInstance(attempt.getApplicationAttemptId(), 2),
|
||||
null, NodeId.newInstance("host", 1234), Priority.UNDEFINED, 1234,
|
||||
5678, "diagnosticInfo", "logURL", 0, ContainerState.COMPLETE);
|
||||
containerReports.add(container1);
|
||||
containers.put(attempt.getApplicationAttemptId(), containerReports);
|
||||
|
||||
ApplicationId applicationId2 = ApplicationId.newInstance(1234, 6);
|
||||
ApplicationReport newApplicationReport2 = ApplicationReport.newInstance(
|
||||
applicationId2, ApplicationAttemptId.newInstance(applicationId2, 2),
|
||||
"user2", "queue2", "appname2", "host2", 125, null,
|
||||
YarnApplicationState.FINISHED, "diagnostics2", "url2", 2, 2,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.63789f, "NON-YARN",
|
||||
null);
|
||||
ApplicationReport newApplicationReport2 =
|
||||
ApplicationReport.newInstance(applicationId2,
|
||||
ApplicationAttemptId.newInstance(applicationId2, 2), "user2",
|
||||
"queue2", "appname2", "host2", 125, null,
|
||||
YarnApplicationState.FINISHED, "diagnostics2", "url2", 2, 2,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.63789f,
|
||||
"NON-YARN", null);
|
||||
applicationReports.add(newApplicationReport2);
|
||||
|
||||
ApplicationId applicationId3 = ApplicationId.newInstance(1234, 7);
|
||||
ApplicationReport newApplicationReport3 = ApplicationReport.newInstance(
|
||||
applicationId3, ApplicationAttemptId.newInstance(applicationId3, 3),
|
||||
"user3", "queue3", "appname3", "host3", 126, null,
|
||||
YarnApplicationState.RUNNING, "diagnostics3", "url3", 3, 3,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.73789f, "MAPREDUCE",
|
||||
null);
|
||||
ApplicationReport newApplicationReport3 =
|
||||
ApplicationReport.newInstance(applicationId3,
|
||||
ApplicationAttemptId.newInstance(applicationId3, 3), "user3",
|
||||
"queue3", "appname3", "host3", 126, null,
|
||||
YarnApplicationState.RUNNING, "diagnostics3", "url3", 3, 3,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.73789f,
|
||||
"MAPREDUCE", null);
|
||||
applicationReports.add(newApplicationReport3);
|
||||
|
||||
ApplicationId applicationId4 = ApplicationId.newInstance(1234, 8);
|
||||
ApplicationReport newApplicationReport4 = ApplicationReport.newInstance(
|
||||
applicationId4, ApplicationAttemptId.newInstance(applicationId4, 4),
|
||||
"user4", "queue4", "appname4", "host4", 127, null,
|
||||
YarnApplicationState.FAILED, "diagnostics4", "url4", 4, 4,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.83789f,
|
||||
"NON-MAPREDUCE", null);
|
||||
ApplicationReport newApplicationReport4 =
|
||||
ApplicationReport.newInstance(applicationId4,
|
||||
ApplicationAttemptId.newInstance(applicationId4, 4), "user4",
|
||||
"queue4", "appname4", "host4", 127, null,
|
||||
YarnApplicationState.FAILED, "diagnostics4", "url4", 4, 4,
|
||||
FinalApplicationStatus.SUCCEEDED, null, "N/A", 0.83789f,
|
||||
"NON-MAPREDUCE", null);
|
||||
applicationReports.add(newApplicationReport4);
|
||||
reports = applicationReports;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,9 @@ import org.apache.hadoop.yarn.proto.ApplicationHistoryProtocol.ApplicationHistor
|
|||
|
||||
@Private
|
||||
@Unstable
|
||||
@ProtocolInfo(protocolName = "org.apache.hadoop.yarn.api.ApplicationHistoryProtocolPB", protocolVersion = 1)
|
||||
@ProtocolInfo(
|
||||
protocolName = "org.apache.hadoop.yarn.api.ApplicationHistoryProtocolPB",
|
||||
protocolVersion = 1)
|
||||
public interface ApplicationHistoryProtocolPB extends
|
||||
ApplicationHistoryProtocolService.BlockingInterface {
|
||||
}
|
|
@ -86,9 +86,10 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
public ApplicationHistoryProtocolPBClientImpl(long clientVersion,
|
||||
InetSocketAddress addr, Configuration conf) throws IOException {
|
||||
RPC.setProtocolEngine(conf, ApplicationHistoryProtocolPB.class,
|
||||
ProtobufRpcEngine.class);
|
||||
proxy = RPC.getProxy(ApplicationHistoryProtocolPB.class, clientVersion,
|
||||
addr, conf);
|
||||
ProtobufRpcEngine.class);
|
||||
proxy =
|
||||
RPC.getProxy(ApplicationHistoryProtocolPB.class, clientVersion, addr,
|
||||
conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -101,11 +102,11 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
@Override
|
||||
public GetApplicationReportResponse getApplicationReport(
|
||||
GetApplicationReportRequest request) throws YarnException, IOException {
|
||||
GetApplicationReportRequestProto requestProto = ((GetApplicationReportRequestPBImpl) request)
|
||||
.getProto();
|
||||
GetApplicationReportRequestProto requestProto =
|
||||
((GetApplicationReportRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetApplicationReportResponsePBImpl(proxy.getApplicationReport(
|
||||
null, requestProto));
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -113,13 +114,14 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
}
|
||||
|
||||
@Override
|
||||
public GetApplicationsResponse getApplications(GetApplicationsRequest request)
|
||||
throws YarnException, IOException {
|
||||
GetApplicationsRequestProto requestProto = ((GetApplicationsRequestPBImpl) request)
|
||||
.getProto();
|
||||
public GetApplicationsResponse
|
||||
getApplications(GetApplicationsRequest request) throws YarnException,
|
||||
IOException {
|
||||
GetApplicationsRequestProto requestProto =
|
||||
((GetApplicationsRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetApplicationsResponsePBImpl(proxy.getApplications(null,
|
||||
requestProto));
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -130,11 +132,11 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
|
||||
GetApplicationAttemptReportRequest request) throws YarnException,
|
||||
IOException {
|
||||
GetApplicationAttemptReportRequestProto requestProto = ((GetApplicationAttemptReportRequestPBImpl) request)
|
||||
.getProto();
|
||||
GetApplicationAttemptReportRequestProto requestProto =
|
||||
((GetApplicationAttemptReportRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetApplicationAttemptReportResponsePBImpl(proxy
|
||||
.getApplicationAttemptReport(null, requestProto));
|
||||
return new GetApplicationAttemptReportResponsePBImpl(
|
||||
proxy.getApplicationAttemptReport(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -144,11 +146,11 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
@Override
|
||||
public GetApplicationAttemptsResponse getApplicationAttempts(
|
||||
GetApplicationAttemptsRequest request) throws YarnException, IOException {
|
||||
GetApplicationAttemptsRequestProto requestProto = ((GetApplicationAttemptsRequestPBImpl) request)
|
||||
.getProto();
|
||||
GetApplicationAttemptsRequestProto requestProto =
|
||||
((GetApplicationAttemptsRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetApplicationAttemptsResponsePBImpl(proxy
|
||||
.getApplicationAttempts(null, requestProto));
|
||||
return new GetApplicationAttemptsResponsePBImpl(
|
||||
proxy.getApplicationAttempts(null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -158,11 +160,11 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
@Override
|
||||
public GetContainerReportResponse getContainerReport(
|
||||
GetContainerReportRequest request) throws YarnException, IOException {
|
||||
GetContainerReportRequestProto requestProto = ((GetContainerReportRequestPBImpl) request)
|
||||
.getProto();
|
||||
GetContainerReportRequestProto requestProto =
|
||||
((GetContainerReportRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetContainerReportResponsePBImpl(proxy.getContainerReport(
|
||||
null, requestProto));
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -172,11 +174,11 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
@Override
|
||||
public GetContainersResponse getContainers(GetContainersRequest request)
|
||||
throws YarnException, IOException {
|
||||
GetContainersRequestProto requestProto = ((GetContainersRequestPBImpl) request)
|
||||
.getProto();
|
||||
GetContainersRequestProto requestProto =
|
||||
((GetContainersRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new GetContainersResponsePBImpl(proxy.getContainers(null,
|
||||
requestProto));
|
||||
requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -185,8 +187,7 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
|
||||
@Override
|
||||
public GetDelegationTokenResponse getDelegationToken(
|
||||
GetDelegationTokenRequest request) throws YarnException,
|
||||
IOException {
|
||||
GetDelegationTokenRequest request) throws YarnException, IOException {
|
||||
GetDelegationTokenRequestProto requestProto =
|
||||
((GetDelegationTokenRequestPBImpl) request).getProto();
|
||||
try {
|
||||
|
@ -200,13 +201,12 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
|
||||
@Override
|
||||
public RenewDelegationTokenResponse renewDelegationToken(
|
||||
RenewDelegationTokenRequest request) throws YarnException,
|
||||
IOException {
|
||||
RenewDelegationTokenRequestProto requestProto =
|
||||
RenewDelegationTokenRequest request) throws YarnException, IOException {
|
||||
RenewDelegationTokenRequestProto requestProto =
|
||||
((RenewDelegationTokenRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new RenewDelegationTokenResponsePBImpl(proxy.renewDelegationToken(
|
||||
null, requestProto));
|
||||
null, requestProto));
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
return null;
|
||||
|
@ -215,13 +215,12 @@ public class ApplicationHistoryProtocolPBClientImpl implements
|
|||
|
||||
@Override
|
||||
public CancelDelegationTokenResponse cancelDelegationToken(
|
||||
CancelDelegationTokenRequest request) throws YarnException,
|
||||
IOException {
|
||||
CancelDelegationTokenRequest request) throws YarnException, IOException {
|
||||
CancelDelegationTokenRequestProto requestProto =
|
||||
((CancelDelegationTokenRequestPBImpl) request).getProto();
|
||||
try {
|
||||
return new CancelDelegationTokenResponsePBImpl(
|
||||
proxy.cancelDelegationToken(null, requestProto));
|
||||
proxy.cancelDelegationToken(null, requestProto));
|
||||
|
||||
} catch (ServiceException e) {
|
||||
RPCUtil.unwrapAndThrowException(e);
|
||||
|
|
|
@ -27,17 +27,13 @@ import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenRequest
|
|||
import org.apache.hadoop.security.proto.SecurityProtos.GetDelegationTokenResponseProto;
|
||||
import org.apache.hadoop.security.proto.SecurityProtos.RenewDelegationTokenRequestProto;
|
||||
import org.apache.hadoop.security.proto.SecurityProtos.RenewDelegationTokenResponseProto;
|
||||
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocolPB;
|
||||
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.GetApplicationReportResponse;
|
||||
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.GetContainersResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
|
||||
|
@ -61,14 +57,14 @@ import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.GetDelegationTokenResp
|
|||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenRequestPBImpl;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.RenewDelegationTokenResponsePBImpl;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationsResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersRequestProto;
|
||||
|
@ -90,11 +86,11 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public GetApplicationReportResponseProto getApplicationReport(
|
||||
RpcController arg0, GetApplicationReportRequestProto proto)
|
||||
throws ServiceException {
|
||||
GetApplicationReportRequestPBImpl request = new GetApplicationReportRequestPBImpl(
|
||||
proto);
|
||||
GetApplicationReportRequestPBImpl request =
|
||||
new GetApplicationReportRequestPBImpl(proto);
|
||||
try {
|
||||
GetApplicationReportResponse response = real
|
||||
.getApplicationReport(request);
|
||||
GetApplicationReportResponse response =
|
||||
real.getApplicationReport(request);
|
||||
return ((GetApplicationReportResponsePBImpl) response).getProto();
|
||||
} catch (YarnException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -106,8 +102,8 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
@Override
|
||||
public GetApplicationsResponseProto getApplications(RpcController controller,
|
||||
GetApplicationsRequestProto proto) throws ServiceException {
|
||||
GetApplicationsRequestPBImpl request = new GetApplicationsRequestPBImpl(
|
||||
proto);
|
||||
GetApplicationsRequestPBImpl request =
|
||||
new GetApplicationsRequestPBImpl(proto);
|
||||
try {
|
||||
GetApplicationsResponse response = real.getApplications(request);
|
||||
return ((GetApplicationsResponsePBImpl) response).getProto();
|
||||
|
@ -122,11 +118,11 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public GetApplicationAttemptReportResponseProto getApplicationAttemptReport(
|
||||
RpcController controller, GetApplicationAttemptReportRequestProto proto)
|
||||
throws ServiceException {
|
||||
GetApplicationAttemptReportRequestPBImpl request = new GetApplicationAttemptReportRequestPBImpl(
|
||||
proto);
|
||||
GetApplicationAttemptReportRequestPBImpl request =
|
||||
new GetApplicationAttemptReportRequestPBImpl(proto);
|
||||
try {
|
||||
GetApplicationAttemptReportResponse response = real
|
||||
.getApplicationAttemptReport(request);
|
||||
GetApplicationAttemptReportResponse response =
|
||||
real.getApplicationAttemptReport(request);
|
||||
return ((GetApplicationAttemptReportResponsePBImpl) response).getProto();
|
||||
} catch (YarnException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -139,11 +135,11 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public GetApplicationAttemptsResponseProto getApplicationAttempts(
|
||||
RpcController controller, GetApplicationAttemptsRequestProto proto)
|
||||
throws ServiceException {
|
||||
GetApplicationAttemptsRequestPBImpl request = new GetApplicationAttemptsRequestPBImpl(
|
||||
proto);
|
||||
GetApplicationAttemptsRequestPBImpl request =
|
||||
new GetApplicationAttemptsRequestPBImpl(proto);
|
||||
try {
|
||||
GetApplicationAttemptsResponse response = real
|
||||
.getApplicationAttempts(request);
|
||||
GetApplicationAttemptsResponse response =
|
||||
real.getApplicationAttempts(request);
|
||||
return ((GetApplicationAttemptsResponsePBImpl) response).getProto();
|
||||
} catch (YarnException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -156,8 +152,8 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public GetContainerReportResponseProto getContainerReport(
|
||||
RpcController controller, GetContainerReportRequestProto proto)
|
||||
throws ServiceException {
|
||||
GetContainerReportRequestPBImpl request = new GetContainerReportRequestPBImpl(
|
||||
proto);
|
||||
GetContainerReportRequestPBImpl request =
|
||||
new GetContainerReportRequestPBImpl(proto);
|
||||
try {
|
||||
GetContainerReportResponse response = real.getContainerReport(request);
|
||||
return ((GetContainerReportResponsePBImpl) response).getProto();
|
||||
|
@ -186,8 +182,8 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public GetDelegationTokenResponseProto getDelegationToken(
|
||||
RpcController controller, GetDelegationTokenRequestProto proto)
|
||||
throws ServiceException {
|
||||
GetDelegationTokenRequestPBImpl request = new GetDelegationTokenRequestPBImpl(
|
||||
proto);
|
||||
GetDelegationTokenRequestPBImpl request =
|
||||
new GetDelegationTokenRequestPBImpl(proto);
|
||||
try {
|
||||
GetDelegationTokenResponse response = real.getDelegationToken(request);
|
||||
return ((GetDelegationTokenResponsePBImpl) response).getProto();
|
||||
|
@ -202,11 +198,11 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public RenewDelegationTokenResponseProto renewDelegationToken(
|
||||
RpcController controller, RenewDelegationTokenRequestProto proto)
|
||||
throws ServiceException {
|
||||
RenewDelegationTokenRequestPBImpl request = new RenewDelegationTokenRequestPBImpl(
|
||||
proto);
|
||||
RenewDelegationTokenRequestPBImpl request =
|
||||
new RenewDelegationTokenRequestPBImpl(proto);
|
||||
try {
|
||||
RenewDelegationTokenResponse response = real
|
||||
.renewDelegationToken(request);
|
||||
RenewDelegationTokenResponse response =
|
||||
real.renewDelegationToken(request);
|
||||
return ((RenewDelegationTokenResponsePBImpl) response).getProto();
|
||||
} catch (YarnException e) {
|
||||
throw new ServiceException(e);
|
||||
|
@ -219,11 +215,11 @@ public class ApplicationHistoryProtocolPBServiceImpl implements
|
|||
public CancelDelegationTokenResponseProto cancelDelegationToken(
|
||||
RpcController controller, CancelDelegationTokenRequestProto proto)
|
||||
throws ServiceException {
|
||||
CancelDelegationTokenRequestPBImpl request = new CancelDelegationTokenRequestPBImpl(
|
||||
proto);
|
||||
CancelDelegationTokenRequestPBImpl request =
|
||||
new CancelDelegationTokenRequestPBImpl(proto);
|
||||
try {
|
||||
CancelDelegationTokenResponse response = real
|
||||
.cancelDelegationToken(request);
|
||||
CancelDelegationTokenResponse response =
|
||||
real.cancelDelegationToken(request);
|
||||
return ((CancelDelegationTokenResponsePBImpl) response).getProto();
|
||||
} catch (YarnException e) {
|
||||
throw new ServiceException(e);
|
||||
|
|
|
@ -81,8 +81,8 @@ public class GetApplicationAttemptReportRequestPBImpl extends
|
|||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (applicationAttemptId != null) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
builder
|
||||
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ public class GetApplicationAttemptReportRequestPBImpl extends
|
|||
if (this.applicationAttemptId != null) {
|
||||
return this.applicationAttemptId;
|
||||
}
|
||||
GetApplicationAttemptReportRequestProtoOrBuilder p
|
||||
= viaProto ? proto : builder;
|
||||
GetApplicationAttemptReportRequestProtoOrBuilder p =
|
||||
viaProto ? proto : builder;
|
||||
if (!p.hasApplicationAttemptId()) {
|
||||
return null;
|
||||
}
|
||||
|
@ -118,7 +118,8 @@ public class GetApplicationAttemptReportRequestPBImpl extends
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
public void
|
||||
setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttemptId == null) {
|
||||
builder.clearApplicationAttemptId();
|
||||
|
@ -131,7 +132,8 @@ public class GetApplicationAttemptReportRequestPBImpl extends
|
|||
return new ApplicationAttemptIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdProto convertToProtoFormat(ApplicationAttemptId t) {
|
||||
private ApplicationAttemptIdProto
|
||||
convertToProtoFormat(ApplicationAttemptId t) {
|
||||
return ((ApplicationAttemptIdPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
|
|
|
@ -81,8 +81,8 @@ public class GetApplicationAttemptReportResponsePBImpl extends
|
|||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationAttemptReport != null) {
|
||||
builder.setApplicationAttemptReport(
|
||||
convertToProtoFormat(this.applicationAttemptReport));
|
||||
builder
|
||||
.setApplicationAttemptReport(convertToProtoFormat(this.applicationAttemptReport));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,8 +107,8 @@ public class GetApplicationAttemptReportResponsePBImpl extends
|
|||
if (this.applicationAttemptReport != null) {
|
||||
return this.applicationAttemptReport;
|
||||
}
|
||||
GetApplicationAttemptReportResponseProtoOrBuilder p
|
||||
= viaProto ? proto : builder;
|
||||
GetApplicationAttemptReportResponseProtoOrBuilder p =
|
||||
viaProto ? proto : builder;
|
||||
if (!p.hasApplicationAttemptReport()) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ import com.google.protobuf.TextFormat;
|
|||
public class GetApplicationAttemptsRequestPBImpl extends
|
||||
GetApplicationAttemptsRequest {
|
||||
|
||||
GetApplicationAttemptsRequestProto proto =
|
||||
GetApplicationAttemptsRequestProto.getDefaultInstance();
|
||||
GetApplicationAttemptsRequestProto proto = GetApplicationAttemptsRequestProto
|
||||
.getDefaultInstance();
|
||||
GetApplicationAttemptsRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
|
|
@ -148,8 +148,8 @@ public class GetApplicationAttemptsResponsePBImpl extends
|
|||
public Iterator<ApplicationAttemptReportProto> iterator() {
|
||||
return new Iterator<ApplicationAttemptReportProto>() {
|
||||
|
||||
Iterator<ApplicationAttemptReport> iter =
|
||||
applicationAttemptList.iterator();
|
||||
Iterator<ApplicationAttemptReport> iter = applicationAttemptList
|
||||
.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
|
|
|
@ -32,8 +32,8 @@ import com.google.protobuf.TextFormat;
|
|||
@Private
|
||||
@Unstable
|
||||
public class GetContainerReportRequestPBImpl extends GetContainerReportRequest {
|
||||
GetContainerReportRequestProto proto =
|
||||
GetContainerReportRequestProto.getDefaultInstance();
|
||||
GetContainerReportRequestProto proto = GetContainerReportRequestProto
|
||||
.getDefaultInstance();
|
||||
GetContainerReportRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
|
|
@ -27,11 +27,11 @@ import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportResponse
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class GetContainerReportResponsePBImpl
|
||||
extends GetContainerReportResponse {
|
||||
public class GetContainerReportResponsePBImpl extends
|
||||
GetContainerReportResponse {
|
||||
|
||||
GetContainerReportResponseProto proto =
|
||||
GetContainerReportResponseProto.getDefaultInstance();
|
||||
GetContainerReportResponseProto proto = GetContainerReportResponseProto
|
||||
.getDefaultInstance();
|
||||
GetContainerReportResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -41,8 +41,7 @@ public class GetContainerReportResponsePBImpl
|
|||
builder = GetContainerReportResponseProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetContainerReportResponsePBImpl(
|
||||
GetContainerReportResponseProto proto) {
|
||||
public GetContainerReportResponsePBImpl(GetContainerReportResponseProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
@ -117,8 +116,7 @@ public class GetContainerReportResponsePBImpl
|
|||
this.containerReport = containerReport;
|
||||
}
|
||||
|
||||
private ContainerReportPBImpl convertFromProtoFormat(
|
||||
ContainerReportProto p) {
|
||||
private ContainerReportPBImpl convertFromProtoFormat(ContainerReportProto p) {
|
||||
return new ContainerReportPBImpl(p);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersRequestProtoO
|
|||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class GetContainersRequestPBImpl extends GetContainersRequest {
|
||||
GetContainersRequestProto proto =
|
||||
GetContainersRequestProto.getDefaultInstance();
|
||||
GetContainersRequestProto proto = GetContainersRequestProto
|
||||
.getDefaultInstance();
|
||||
GetContainersRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -74,8 +74,8 @@ public class GetContainersRequestPBImpl extends GetContainersRequest {
|
|||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (applicationAttemptId != null) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
builder
|
||||
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -110,8 +110,8 @@ public class GetContainersRequestPBImpl extends GetContainersRequest {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptId(
|
||||
ApplicationAttemptId applicationAttemptId) {
|
||||
public void
|
||||
setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttemptId == null) {
|
||||
builder.clearApplicationAttemptId();
|
||||
|
@ -124,8 +124,8 @@ public class GetContainersRequestPBImpl extends GetContainersRequest {
|
|||
return new ApplicationAttemptIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdProto convertToProtoFormat(
|
||||
ApplicationAttemptId t) {
|
||||
private ApplicationAttemptIdProto
|
||||
convertToProtoFormat(ApplicationAttemptId t) {
|
||||
return ((ApplicationAttemptIdPBImpl) t).getProto();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,11 +35,10 @@ import com.google.protobuf.TextFormat;
|
|||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetContainersResponsePBImpl
|
||||
extends GetContainersResponse {
|
||||
public class GetContainersResponsePBImpl extends GetContainersResponse {
|
||||
|
||||
GetContainersResponseProto proto =
|
||||
GetContainersResponseProto.getDefaultInstance();
|
||||
GetContainersResponseProto proto = GetContainersResponseProto
|
||||
.getDefaultInstance();
|
||||
GetContainersResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -140,32 +139,33 @@ extends GetContainersResponse {
|
|||
if (containerList == null) {
|
||||
return;
|
||||
}
|
||||
Iterable<ContainerReportProto> iterable = new Iterable<ContainerReportProto>() {
|
||||
@Override
|
||||
public Iterator<ContainerReportProto> iterator() {
|
||||
return new Iterator<ContainerReportProto>() {
|
||||
|
||||
Iterator<ContainerReport> iter = containerList.iterator();
|
||||
|
||||
Iterable<ContainerReportProto> iterable =
|
||||
new Iterable<ContainerReportProto>() {
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
public Iterator<ContainerReportProto> iterator() {
|
||||
return new Iterator<ContainerReportProto>() {
|
||||
|
||||
@Override
|
||||
public ContainerReportProto next() {
|
||||
return convertToProtoFormat(iter.next());
|
||||
}
|
||||
Iterator<ContainerReport> iter = containerList.iterator();
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainerReportProto next() {
|
||||
return convertToProtoFormat(iter.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
builder.addAllContainers(iterable);
|
||||
}
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import org.apache.hadoop.yarn.proto.YarnProtos.YarnApplicationAttemptStateProto;
|
|||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ApplicationAttemptReportPBImpl extends ApplicationAttemptReport {
|
||||
ApplicationAttemptReportProto proto =
|
||||
ApplicationAttemptReportProto.getDefaultInstance();
|
||||
ApplicationAttemptReportProto proto = ApplicationAttemptReportProto
|
||||
.getDefaultInstance();
|
||||
ApplicationAttemptReportProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -126,7 +126,8 @@ public class ApplicationAttemptReportPBImpl extends ApplicationAttemptReport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
public void
|
||||
setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttemptId == null)
|
||||
builder.clearApplicationAttemptId();
|
||||
|
@ -150,7 +151,7 @@ public class ApplicationAttemptReportPBImpl extends ApplicationAttemptReport {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setTrackingUrl(String url) {
|
||||
public void setTrackingUrl(String url) {
|
||||
maybeInitBuilder();
|
||||
if (url == null) {
|
||||
builder.clearTrackingUrl();
|
||||
|
@ -212,22 +213,22 @@ public class ApplicationAttemptReportPBImpl extends ApplicationAttemptReport {
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.ApplicationAttemptId != null &&
|
||||
!((ApplicationAttemptIdPBImpl) this.ApplicationAttemptId)
|
||||
.getProto().equals(builder.getApplicationAttemptId())) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.ApplicationAttemptId));
|
||||
if (this.ApplicationAttemptId != null
|
||||
&& !((ApplicationAttemptIdPBImpl) this.ApplicationAttemptId).getProto()
|
||||
.equals(builder.getApplicationAttemptId())) {
|
||||
builder
|
||||
.setApplicationAttemptId(convertToProtoFormat(this.ApplicationAttemptId));
|
||||
}
|
||||
|
||||
if (this.amContainerId != null
|
||||
&& !((ContainerIdPBImpl) this.amContainerId).getProto().equals(
|
||||
builder.getAmContainerId())) {
|
||||
builder.getAmContainerId())) {
|
||||
builder.setAmContainerId(convertToProtoFormat(this.amContainerId));
|
||||
}
|
||||
}
|
||||
|
||||
private ContainerIdProto convertToProtoFormat(ContainerId amContainerId) {
|
||||
return ((ContainerIdPBImpl)amContainerId).getProto();
|
||||
return ((ContainerIdPBImpl) amContainerId).getProto();
|
||||
}
|
||||
|
||||
private ContainerIdPBImpl convertFromProtoFormat(
|
||||
|
@ -255,8 +256,7 @@ public class ApplicationAttemptReportPBImpl extends ApplicationAttemptReport {
|
|||
if (!p.hasAmContainerId()) {
|
||||
return null;
|
||||
}
|
||||
this.amContainerId =
|
||||
convertFromProtoFormat(p.getAmContainerId());
|
||||
this.amContainerId = convertFromProtoFormat(p.getAmContainerId());
|
||||
return this.amContainerId;
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ public class ContainerReportPBImpl extends ContainerReport {
|
|||
private void mergeLocalToBuilder() {
|
||||
if (this.containerId != null
|
||||
&& !((ContainerIdPBImpl) containerId).getProto().equals(
|
||||
builder.getContainerId())) {
|
||||
builder.getContainerId())) {
|
||||
builder.setContainerId(convertToProtoFormat(this.containerId));
|
||||
}
|
||||
if (this.nodeId != null
|
||||
|
@ -277,12 +277,12 @@ public class ContainerReportPBImpl extends ContainerReport {
|
|||
}
|
||||
if (this.resource != null
|
||||
&& !((ResourcePBImpl) this.resource).getProto().equals(
|
||||
builder.getResource())) {
|
||||
builder.getResource())) {
|
||||
builder.setResource(convertToProtoFormat(this.resource));
|
||||
}
|
||||
if (this.priority != null
|
||||
&& !((PriorityPBImpl) this.priority).getProto().equals(
|
||||
builder.getPriority())) {
|
||||
builder.getPriority())) {
|
||||
builder.setPriority(convertToProtoFormat(this.priority));
|
||||
}
|
||||
}
|
||||
|
@ -334,7 +334,8 @@ public class ContainerReportPBImpl extends ContainerReport {
|
|||
return ((PriorityPBImpl) p).getProto();
|
||||
}
|
||||
|
||||
private ContainerStateProto convertToProtoFormat(ContainerState containerState) {
|
||||
private ContainerStateProto
|
||||
convertToProtoFormat(ContainerState containerState) {
|
||||
return ProtoUtils.convertToProtoFormat(containerState);
|
||||
}
|
||||
|
||||
|
|
|
@ -47,11 +47,11 @@ public class AHSProxy<T> {
|
|||
final Class<T> protocol, final InetSocketAddress rmAddress)
|
||||
throws IOException {
|
||||
return UserGroupInformation.getCurrentUser().doAs(
|
||||
new PrivilegedAction<T>() {
|
||||
@Override
|
||||
public T run() {
|
||||
return (T) YarnRPC.create(conf).getProxy(protocol, rmAddress, conf);
|
||||
}
|
||||
});
|
||||
new PrivilegedAction<T>() {
|
||||
@Override
|
||||
public T run() {
|
||||
return (T) YarnRPC.create(conf).getProxy(protocol, rmAddress, conf);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ import org.apache.hadoop.yarn.ipc.YarnRPC;
|
|||
|
||||
public class ApplicationHistoryClientService extends AbstractService {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryClientService.class);
|
||||
.getLog(ApplicationHistoryClientService.class);
|
||||
private ApplicationHistoryManager history;
|
||||
private ApplicationHistoryProtocol protocolHandler;
|
||||
private Server server;
|
||||
|
@ -75,18 +75,21 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
protected void serviceStart() throws Exception {
|
||||
Configuration conf = getConfig();
|
||||
YarnRPC rpc = YarnRPC.create(conf);
|
||||
InetSocketAddress address = conf.getSocketAddr(
|
||||
YarnConfiguration.AHS_ADDRESS, YarnConfiguration.DEFAULT_AHS_ADDRESS,
|
||||
YarnConfiguration.DEFAULT_AHS_PORT);
|
||||
InetSocketAddress address =
|
||||
conf.getSocketAddr(YarnConfiguration.AHS_ADDRESS,
|
||||
YarnConfiguration.DEFAULT_AHS_ADDRESS,
|
||||
YarnConfiguration.DEFAULT_AHS_PORT);
|
||||
|
||||
server = rpc.getServer(ApplicationHistoryProtocol.class, protocolHandler,
|
||||
address, conf, null, conf.getInt(
|
||||
server =
|
||||
rpc.getServer(ApplicationHistoryProtocol.class, protocolHandler,
|
||||
address, conf, null, conf.getInt(
|
||||
YarnConfiguration.AHS_CLIENT_THREAD_COUNT,
|
||||
YarnConfiguration.DEFAULT_AHS_CLIENT_THREAD_COUNT));
|
||||
|
||||
server.start();
|
||||
this.bindAddress = conf.updateConnectAddr(YarnConfiguration.AHS_ADDRESS,
|
||||
server.getListenerAddress());
|
||||
this.bindAddress =
|
||||
conf.updateConnectAddr(YarnConfiguration.AHS_ADDRESS,
|
||||
server.getListenerAddress());
|
||||
LOG.info("Instantiated ApplicationHistoryClientService at "
|
||||
+ this.bindAddress);
|
||||
|
||||
|
@ -126,9 +129,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
GetApplicationAttemptReportRequest request) throws YarnException,
|
||||
IOException {
|
||||
try {
|
||||
GetApplicationAttemptReportResponse response = GetApplicationAttemptReportResponse
|
||||
.newInstance(history.getApplicationAttempt(request
|
||||
.getApplicationAttemptId()));
|
||||
GetApplicationAttemptReportResponse response =
|
||||
GetApplicationAttemptReportResponse.newInstance(history
|
||||
.getApplicationAttempt(request.getApplicationAttemptId()));
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
throw new ApplicationAttemptNotFoundException(e.getMessage());
|
||||
|
@ -139,8 +142,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
public GetApplicationAttemptsResponse getApplicationAttempts(
|
||||
GetApplicationAttemptsRequest request) throws YarnException,
|
||||
IOException {
|
||||
GetApplicationAttemptsResponse response = GetApplicationAttemptsResponse
|
||||
.newInstance(new ArrayList<ApplicationAttemptReport>(history
|
||||
GetApplicationAttemptsResponse response =
|
||||
GetApplicationAttemptsResponse
|
||||
.newInstance(new ArrayList<ApplicationAttemptReport>(history
|
||||
.getApplicationAttempts(request.getApplicationId()).values()));
|
||||
return response;
|
||||
}
|
||||
|
@ -150,8 +154,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
GetApplicationReportRequest request) throws YarnException, IOException {
|
||||
try {
|
||||
ApplicationId applicationId = request.getApplicationId();
|
||||
GetApplicationReportResponse response = GetApplicationReportResponse
|
||||
.newInstance(history.getApplication(applicationId));
|
||||
GetApplicationReportResponse response =
|
||||
GetApplicationReportResponse.newInstance(history
|
||||
.getApplication(applicationId));
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
throw new ApplicationNotFoundException(e.getMessage());
|
||||
|
@ -161,9 +166,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
@Override
|
||||
public GetApplicationsResponse getApplications(
|
||||
GetApplicationsRequest request) throws YarnException, IOException {
|
||||
GetApplicationsResponse response = GetApplicationsResponse
|
||||
.newInstance(new ArrayList<ApplicationReport>(history
|
||||
.getAllApplications().values()));
|
||||
GetApplicationsResponse response =
|
||||
GetApplicationsResponse.newInstance(new ArrayList<ApplicationReport>(
|
||||
history.getAllApplications().values()));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -171,8 +176,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
public GetContainerReportResponse getContainerReport(
|
||||
GetContainerReportRequest request) throws YarnException, IOException {
|
||||
try {
|
||||
GetContainerReportResponse response = GetContainerReportResponse
|
||||
.newInstance(history.getContainer(request.getContainerId()));
|
||||
GetContainerReportResponse response =
|
||||
GetContainerReportResponse.newInstance(history.getContainer(request
|
||||
.getContainerId()));
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
throw new ContainerNotFoundException(e.getMessage());
|
||||
|
@ -182,9 +188,9 @@ public class ApplicationHistoryClientService extends AbstractService {
|
|||
@Override
|
||||
public GetContainersResponse getContainers(GetContainersRequest request)
|
||||
throws YarnException, IOException {
|
||||
GetContainersResponse response = GetContainersResponse
|
||||
.newInstance(new ArrayList<ContainerReport>(history.getContainers(
|
||||
request.getApplicationAttemptId()).values()));
|
||||
GetContainersResponse response =
|
||||
GetContainersResponse.newInstance(new ArrayList<ContainerReport>(
|
||||
history.getContainers(request.getApplicationAttemptId()).values()));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ import com.google.common.annotations.VisibleForTesting;
|
|||
public class ApplicationHistoryManagerImpl extends AbstractService implements
|
||||
ApplicationHistoryManager {
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryManagerImpl.class);
|
||||
.getLog(ApplicationHistoryManagerImpl.class);
|
||||
private static final String UNAVAILABLE = "N/A";
|
||||
|
||||
private ApplicationHistoryStore historyStore;
|
||||
|
@ -79,8 +79,8 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
protected ApplicationHistoryStore createApplicationHistoryStore(
|
||||
Configuration conf) {
|
||||
return ReflectionUtils.newInstance(conf.getClass(
|
||||
YarnConfiguration.AHS_STORE, FileSystemApplicationHistoryStore.class,
|
||||
ApplicationHistoryStore.class), conf);
|
||||
YarnConfiguration.AHS_STORE, FileSystemApplicationHistoryStore.class,
|
||||
ApplicationHistoryStore.class), conf);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,9 +92,10 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
@Override
|
||||
public Map<ApplicationId, ApplicationReport> getAllApplications()
|
||||
throws IOException {
|
||||
Map<ApplicationId, ApplicationHistoryData> histData = historyStore
|
||||
.getAllApplications();
|
||||
HashMap<ApplicationId, ApplicationReport> applicationsReport = new HashMap<ApplicationId, ApplicationReport>();
|
||||
Map<ApplicationId, ApplicationHistoryData> histData =
|
||||
historyStore.getAllApplications();
|
||||
HashMap<ApplicationId, ApplicationReport> applicationsReport =
|
||||
new HashMap<ApplicationId, ApplicationReport>();
|
||||
for (Entry<ApplicationId, ApplicationHistoryData> entry : histData
|
||||
.entrySet()) {
|
||||
applicationsReport.put(entry.getKey(),
|
||||
|
@ -116,8 +117,8 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
String host = UNAVAILABLE;
|
||||
int rpcPort = -1;
|
||||
|
||||
ApplicationAttemptHistoryData lastAttempt = getLastAttempt(appHistory
|
||||
.getApplicationId());
|
||||
ApplicationAttemptHistoryData lastAttempt =
|
||||
getLastAttempt(appHistory.getApplicationId());
|
||||
if (lastAttempt != null) {
|
||||
currentApplicationAttemptId = lastAttempt.getApplicationAttemptId();
|
||||
trackingUrl = lastAttempt.getTrackingURL();
|
||||
|
@ -125,18 +126,18 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
rpcPort = lastAttempt.getRPCPort();
|
||||
}
|
||||
return ApplicationReport.newInstance(appHistory.getApplicationId(),
|
||||
currentApplicationAttemptId, appHistory.getUser(), appHistory
|
||||
.getQueue(), appHistory.getApplicationName(), host, rpcPort, null,
|
||||
appHistory.getYarnApplicationState(), appHistory.getDiagnosticsInfo(),
|
||||
trackingUrl, appHistory.getStartTime(), appHistory.getFinishTime(),
|
||||
appHistory.getFinalApplicationStatus(), null, "", 100, appHistory
|
||||
.getApplicationType(), null);
|
||||
currentApplicationAttemptId, appHistory.getUser(), appHistory.getQueue(),
|
||||
appHistory.getApplicationName(), host, rpcPort, null,
|
||||
appHistory.getYarnApplicationState(), appHistory.getDiagnosticsInfo(),
|
||||
trackingUrl, appHistory.getStartTime(), appHistory.getFinishTime(),
|
||||
appHistory.getFinalApplicationStatus(), null, "", 100,
|
||||
appHistory.getApplicationType(), null);
|
||||
}
|
||||
|
||||
private ApplicationAttemptHistoryData getLastAttempt(ApplicationId appId)
|
||||
throws IOException {
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> attempts = historyStore
|
||||
.getApplicationAttempts(appId);
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> attempts =
|
||||
historyStore.getApplicationAttempts(appId);
|
||||
ApplicationAttemptId prevMaxAttemptId = null;
|
||||
for (ApplicationAttemptId attemptId : attempts.keySet()) {
|
||||
if (prevMaxAttemptId == null) {
|
||||
|
@ -152,27 +153,28 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
|
||||
private ApplicationAttemptReport convertToApplicationAttemptReport(
|
||||
ApplicationAttemptHistoryData appAttemptHistory) {
|
||||
return ApplicationAttemptReport.newInstance(appAttemptHistory
|
||||
.getApplicationAttemptId(), appAttemptHistory.getHost(),
|
||||
appAttemptHistory.getRPCPort(), appAttemptHistory.getTrackingURL(),
|
||||
appAttemptHistory.getDiagnosticsInfo(),
|
||||
appAttemptHistory.getYarnApplicationAttemptState(),
|
||||
appAttemptHistory.getMasterContainerId());
|
||||
return ApplicationAttemptReport.newInstance(
|
||||
appAttemptHistory.getApplicationAttemptId(), appAttemptHistory.getHost(),
|
||||
appAttemptHistory.getRPCPort(), appAttemptHistory.getTrackingURL(),
|
||||
appAttemptHistory.getDiagnosticsInfo(),
|
||||
appAttemptHistory.getYarnApplicationAttemptState(),
|
||||
appAttemptHistory.getMasterContainerId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAttemptReport getApplicationAttempt(
|
||||
ApplicationAttemptId appAttemptId) throws IOException {
|
||||
return convertToApplicationAttemptReport(historyStore
|
||||
.getApplicationAttempt(appAttemptId));
|
||||
.getApplicationAttempt(appAttemptId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ApplicationAttemptId, ApplicationAttemptReport> getApplicationAttempts(
|
||||
ApplicationId appId) throws IOException {
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> histData = historyStore
|
||||
.getApplicationAttempts(appId);
|
||||
HashMap<ApplicationAttemptId, ApplicationAttemptReport> applicationAttemptsReport = new HashMap<ApplicationAttemptId, ApplicationAttemptReport>();
|
||||
public Map<ApplicationAttemptId, ApplicationAttemptReport>
|
||||
getApplicationAttempts(ApplicationId appId) throws IOException {
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> histData =
|
||||
historyStore.getApplicationAttempts(appId);
|
||||
HashMap<ApplicationAttemptId, ApplicationAttemptReport> applicationAttemptsReport =
|
||||
new HashMap<ApplicationAttemptId, ApplicationAttemptReport>();
|
||||
for (Entry<ApplicationAttemptId, ApplicationAttemptHistoryData> entry : histData
|
||||
.entrySet()) {
|
||||
applicationAttemptsReport.put(entry.getKey(),
|
||||
|
@ -190,20 +192,21 @@ public class ApplicationHistoryManagerImpl extends AbstractService implements
|
|||
private ContainerReport convertToContainerReport(
|
||||
ContainerHistoryData containerHistory) {
|
||||
return ContainerReport.newInstance(containerHistory.getContainerId(),
|
||||
containerHistory.getAllocatedResource(), containerHistory
|
||||
.getAssignedNode(), containerHistory.getPriority(),
|
||||
containerHistory.getStartTime(), containerHistory.getFinishTime(),
|
||||
containerHistory.getDiagnosticsInfo(), containerHistory.getLogURL(),
|
||||
containerHistory.getContainerExitStatus(), containerHistory
|
||||
.getContainerState());
|
||||
containerHistory.getAllocatedResource(),
|
||||
containerHistory.getAssignedNode(), containerHistory.getPriority(),
|
||||
containerHistory.getStartTime(), containerHistory.getFinishTime(),
|
||||
containerHistory.getDiagnosticsInfo(), containerHistory.getLogURL(),
|
||||
containerHistory.getContainerExitStatus(),
|
||||
containerHistory.getContainerState());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<ContainerId, ContainerReport> getContainers(
|
||||
ApplicationAttemptId appAttemptId) throws IOException {
|
||||
Map<ContainerId, ContainerHistoryData> histData = historyStore
|
||||
.getContainers(appAttemptId);
|
||||
HashMap<ContainerId, ContainerReport> containersReport = new HashMap<ContainerId, ContainerReport>();
|
||||
Map<ContainerId, ContainerHistoryData> histData =
|
||||
historyStore.getContainers(appAttemptId);
|
||||
HashMap<ContainerId, ContainerReport> containersReport =
|
||||
new HashMap<ContainerId, ContainerReport>();
|
||||
for (Entry<ContainerId, ContainerHistoryData> entry : histData.entrySet()) {
|
||||
containersReport.put(entry.getKey(),
|
||||
convertToContainerReport(entry.getValue()));
|
||||
|
|
|
@ -37,7 +37,8 @@ public interface ApplicationHistoryReader {
|
|||
/**
|
||||
* This method returns Application {@link ApplicationHistoryData} for the
|
||||
* specified {@link ApplicationId}.
|
||||
* @param appId
|
||||
*
|
||||
* @param appId
|
||||
*
|
||||
* @return {@link ApplicationHistoryData} for the ApplicationId.
|
||||
* @throws IOException
|
||||
|
@ -57,19 +58,21 @@ public interface ApplicationHistoryReader {
|
|||
* Application can have multiple application attempts
|
||||
* {@link ApplicationAttemptHistoryData}. This method returns the all
|
||||
* {@link ApplicationAttemptHistoryData}s for the Application.
|
||||
* @param appId
|
||||
*
|
||||
* @param appId
|
||||
*
|
||||
* @return all {@link ApplicationAttemptHistoryData}s for the Application.
|
||||
* @throws IOException
|
||||
*/
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData> getApplicationAttempts(
|
||||
ApplicationId appId) throws IOException;
|
||||
Map<ApplicationAttemptId, ApplicationAttemptHistoryData>
|
||||
getApplicationAttempts(ApplicationId appId) throws IOException;
|
||||
|
||||
/**
|
||||
* This method returns {@link ApplicationAttemptHistoryData} for specified
|
||||
* {@link ApplicationId}.
|
||||
*
|
||||
* @param appAttemptId {@link ApplicationAttemptId}
|
||||
* @param appAttemptId
|
||||
* {@link ApplicationAttemptId}
|
||||
* @return {@link ApplicationAttemptHistoryData} for ApplicationAttemptId
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -80,7 +83,8 @@ public interface ApplicationHistoryReader {
|
|||
* This method returns {@link ContainerHistoryData} for specified
|
||||
* {@link ContainerId}.
|
||||
*
|
||||
* @param containerId {@link ContainerId}
|
||||
* @param containerId
|
||||
* {@link ContainerId}
|
||||
* @return {@link ContainerHistoryData} for ContainerId
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -90,13 +94,14 @@ public interface ApplicationHistoryReader {
|
|||
* This method returns {@link ContainerHistoryData} for specified
|
||||
* {@link ApplicationAttemptId}.
|
||||
*
|
||||
* @param appAttemptId {@link ApplicationAttemptId}
|
||||
* @param appAttemptId
|
||||
* {@link ApplicationAttemptId}
|
||||
* @return {@link ContainerHistoryData} for ApplicationAttemptId
|
||||
* @throws IOException
|
||||
*/
|
||||
ContainerHistoryData getAMContainer(ApplicationAttemptId appAttemptId)
|
||||
throws IOException;
|
||||
|
||||
|
||||
/**
|
||||
* This method returns Map{@link ContainerId} to {@link ContainerHistoryData}
|
||||
* for specified {@link ApplicationAttemptId}.
|
||||
|
|
|
@ -47,7 +47,7 @@ public class ApplicationHistoryServer extends CompositeService {
|
|||
|
||||
public static final int SHUTDOWN_HOOK_PRIORITY = 30;
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(ApplicationHistoryServer.class);
|
||||
.getLog(ApplicationHistoryServer.class);
|
||||
|
||||
ApplicationHistoryClientService ahsClientService;
|
||||
ApplicationHistoryManager historyManager;
|
||||
|
@ -91,8 +91,9 @@ public class ApplicationHistoryServer extends CompositeService {
|
|||
return this.ahsClientService;
|
||||
}
|
||||
|
||||
protected ApplicationHistoryClientService createApplicationHistoryClientService(
|
||||
ApplicationHistoryManager historyManager) {
|
||||
protected ApplicationHistoryClientService
|
||||
createApplicationHistoryClientService(
|
||||
ApplicationHistoryManager historyManager) {
|
||||
return new ApplicationHistoryClientService(historyManager);
|
||||
}
|
||||
|
||||
|
@ -106,15 +107,15 @@ public class ApplicationHistoryServer extends CompositeService {
|
|||
|
||||
static ApplicationHistoryServer launchAppHistoryServer(String[] args) {
|
||||
Thread
|
||||
.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
|
||||
.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler());
|
||||
StringUtils.startupShutdownMessage(ApplicationHistoryServer.class, args,
|
||||
LOG);
|
||||
LOG);
|
||||
ApplicationHistoryServer appHistoryServer = null;
|
||||
try {
|
||||
appHistoryServer = new ApplicationHistoryServer();
|
||||
ShutdownHookManager.get().addShutdownHook(
|
||||
new CompositeServiceShutdownHook(appHistoryServer),
|
||||
SHUTDOWN_HOOK_PRIORITY);
|
||||
new CompositeServiceShutdownHook(appHistoryServer),
|
||||
SHUTDOWN_HOOK_PRIORITY);
|
||||
YarnConfiguration conf = new YarnConfiguration();
|
||||
appHistoryServer.init(conf);
|
||||
appHistoryServer.start();
|
||||
|
@ -138,16 +139,16 @@ public class ApplicationHistoryServer extends CompositeService {
|
|||
String bindAddress = WebAppUtils.getAHSWebAppURLWithoutScheme(getConfig());
|
||||
LOG.info("Instantiating AHSWebApp at " + bindAddress);
|
||||
try {
|
||||
webApp = WebApps
|
||||
.$for("applicationhistory", ApplicationHistoryClientService.class,
|
||||
webApp =
|
||||
WebApps
|
||||
.$for("applicationhistory", ApplicationHistoryClientService.class,
|
||||
ahsClientService, "ws")
|
||||
.with(getConfig())
|
||||
.withHttpSpnegoPrincipalKey(
|
||||
.with(getConfig())
|
||||
.withHttpSpnegoPrincipalKey(
|
||||
YarnConfiguration.AHS_WEBAPP_SPNEGO_USER_NAME_KEY)
|
||||
.withHttpSpnegoKeytabKey(
|
||||
.withHttpSpnegoKeytabKey(
|
||||
YarnConfiguration.AHS_WEBAPP_SPNEGO_KEYTAB_FILE_KEY)
|
||||
.at(bindAddress)
|
||||
.start(new AHSWebApp(historyManager));
|
||||
.at(bindAddress).start(new AHSWebApp(historyManager));
|
||||
} catch (Exception e) {
|
||||
String msg = "AHSWebApp failed to start.";
|
||||
LOG.error(msg, e);
|
||||
|
|
|
@ -70,8 +70,8 @@ public interface ApplicationHistoryWriter {
|
|||
* available when it starts
|
||||
* @throws IOException
|
||||
*/
|
||||
void applicationAttemptStarted(
|
||||
ApplicationAttemptStartData appAttemptStart) throws IOException;
|
||||
void applicationAttemptStarted(ApplicationAttemptStartData appAttemptStart)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* This method writes the information of <code>RMAppAttempt</code> that is
|
||||
|
@ -82,8 +82,9 @@ public interface ApplicationHistoryWriter {
|
|||
* available when it finishes
|
||||
* @throws IOException
|
||||
*/
|
||||
void applicationAttemptFinished(
|
||||
ApplicationAttemptFinishData appAttemptFinish) throws IOException;
|
||||
void
|
||||
applicationAttemptFinished(ApplicationAttemptFinishData appAttemptFinish)
|
||||
throws IOException;
|
||||
|
||||
/**
|
||||
* This method writes the information of <code>RMContainer</code> that is
|
||||
|
|
|
@ -89,16 +89,16 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
implements ApplicationHistoryStore {
|
||||
|
||||
private static final Log LOG = LogFactory
|
||||
.getLog(FileSystemApplicationHistoryStore.class);
|
||||
.getLog(FileSystemApplicationHistoryStore.class);
|
||||
|
||||
private static final String ROOT_DIR_NAME = "ApplicationHistoryDataRoot";
|
||||
private static final int MIN_BLOCK_SIZE = 256 * 1024;
|
||||
private static final String START_DATA_SUFFIX = "_start";
|
||||
private static final String FINISH_DATA_SUFFIX = "_finish";
|
||||
private static final FsPermission ROOT_DIR_UMASK =
|
||||
FsPermission.createImmutable((short) 0740);
|
||||
private static final FsPermission HISTORY_FILE_UMASK =
|
||||
FsPermission.createImmutable((short) 0640);
|
||||
private static final FsPermission ROOT_DIR_UMASK = FsPermission
|
||||
.createImmutable((short) 0740);
|
||||
private static final FsPermission HISTORY_FILE_UMASK = FsPermission
|
||||
.createImmutable((short) 0640);
|
||||
|
||||
private FileSystem fs;
|
||||
private Path rootDirPath;
|
||||
|
@ -112,8 +112,8 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
|
||||
@Override
|
||||
public void serviceInit(Configuration conf) throws Exception {
|
||||
Path fsWorkingPath = new Path(
|
||||
conf.get(YarnConfiguration.FS_HISTORY_STORE_URI));
|
||||
Path fsWorkingPath =
|
||||
new Path(conf.get(YarnConfiguration.FS_HISTORY_STORE_URI));
|
||||
rootDirPath = new Path(fsWorkingPath, ROOT_DIR_NAME);
|
||||
try {
|
||||
fs = fsWorkingPath.getFileSystem(conf);
|
||||
|
@ -130,7 +130,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
public void serviceStop() throws Exception {
|
||||
try {
|
||||
for (Entry<ApplicationId, HistoryFileWriter> entry : outstandingWriters
|
||||
.entrySet()) {
|
||||
.entrySet()) {
|
||||
entry.getValue().close();
|
||||
}
|
||||
outstandingWriters.clear();
|
||||
|
@ -148,9 +148,9 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
boolean readStartData = false;
|
||||
boolean readFinishData = false;
|
||||
ApplicationHistoryData historyData =
|
||||
ApplicationHistoryData.newInstance(
|
||||
appId, null, null, null, null, Long.MIN_VALUE, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, null, FinalApplicationStatus.UNDEFINED, null);
|
||||
ApplicationHistoryData.newInstance(appId, null, null, null, null,
|
||||
Long.MIN_VALUE, Long.MIN_VALUE, Long.MAX_VALUE, null,
|
||||
FinalApplicationStatus.UNDEFINED, null);
|
||||
while ((!readStartData || !readFinishData) && hfReader.hasNext()) {
|
||||
HistoryFileReader.Entry entry = hfReader.next();
|
||||
if (entry.key.id.equals(appId.toString())) {
|
||||
|
@ -238,15 +238,14 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
hfReader.close();
|
||||
}
|
||||
for (Map.Entry<ApplicationAttemptId, StartFinishDataPair<ApplicationAttemptStartData, ApplicationAttemptFinishData>> entry : startFinshDataMap
|
||||
.entrySet()) {
|
||||
.entrySet()) {
|
||||
ApplicationAttemptHistoryData historyData =
|
||||
ApplicationAttemptHistoryData.newInstance(
|
||||
entry.getKey(), null, -1, null, null, null,
|
||||
FinalApplicationStatus.UNDEFINED, null);
|
||||
ApplicationAttemptHistoryData.newInstance(entry.getKey(), null, -1,
|
||||
null, null, null, FinalApplicationStatus.UNDEFINED, null);
|
||||
mergeApplicationAttemptHistoryData(historyData,
|
||||
entry.getValue().startData);
|
||||
entry.getValue().startData);
|
||||
mergeApplicationAttemptHistoryData(historyData,
|
||||
entry.getValue().finishData);
|
||||
entry.getValue().finishData);
|
||||
historyDataMap.put(entry.getKey(), historyData);
|
||||
}
|
||||
return historyDataMap;
|
||||
|
@ -286,9 +285,8 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
boolean readStartData = false;
|
||||
boolean readFinishData = false;
|
||||
ApplicationAttemptHistoryData historyData =
|
||||
ApplicationAttemptHistoryData.newInstance(
|
||||
appAttemptId, null, -1, null, null, null,
|
||||
FinalApplicationStatus.UNDEFINED, null);
|
||||
ApplicationAttemptHistoryData.newInstance(appAttemptId, null, -1,
|
||||
null, null, null, FinalApplicationStatus.UNDEFINED, null);
|
||||
while ((!readStartData || !readFinishData) && hfReader.hasNext()) {
|
||||
HistoryFileReader.Entry entry = hfReader.next();
|
||||
if (entry.key.id.equals(appAttemptId.toString())) {
|
||||
|
@ -333,20 +331,19 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
throws IOException {
|
||||
HistoryFileReader hfReader =
|
||||
getHistoryFileReader(containerId.getApplicationAttemptId()
|
||||
.getApplicationId());
|
||||
.getApplicationId());
|
||||
try {
|
||||
boolean readStartData = false;
|
||||
boolean readFinishData = false;
|
||||
ContainerHistoryData historyData =
|
||||
ContainerHistoryData.newInstance(containerId, null, null, null,
|
||||
Long.MIN_VALUE, Long.MAX_VALUE, null, null, Integer.MAX_VALUE,
|
||||
null);
|
||||
ContainerHistoryData
|
||||
.newInstance(containerId, null, null, null, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, null, null, Integer.MAX_VALUE, null);
|
||||
while ((!readStartData || !readFinishData) && hfReader.hasNext()) {
|
||||
HistoryFileReader.Entry entry = hfReader.next();
|
||||
if (entry.key.id.equals(containerId.toString())) {
|
||||
if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
|
||||
ContainerStartData startData =
|
||||
parseContainerStartData(entry.value);
|
||||
ContainerStartData startData = parseContainerStartData(entry.value);
|
||||
mergeContainerHistoryData(historyData, startData);
|
||||
readStartData = true;
|
||||
} else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
|
||||
|
@ -404,10 +401,10 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
if (entry.key.id.startsWith(ConverterUtils.CONTAINER_PREFIX)) {
|
||||
if (entry.key.suffix.equals(START_DATA_SUFFIX)) {
|
||||
retrieveStartFinishData(appAttemptId, entry, startFinshDataMap,
|
||||
true);
|
||||
true);
|
||||
} else if (entry.key.suffix.equals(FINISH_DATA_SUFFIX)) {
|
||||
retrieveStartFinishData(appAttemptId, entry, startFinshDataMap,
|
||||
false);
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -420,11 +417,11 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
hfReader.close();
|
||||
}
|
||||
for (Map.Entry<ContainerId, StartFinishDataPair<ContainerStartData, ContainerFinishData>> entry : startFinshDataMap
|
||||
.entrySet()) {
|
||||
.entrySet()) {
|
||||
ContainerHistoryData historyData =
|
||||
ContainerHistoryData.newInstance(entry.getKey(), null, null, null,
|
||||
Long.MIN_VALUE, Long.MAX_VALUE, null, null, Integer.MAX_VALUE,
|
||||
null);
|
||||
ContainerHistoryData
|
||||
.newInstance(entry.getKey(), null, null, null, Long.MIN_VALUE,
|
||||
Long.MAX_VALUE, null, null, Integer.MAX_VALUE, null);
|
||||
mergeContainerHistoryData(historyData, entry.getValue().startData);
|
||||
mergeContainerHistoryData(historyData, entry.getValue().finishData);
|
||||
historyDataMap.put(entry.getKey(), historyData);
|
||||
|
@ -439,8 +436,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
HistoryFileReader.Entry entry,
|
||||
Map<ContainerId, StartFinishDataPair<ContainerStartData, ContainerFinishData>> startFinshDataMap,
|
||||
boolean start) throws IOException {
|
||||
ContainerId containerId =
|
||||
ConverterUtils.toContainerId(entry.key.id);
|
||||
ContainerId containerId = ConverterUtils.toContainerId(entry.key.id);
|
||||
if (containerId.getApplicationAttemptId().equals(appAttemptId)) {
|
||||
StartFinishDataPair<ContainerStartData, ContainerFinishData> pair =
|
||||
startFinshDataMap.get(containerId);
|
||||
|
@ -482,9 +478,8 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
assert appStart instanceof ApplicationStartDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(appStart.getApplicationId()
|
||||
.toString(), START_DATA_SUFFIX),
|
||||
((ApplicationStartDataPBImpl) appStart)
|
||||
.getProto().toByteArray());
|
||||
.toString(), START_DATA_SUFFIX),
|
||||
((ApplicationStartDataPBImpl) appStart).getProto().toByteArray());
|
||||
LOG.info("Start information of application "
|
||||
+ appStart.getApplicationId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -501,10 +496,9 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
getHistoryFileWriter(appFinish.getApplicationId());
|
||||
assert appFinish instanceof ApplicationFinishDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(
|
||||
new HistoryDataKey(appFinish.getApplicationId().toString(),
|
||||
FINISH_DATA_SUFFIX),
|
||||
((ApplicationFinishDataPBImpl) appFinish).getProto().toByteArray());
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(appFinish.getApplicationId()
|
||||
.toString(), FINISH_DATA_SUFFIX),
|
||||
((ApplicationFinishDataPBImpl) appFinish).getProto().toByteArray());
|
||||
LOG.info("Finish information of application "
|
||||
+ appFinish.getApplicationId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -522,15 +516,13 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
ApplicationAttemptStartData appAttemptStart) throws IOException {
|
||||
HistoryFileWriter hfWriter =
|
||||
getHistoryFileWriter(appAttemptStart.getApplicationAttemptId()
|
||||
.getApplicationId());
|
||||
.getApplicationId());
|
||||
assert appAttemptStart instanceof ApplicationAttemptStartDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(
|
||||
new HistoryDataKey(appAttemptStart.getApplicationAttemptId()
|
||||
.toString(),
|
||||
START_DATA_SUFFIX),
|
||||
((ApplicationAttemptStartDataPBImpl) appAttemptStart).getProto()
|
||||
.toByteArray());
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(appAttemptStart
|
||||
.getApplicationAttemptId().toString(), START_DATA_SUFFIX),
|
||||
((ApplicationAttemptStartDataPBImpl) appAttemptStart).getProto()
|
||||
.toByteArray());
|
||||
LOG.info("Start information of application attempt "
|
||||
+ appAttemptStart.getApplicationAttemptId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -545,15 +537,13 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
ApplicationAttemptFinishData appAttemptFinish) throws IOException {
|
||||
HistoryFileWriter hfWriter =
|
||||
getHistoryFileWriter(appAttemptFinish.getApplicationAttemptId()
|
||||
.getApplicationId());
|
||||
.getApplicationId());
|
||||
assert appAttemptFinish instanceof ApplicationAttemptFinishDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(
|
||||
new HistoryDataKey(appAttemptFinish.getApplicationAttemptId()
|
||||
.toString(),
|
||||
FINISH_DATA_SUFFIX),
|
||||
((ApplicationAttemptFinishDataPBImpl) appAttemptFinish).getProto()
|
||||
.toByteArray());
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(appAttemptFinish
|
||||
.getApplicationAttemptId().toString(), FINISH_DATA_SUFFIX),
|
||||
((ApplicationAttemptFinishDataPBImpl) appAttemptFinish).getProto()
|
||||
.toByteArray());
|
||||
LOG.info("Finish information of application attempt "
|
||||
+ appAttemptFinish.getApplicationAttemptId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -568,14 +558,12 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
throws IOException {
|
||||
HistoryFileWriter hfWriter =
|
||||
getHistoryFileWriter(containerStart.getContainerId()
|
||||
.getApplicationAttemptId()
|
||||
.getApplicationId());
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
assert containerStart instanceof ContainerStartDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(
|
||||
new HistoryDataKey(containerStart.getContainerId().toString(),
|
||||
START_DATA_SUFFIX),
|
||||
((ContainerStartDataPBImpl) containerStart).getProto().toByteArray());
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(containerStart
|
||||
.getContainerId().toString(), START_DATA_SUFFIX),
|
||||
((ContainerStartDataPBImpl) containerStart).getProto().toByteArray());
|
||||
LOG.info("Start information of container "
|
||||
+ containerStart.getContainerId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -590,14 +578,12 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
throws IOException {
|
||||
HistoryFileWriter hfWriter =
|
||||
getHistoryFileWriter(containerFinish.getContainerId()
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
assert containerFinish instanceof ContainerFinishDataPBImpl;
|
||||
try {
|
||||
hfWriter.writeHistoryData(
|
||||
new HistoryDataKey(containerFinish.getContainerId().toString(),
|
||||
FINISH_DATA_SUFFIX),
|
||||
((ContainerFinishDataPBImpl) containerFinish).getProto()
|
||||
.toByteArray());
|
||||
hfWriter.writeHistoryData(new HistoryDataKey(containerFinish
|
||||
.getContainerId().toString(), FINISH_DATA_SUFFIX),
|
||||
((ContainerFinishDataPBImpl) containerFinish).getProto().toByteArray());
|
||||
LOG.info("Finish information of container "
|
||||
+ containerFinish.getContainerId() + " is written");
|
||||
} catch (IOException e) {
|
||||
|
@ -609,43 +595,42 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
private static ApplicationStartData parseApplicationStartData(byte[] value)
|
||||
throws InvalidProtocolBufferException {
|
||||
return new ApplicationStartDataPBImpl(
|
||||
ApplicationStartDataProto.parseFrom(value));
|
||||
ApplicationStartDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static ApplicationFinishData parseApplicationFinishData(byte[] value)
|
||||
throws InvalidProtocolBufferException {
|
||||
return new ApplicationFinishDataPBImpl(
|
||||
ApplicationFinishDataProto.parseFrom(value));
|
||||
ApplicationFinishDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static ApplicationAttemptStartData parseApplicationAttemptStartData(
|
||||
byte[] value) throws InvalidProtocolBufferException {
|
||||
return new ApplicationAttemptStartDataPBImpl(
|
||||
ApplicationAttemptStartDataProto.parseFrom(value));
|
||||
ApplicationAttemptStartDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static ApplicationAttemptFinishData
|
||||
parseApplicationAttemptFinishData(
|
||||
byte[] value) throws InvalidProtocolBufferException {
|
||||
parseApplicationAttemptFinishData(byte[] value)
|
||||
throws InvalidProtocolBufferException {
|
||||
return new ApplicationAttemptFinishDataPBImpl(
|
||||
ApplicationAttemptFinishDataProto.parseFrom(value));
|
||||
ApplicationAttemptFinishDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static ContainerStartData parseContainerStartData(byte[] value)
|
||||
throws InvalidProtocolBufferException {
|
||||
return new ContainerStartDataPBImpl(
|
||||
ContainerStartDataProto.parseFrom(value));
|
||||
ContainerStartDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static ContainerFinishData parseContainerFinishData(byte[] value)
|
||||
throws InvalidProtocolBufferException {
|
||||
return new ContainerFinishDataPBImpl(
|
||||
ContainerFinishDataProto.parseFrom(value));
|
||||
ContainerFinishDataProto.parseFrom(value));
|
||||
}
|
||||
|
||||
private static void mergeApplicationHistoryData(
|
||||
ApplicationHistoryData historyData,
|
||||
ApplicationStartData startData) {
|
||||
ApplicationHistoryData historyData, ApplicationStartData startData) {
|
||||
historyData.setApplicationName(startData.getApplicationName());
|
||||
historyData.setApplicationType(startData.getApplicationType());
|
||||
historyData.setQueue(startData.getQueue());
|
||||
|
@ -655,12 +640,11 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
}
|
||||
|
||||
private static void mergeApplicationHistoryData(
|
||||
ApplicationHistoryData historyData,
|
||||
ApplicationFinishData finishData) {
|
||||
ApplicationHistoryData historyData, ApplicationFinishData finishData) {
|
||||
historyData.setFinishTime(finishData.getFinishTime());
|
||||
historyData.setDiagnosticsInfo(finishData.getDiagnosticsInfo());
|
||||
historyData.setFinalApplicationStatus(finishData
|
||||
.getFinalApplicationStatus());
|
||||
.getFinalApplicationStatus());
|
||||
historyData.setYarnApplicationState(finishData.getYarnApplicationState());
|
||||
}
|
||||
|
||||
|
@ -678,9 +662,9 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
historyData.setDiagnosticsInfo(finishData.getDiagnosticsInfo());
|
||||
historyData.setTrackingURL(finishData.getTrackingURL());
|
||||
historyData.setFinalApplicationStatus(finishData
|
||||
.getFinalApplicationStatus());
|
||||
.getFinalApplicationStatus());
|
||||
historyData.setYarnApplicationAttemptState(finishData
|
||||
.getYarnApplicationAttemptState());
|
||||
.getYarnApplicationAttemptState());
|
||||
}
|
||||
|
||||
private static void mergeContainerHistoryData(
|
||||
|
@ -696,8 +680,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
historyData.setFinishTime(finishData.getFinishTime());
|
||||
historyData.setDiagnosticsInfo(finishData.getDiagnosticsInfo());
|
||||
historyData.setLogURL(finishData.getLogURL());
|
||||
historyData.setContainerExitStatus(finishData
|
||||
.getContainerExitStatus());
|
||||
historyData.setContainerExitStatus(finishData.getContainerExitStatus());
|
||||
historyData.setContainerState(finishData.getContainerState());
|
||||
}
|
||||
|
||||
|
@ -746,7 +729,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
FSDataInputStream fsdis = fs.open(historyFile);
|
||||
reader =
|
||||
new TFile.Reader(fsdis, fs.getFileStatus(historyFile).getLen(),
|
||||
getConfig());
|
||||
getConfig());
|
||||
reset();
|
||||
}
|
||||
|
||||
|
@ -782,8 +765,7 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
private FSDataOutputStream fsdos;
|
||||
private TFile.Writer writer;
|
||||
|
||||
public HistoryFileWriter(Path historyFile)
|
||||
throws IOException {
|
||||
public HistoryFileWriter(Path historyFile) throws IOException {
|
||||
if (fs.exists(historyFile)) {
|
||||
fsdos = fs.append(historyFile);
|
||||
} else {
|
||||
|
@ -792,9 +774,9 @@ public class FileSystemApplicationHistoryStore extends AbstractService
|
|||
fs.setPermission(historyFile, HISTORY_FILE_UMASK);
|
||||
writer =
|
||||
new TFile.Writer(fsdos, MIN_BLOCK_SIZE, getConfig().get(
|
||||
YarnConfiguration.FS_HISTORY_STORE_COMPRESSION_TYPE,
|
||||
YarnConfiguration.DEFAULT_FS_HISTORY_STORE_COMPRESSION_TYPE),
|
||||
null, getConfig());
|
||||
YarnConfiguration.FS_HISTORY_STORE_COMPRESSION_TYPE,
|
||||
YarnConfiguration.DEFAULT_FS_HISTORY_STORE_COMPRESSION_TYPE), null,
|
||||
getConfig());
|
||||
}
|
||||
|
||||
public synchronized void close() {
|
||||
|
|
|
@ -42,16 +42,16 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container
|
|||
import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerStartData;
|
||||
|
||||
/**
|
||||
* In-memory implementation of {@link ApplicationHistoryStore}.
|
||||
* This implementation is for test purpose only. If users improperly instantiate
|
||||
* it, they may encounter reading and writing history data in different memory
|
||||
* In-memory implementation of {@link ApplicationHistoryStore}. This
|
||||
* implementation is for test purpose only. If users improperly instantiate it,
|
||||
* they may encounter reading and writing history data in different memory
|
||||
* store.
|
||||
*
|
||||
*/
|
||||
@Private
|
||||
@Unstable
|
||||
public class MemoryApplicationHistoryStore extends AbstractService
|
||||
implements ApplicationHistoryStore {
|
||||
public class MemoryApplicationHistoryStore extends AbstractService implements
|
||||
ApplicationHistoryStore {
|
||||
|
||||
private final ConcurrentMap<ApplicationId, ApplicationHistoryData> applicationData =
|
||||
new ConcurrentHashMap<ApplicationId, ApplicationHistoryData>();
|
||||
|
@ -66,8 +66,7 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
|
||||
@Override
|
||||
public Map<ApplicationId, ApplicationHistoryData> getAllApplications() {
|
||||
return new HashMap<ApplicationId, ApplicationHistoryData>(
|
||||
applicationData);
|
||||
return new HashMap<ApplicationId, ApplicationHistoryData>(applicationData);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,14 +76,15 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
|
||||
@Override
|
||||
public Map<ApplicationAttemptId, ApplicationAttemptHistoryData>
|
||||
getApplicationAttempts(
|
||||
ApplicationId appId) {
|
||||
getApplicationAttempts(ApplicationId appId) {
|
||||
ConcurrentMap<ApplicationAttemptId, ApplicationAttemptHistoryData> subMap =
|
||||
applicationAttemptData.get(appId);
|
||||
if (subMap == null) {
|
||||
return Collections.<ApplicationAttemptId, ApplicationAttemptHistoryData>emptyMap();
|
||||
return Collections
|
||||
.<ApplicationAttemptId, ApplicationAttemptHistoryData> emptyMap();
|
||||
} else {
|
||||
return new HashMap<ApplicationAttemptId, ApplicationAttemptHistoryData>(subMap);
|
||||
return new HashMap<ApplicationAttemptId, ApplicationAttemptHistoryData>(
|
||||
subMap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,8 +101,7 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
}
|
||||
|
||||
@Override
|
||||
public ContainerHistoryData getAMContainer(
|
||||
ApplicationAttemptId appAttemptId) {
|
||||
public ContainerHistoryData getAMContainer(ApplicationAttemptId appAttemptId) {
|
||||
ApplicationAttemptHistoryData appAttempt =
|
||||
getApplicationAttempt(appAttemptId);
|
||||
if (appAttempt == null || appAttempt.getMasterContainerId() == null) {
|
||||
|
@ -129,7 +128,7 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
ConcurrentMap<ContainerId, ContainerHistoryData> subMap =
|
||||
containerData.get(appAttemptId);
|
||||
if (subMap == null) {
|
||||
return Collections.<ContainerId, ContainerHistoryData>emptyMap();
|
||||
return Collections.<ContainerId, ContainerHistoryData> emptyMap();
|
||||
} else {
|
||||
return new HashMap<ContainerId, ContainerHistoryData>(subMap);
|
||||
}
|
||||
|
@ -140,15 +139,10 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
throws IOException {
|
||||
ApplicationHistoryData oldData =
|
||||
applicationData.putIfAbsent(appStart.getApplicationId(),
|
||||
ApplicationHistoryData.newInstance(
|
||||
appStart.getApplicationId(),
|
||||
appStart.getApplicationName(),
|
||||
appStart.getApplicationType(),
|
||||
appStart.getQueue(),
|
||||
appStart.getUser(),
|
||||
appStart.getSubmitTime(),
|
||||
appStart.getStartTime(),
|
||||
Long.MAX_VALUE, null, null, null));
|
||||
ApplicationHistoryData.newInstance(appStart.getApplicationId(),
|
||||
appStart.getApplicationName(), appStart.getApplicationType(),
|
||||
appStart.getQueue(), appStart.getUser(), appStart.getSubmitTime(),
|
||||
appStart.getStartTime(), Long.MAX_VALUE, null, null, null));
|
||||
if (oldData != null) {
|
||||
throw new IOException("The start information of application "
|
||||
+ appStart.getApplicationId() + " is already stored.");
|
||||
|
@ -182,18 +176,15 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
ApplicationAttemptStartData appAttemptStart) throws IOException {
|
||||
ConcurrentMap<ApplicationAttemptId, ApplicationAttemptHistoryData> subMap =
|
||||
getSubMap(appAttemptStart.getApplicationAttemptId().getApplicationId());
|
||||
ApplicationAttemptHistoryData oldData = subMap.putIfAbsent(
|
||||
appAttemptStart.getApplicationAttemptId(),
|
||||
ApplicationAttemptHistoryData.newInstance(
|
||||
ApplicationAttemptHistoryData oldData =
|
||||
subMap.putIfAbsent(appAttemptStart.getApplicationAttemptId(),
|
||||
ApplicationAttemptHistoryData.newInstance(
|
||||
appAttemptStart.getApplicationAttemptId(),
|
||||
appAttemptStart.getHost(),
|
||||
appAttemptStart.getRPCPort(),
|
||||
appAttemptStart.getMasterContainerId(),
|
||||
null, null, null, null));
|
||||
appAttemptStart.getHost(), appAttemptStart.getRPCPort(),
|
||||
appAttemptStart.getMasterContainerId(), null, null, null, null));
|
||||
if (oldData != null) {
|
||||
throw new IOException("The start information of application attempt "
|
||||
+ appAttemptStart.getApplicationAttemptId()
|
||||
+ " is already stored.");
|
||||
+ appAttemptStart.getApplicationAttemptId() + " is already stored.");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -213,20 +204,22 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
// if the finish information is already recorded
|
||||
if (data.getYarnApplicationAttemptState() != null) {
|
||||
throw new IOException("The finish information of application attempt "
|
||||
+ appAttemptFinish.getApplicationAttemptId()
|
||||
+ " is already stored.");
|
||||
+ appAttemptFinish.getApplicationAttemptId() + " is already stored.");
|
||||
}
|
||||
data.setTrackingURL(appAttemptFinish.getTrackingURL());
|
||||
data.setDiagnosticsInfo(appAttemptFinish.getDiagnosticsInfo());
|
||||
data.setFinalApplicationStatus(appAttemptFinish.getFinalApplicationStatus());
|
||||
data.setYarnApplicationAttemptState(appAttemptFinish.getYarnApplicationAttemptState());
|
||||
data
|
||||
.setFinalApplicationStatus(appAttemptFinish.getFinalApplicationStatus());
|
||||
data.setYarnApplicationAttemptState(appAttemptFinish
|
||||
.getYarnApplicationAttemptState());
|
||||
}
|
||||
|
||||
private ConcurrentMap<ApplicationAttemptId, ApplicationAttemptHistoryData>
|
||||
getSubMap(ApplicationId appId) {
|
||||
applicationAttemptData.putIfAbsent(appId,
|
||||
new ConcurrentHashMap<ApplicationAttemptId,
|
||||
ApplicationAttemptHistoryData>());
|
||||
applicationAttemptData
|
||||
.putIfAbsent(
|
||||
appId,
|
||||
new ConcurrentHashMap<ApplicationAttemptId, ApplicationAttemptHistoryData>());
|
||||
return applicationAttemptData.get(appId);
|
||||
}
|
||||
|
||||
|
@ -235,15 +228,13 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
throws IOException {
|
||||
ConcurrentMap<ContainerId, ContainerHistoryData> subMap =
|
||||
getSubMap(containerStart.getContainerId().getApplicationAttemptId());
|
||||
ContainerHistoryData oldData = subMap.putIfAbsent(
|
||||
containerStart.getContainerId(),
|
||||
ContainerHistoryData.newInstance(
|
||||
containerStart.getContainerId(),
|
||||
ContainerHistoryData oldData =
|
||||
subMap.putIfAbsent(containerStart.getContainerId(),
|
||||
ContainerHistoryData.newInstance(containerStart.getContainerId(),
|
||||
containerStart.getAllocatedResource(),
|
||||
containerStart.getAssignedNode(),
|
||||
containerStart.getPriority(),
|
||||
containerStart.getStartTime(),
|
||||
Long.MAX_VALUE, null, null, Integer.MAX_VALUE, null));
|
||||
containerStart.getAssignedNode(), containerStart.getPriority(),
|
||||
containerStart.getStartTime(), Long.MAX_VALUE, null, null,
|
||||
Integer.MAX_VALUE, null));
|
||||
if (oldData != null) {
|
||||
throw new IOException("The start information of container "
|
||||
+ containerStart.getContainerId() + " is already stored.");
|
||||
|
@ -277,7 +268,7 @@ public class MemoryApplicationHistoryStore extends AbstractService
|
|||
private ConcurrentMap<ContainerId, ContainerHistoryData> getSubMap(
|
||||
ApplicationAttemptId appAttemptId) {
|
||||
containerData.putIfAbsent(appAttemptId,
|
||||
new ConcurrentHashMap<ContainerId, ContainerHistoryData>());
|
||||
new ConcurrentHashMap<ContainerId, ContainerHistoryData>());
|
||||
return containerData.get(appAttemptId);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,8 +54,7 @@ public class ApplicationAttemptHistoryData {
|
|||
public static ApplicationAttemptHistoryData newInstance(
|
||||
ApplicationAttemptId appAttemptId, String host, int rpcPort,
|
||||
ContainerId masterContainerId, String diagnosticsInfo,
|
||||
String trackingURL,
|
||||
FinalApplicationStatus finalApplicationStatus,
|
||||
String trackingURL, FinalApplicationStatus finalApplicationStatus,
|
||||
YarnApplicationAttemptState yarnApplicationAttemptState) {
|
||||
ApplicationAttemptHistoryData appAttemptHD =
|
||||
new ApplicationAttemptHistoryData();
|
||||
|
@ -78,8 +77,8 @@ public class ApplicationAttemptHistoryData {
|
|||
|
||||
@Public
|
||||
@Unstable
|
||||
public void setApplicationAttemptId(
|
||||
ApplicationAttemptId applicationAttemptId) {
|
||||
public void
|
||||
setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
this.applicationAttemptId = applicationAttemptId;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.apache.hadoop.yarn.api.records.YarnApplicationState;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* The class contains the fields that can be determined when
|
||||
* <code>RMApp</code> finishes, and that need to be stored persistently.
|
||||
* The class contains the fields that can be determined when <code>RMApp</code>
|
||||
* finishes, and that need to be stored persistently.
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
|
|
@ -205,8 +205,8 @@ public class ApplicationHistoryData {
|
|||
|
||||
@Public
|
||||
@Unstable
|
||||
public void setYarnApplicationState(
|
||||
YarnApplicationState yarnApplicationState) {
|
||||
public void
|
||||
setYarnApplicationState(YarnApplicationState yarnApplicationState) {
|
||||
this.yarnApplicationState = yarnApplicationState;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,8 +24,8 @@ import org.apache.hadoop.yarn.api.records.ApplicationId;
|
|||
import org.apache.hadoop.yarn.util.Records;
|
||||
|
||||
/**
|
||||
* The class contains the fields that can be determined when
|
||||
* <code>RMApp</code> starts, and that need to be stored persistently.
|
||||
* The class contains the fields that can be determined when <code>RMApp</code>
|
||||
* starts, and that need to be stored persistently.
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -33,12 +33,10 @@ public abstract class ApplicationStartData {
|
|||
|
||||
@Public
|
||||
@Unstable
|
||||
public static ApplicationStartData newInstance(
|
||||
ApplicationId applicationId, String applicationName,
|
||||
String applicationType, String queue, String user,
|
||||
long submitTime, long startTime) {
|
||||
ApplicationStartData appSD =
|
||||
Records.newRecord(ApplicationStartData.class);
|
||||
public static ApplicationStartData newInstance(ApplicationId applicationId,
|
||||
String applicationName, String applicationType, String queue,
|
||||
String user, long submitTime, long startTime) {
|
||||
ApplicationStartData appSD = Records.newRecord(ApplicationStartData.class);
|
||||
appSD.setApplicationId(applicationId);
|
||||
appSD.setApplicationName(applicationName);
|
||||
appSD.setApplicationType(applicationType);
|
||||
|
|
|
@ -32,11 +32,11 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Applicati
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ApplicationAttemptFinishDataPBImpl
|
||||
extends ApplicationAttemptFinishData {
|
||||
public class ApplicationAttemptFinishDataPBImpl extends
|
||||
ApplicationAttemptFinishData {
|
||||
|
||||
ApplicationAttemptFinishDataProto proto =
|
||||
ApplicationAttemptFinishDataProto.getDefaultInstance();
|
||||
ApplicationAttemptFinishDataProto proto = ApplicationAttemptFinishDataProto
|
||||
.getDefaultInstance();
|
||||
ApplicationAttemptFinishDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -131,8 +131,8 @@ public class ApplicationAttemptFinishDataPBImpl
|
|||
builder.clearFinalApplicationStatus();
|
||||
return;
|
||||
}
|
||||
builder.setFinalApplicationStatus(
|
||||
convertToProtoFormat(finalApplicationStatus));
|
||||
builder
|
||||
.setFinalApplicationStatus(convertToProtoFormat(finalApplicationStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -182,11 +182,11 @@ public class ApplicationAttemptFinishDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationAttemptId != null && !((ApplicationAttemptIdPBImpl)
|
||||
this.applicationAttemptId).getProto().equals(
|
||||
builder.getApplicationAttemptId())) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
if (this.applicationAttemptId != null
|
||||
&& !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
|
||||
.equals(builder.getApplicationAttemptId())) {
|
||||
builder
|
||||
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,12 +30,11 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Applicati
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ApplicationAttemptStartDataPBImpl extends
|
||||
ApplicationAttemptStartData {
|
||||
|
||||
public class ApplicationAttemptStartDataPBImpl
|
||||
extends ApplicationAttemptStartData {
|
||||
|
||||
ApplicationAttemptStartDataProto proto =
|
||||
ApplicationAttemptStartDataProto.getDefaultInstance();
|
||||
ApplicationAttemptStartDataProto proto = ApplicationAttemptStartDataProto
|
||||
.getDefaultInstance();
|
||||
ApplicationAttemptStartDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -116,8 +115,7 @@ public class ApplicationAttemptStartDataPBImpl
|
|||
if (!p.hasApplicationAttemptId()) {
|
||||
return null;
|
||||
}
|
||||
this.masterContainerId =
|
||||
convertFromProtoFormat(p.getMasterContainerId());
|
||||
this.masterContainerId = convertFromProtoFormat(p.getMasterContainerId());
|
||||
return this.masterContainerId;
|
||||
}
|
||||
|
||||
|
@ -158,17 +156,17 @@ public class ApplicationAttemptStartDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationAttemptId != null && !((ApplicationAttemptIdPBImpl)
|
||||
this.applicationAttemptId).getProto().equals(
|
||||
builder.getApplicationAttemptId())) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
if (this.applicationAttemptId != null
|
||||
&& !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
|
||||
.equals(builder.getApplicationAttemptId())) {
|
||||
builder
|
||||
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
if (this.masterContainerId != null && !((ContainerIdPBImpl)
|
||||
this.masterContainerId).getProto().equals(
|
||||
builder.getMasterContainerId())) {
|
||||
builder.setMasterContainerId(
|
||||
convertToProtoFormat(this.masterContainerId));
|
||||
if (this.masterContainerId != null
|
||||
&& !((ContainerIdPBImpl) this.masterContainerId).getProto().equals(
|
||||
builder.getMasterContainerId())) {
|
||||
builder
|
||||
.setMasterContainerId(convertToProtoFormat(this.masterContainerId));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,13 +196,12 @@ public class ApplicationAttemptStartDataPBImpl
|
|||
return ((ApplicationAttemptIdPBImpl) applicationAttemptId).getProto();
|
||||
}
|
||||
|
||||
private ContainerIdPBImpl convertFromProtoFormat(
|
||||
ContainerIdProto containerId) {
|
||||
private ContainerIdPBImpl
|
||||
convertFromProtoFormat(ContainerIdProto containerId) {
|
||||
return new ContainerIdPBImpl(containerId);
|
||||
}
|
||||
|
||||
private ContainerIdProto convertToProtoFormat(
|
||||
ContainerId masterContainerId) {
|
||||
private ContainerIdProto convertToProtoFormat(ContainerId masterContainerId) {
|
||||
return ((ContainerIdPBImpl) masterContainerId).getProto();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,12 +32,10 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Applicati
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ApplicationFinishDataPBImpl extends ApplicationFinishData {
|
||||
|
||||
public class ApplicationFinishDataPBImpl
|
||||
extends ApplicationFinishData {
|
||||
|
||||
ApplicationFinishDataProto proto =
|
||||
ApplicationFinishDataProto.getDefaultInstance();
|
||||
ApplicationFinishDataProto proto = ApplicationFinishDataProto
|
||||
.getDefaultInstance();
|
||||
ApplicationFinishDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -122,8 +120,8 @@ public class ApplicationFinishDataPBImpl
|
|||
builder.clearFinalApplicationStatus();
|
||||
return;
|
||||
}
|
||||
builder.setFinalApplicationStatus(
|
||||
convertToProtoFormat(finalApplicationStatus));
|
||||
builder
|
||||
.setFinalApplicationStatus(convertToProtoFormat(finalApplicationStatus));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -173,8 +171,9 @@ public class ApplicationFinishDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationId != null && !((ApplicationIdPBImpl)
|
||||
this.applicationId).getProto().equals(builder.getApplicationId())) {
|
||||
if (this.applicationId != null
|
||||
&& !((ApplicationIdPBImpl) this.applicationId).getProto().equals(
|
||||
builder.getApplicationId())) {
|
||||
builder.setApplicationId(convertToProtoFormat(this.applicationId));
|
||||
}
|
||||
}
|
||||
|
@ -195,8 +194,7 @@ public class ApplicationFinishDataPBImpl
|
|||
viaProto = false;
|
||||
}
|
||||
|
||||
private ApplicationIdProto convertToProtoFormat(
|
||||
ApplicationId applicationId) {
|
||||
private ApplicationIdProto convertToProtoFormat(ApplicationId applicationId) {
|
||||
return ((ApplicationIdPBImpl) applicationId).getProto();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,12 +27,10 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Applicati
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ApplicationStartDataPBImpl extends ApplicationStartData {
|
||||
|
||||
public class ApplicationStartDataPBImpl
|
||||
extends ApplicationStartData {
|
||||
|
||||
ApplicationStartDataProto proto =
|
||||
ApplicationStartDataProto.getDefaultInstance();
|
||||
ApplicationStartDataProto proto = ApplicationStartDataProto
|
||||
.getDefaultInstance();
|
||||
ApplicationStartDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -197,8 +195,9 @@ public class ApplicationStartDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationId != null && !((ApplicationIdPBImpl)
|
||||
this.applicationId).getProto().equals(builder.getApplicationId())) {
|
||||
if (this.applicationId != null
|
||||
&& !((ApplicationIdPBImpl) this.applicationId).getProto().equals(
|
||||
builder.getApplicationId())) {
|
||||
builder.setApplicationId(convertToProtoFormat(this.applicationId));
|
||||
}
|
||||
}
|
||||
|
@ -219,8 +218,7 @@ public class ApplicationStartDataPBImpl
|
|||
viaProto = false;
|
||||
}
|
||||
|
||||
private ApplicationIdProto convertToProtoFormat(
|
||||
ApplicationId applicationId) {
|
||||
private ApplicationIdProto convertToProtoFormat(ApplicationId applicationId) {
|
||||
return ((ApplicationIdPBImpl) applicationId).getProto();
|
||||
}
|
||||
|
||||
|
|
|
@ -30,12 +30,10 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ContainerFinishDataPBImpl extends ContainerFinishData {
|
||||
|
||||
public class ContainerFinishDataPBImpl
|
||||
extends ContainerFinishData {
|
||||
|
||||
ContainerFinishDataProto proto =
|
||||
ContainerFinishDataProto.getDefaultInstance();
|
||||
ContainerFinishDataProto proto = ContainerFinishDataProto
|
||||
.getDefaultInstance();
|
||||
ContainerFinishDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -181,8 +179,9 @@ public class ContainerFinishDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.containerId != null && !((ContainerIdPBImpl)
|
||||
this.containerId).getProto().equals(builder.getContainerId())) {
|
||||
if (this.containerId != null
|
||||
&& !((ContainerIdPBImpl) this.containerId).getProto().equals(
|
||||
builder.getContainerId())) {
|
||||
builder.setContainerId(convertToProtoFormat(this.containerId));
|
||||
}
|
||||
}
|
||||
|
@ -203,18 +202,16 @@ public class ContainerFinishDataPBImpl
|
|||
viaProto = false;
|
||||
}
|
||||
|
||||
private ContainerIdProto convertToProtoFormat(
|
||||
ContainerId containerId) {
|
||||
private ContainerIdProto convertToProtoFormat(ContainerId containerId) {
|
||||
return ((ContainerIdPBImpl) containerId).getProto();
|
||||
}
|
||||
|
||||
private ContainerIdPBImpl convertFromProtoFormat(
|
||||
ContainerIdProto containerId) {
|
||||
private ContainerIdPBImpl
|
||||
convertFromProtoFormat(ContainerIdProto containerId) {
|
||||
return new ContainerIdPBImpl(containerId);
|
||||
}
|
||||
|
||||
private ContainerStateProto convertToProtoFormat(
|
||||
ContainerState state) {
|
||||
private ContainerStateProto convertToProtoFormat(ContainerState state) {
|
||||
return ProtoUtils.convertToProtoFormat(state);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,12 +36,9 @@ import org.apache.hadoop.yarn.server.applicationhistoryservice.records.Container
|
|||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class ContainerStartDataPBImpl extends ContainerStartData {
|
||||
|
||||
public class ContainerStartDataPBImpl
|
||||
extends ContainerStartData {
|
||||
|
||||
ContainerStartDataProto proto =
|
||||
ContainerStartDataProto.getDefaultInstance();
|
||||
ContainerStartDataProto proto = ContainerStartDataProto.getDefaultInstance();
|
||||
ContainerStartDataProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
|
@ -187,20 +184,24 @@ public class ContainerStartDataPBImpl
|
|||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.containerId != null && !((ContainerIdPBImpl)
|
||||
this.containerId).getProto().equals(builder.getContainerId())) {
|
||||
if (this.containerId != null
|
||||
&& !((ContainerIdPBImpl) this.containerId).getProto().equals(
|
||||
builder.getContainerId())) {
|
||||
builder.setContainerId(convertToProtoFormat(this.containerId));
|
||||
}
|
||||
if (this.resource != null && !((ResourcePBImpl)
|
||||
this.resource).getProto().equals(builder.getAllocatedResource())) {
|
||||
if (this.resource != null
|
||||
&& !((ResourcePBImpl) this.resource).getProto().equals(
|
||||
builder.getAllocatedResource())) {
|
||||
builder.setAllocatedResource(convertToProtoFormat(this.resource));
|
||||
}
|
||||
if (this.nodeId != null && !((NodeIdPBImpl)
|
||||
this.nodeId).getProto().equals(builder.getAssignedNodeId())) {
|
||||
if (this.nodeId != null
|
||||
&& !((NodeIdPBImpl) this.nodeId).getProto().equals(
|
||||
builder.getAssignedNodeId())) {
|
||||
builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
|
||||
}
|
||||
if (this.priority != null && !((PriorityPBImpl)
|
||||
this.priority).getProto().equals(builder.getPriority())) {
|
||||
if (this.priority != null
|
||||
&& !((PriorityPBImpl) this.priority).getProto().equals(
|
||||
builder.getPriority())) {
|
||||
builder.setPriority(convertToProtoFormat(this.priority));
|
||||
}
|
||||
}
|
||||
|
@ -221,13 +222,12 @@ public class ContainerStartDataPBImpl
|
|||
viaProto = false;
|
||||
}
|
||||
|
||||
private ContainerIdProto convertToProtoFormat(
|
||||
ContainerId containerId) {
|
||||
private ContainerIdProto convertToProtoFormat(ContainerId containerId) {
|
||||
return ((ContainerIdPBImpl) containerId).getProto();
|
||||
}
|
||||
|
||||
private ContainerIdPBImpl convertFromProtoFormat(
|
||||
ContainerIdProto containerId) {
|
||||
private ContainerIdPBImpl
|
||||
convertFromProtoFormat(ContainerIdProto containerId) {
|
||||
return new ContainerIdPBImpl(containerId);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@ import org.apache.hadoop.yarn.webapp.Controller;
|
|||
|
||||
import com.google.inject.Inject;
|
||||
|
||||
|
||||
public class AHSController extends Controller {
|
||||
|
||||
@Inject
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
|
||||
|
||||
|
@ -34,8 +34,8 @@ import org.apache.hadoop.yarn.webapp.view.TwoColumnLayout;
|
|||
// Do NOT rename/refactor this to AHSView as it will wreak havoc
|
||||
// on Mac OS HFS
|
||||
public class AHSView extends TwoColumnLayout {
|
||||
static final int MAX_DISPLAY_ROWS = 100; // direct table rendering
|
||||
static final int MAX_FAST_ROWS = 1000; // inline js array
|
||||
static final int MAX_DISPLAY_ROWS = 100; // direct table rendering
|
||||
static final int MAX_FAST_ROWS = 1000; // inline js array
|
||||
|
||||
@Override
|
||||
protected void preHead(Page.HTML<_> html) {
|
||||
|
@ -67,13 +67,10 @@ public class AHSView extends TwoColumnLayout {
|
|||
|
||||
private String appsTableInit() {
|
||||
// id, user, name, queue, starttime, finishtime, state, status, progress, ui
|
||||
return tableInit()
|
||||
.append(", 'aaData': appsTableData")
|
||||
.append(", bDeferRender: true")
|
||||
.append(", bProcessing: true")
|
||||
return tableInit().append(", 'aaData': appsTableData")
|
||||
.append(", bDeferRender: true").append(", bProcessing: true")
|
||||
|
||||
.append("\n, aoColumnDefs: ")
|
||||
.append(getAppsTableColumnDefs())
|
||||
.append("\n, aoColumnDefs: ").append(getAppsTableColumnDefs())
|
||||
|
||||
// Sort by id upon page load
|
||||
.append(", aaSorting: [[0, 'desc']]}").toString();
|
||||
|
@ -81,9 +78,7 @@ public class AHSView extends TwoColumnLayout {
|
|||
|
||||
protected String getAppsTableColumnDefs() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb
|
||||
.append("[\n")
|
||||
.append("{'sType':'numeric', 'aTargets': [0]")
|
||||
return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]")
|
||||
.append(", 'mRender': parseHadoopID }")
|
||||
|
||||
.append("\n, {'sType':'numeric', 'aTargets': [5, 6]")
|
||||
|
|
|
@ -43,9 +43,10 @@ public class AHSWebApp extends WebApp implements YarnWebParams {
|
|||
route(pajoin("/apps", APP_STATE), AHSController.class);
|
||||
route(pajoin("/app", APPLICATION_ID), AHSController.class, "app");
|
||||
route(pajoin("/appattempt", APPLICATION_ATTEMPT_ID), AHSController.class,
|
||||
"appattempt");
|
||||
"appattempt");
|
||||
route(pajoin("/container", CONTAINER_ID), AHSController.class, "container");
|
||||
route(pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
|
||||
route(
|
||||
pajoin("/logs", NM_NODENAME, CONTAINER_ID, ENTITY_STRING, APP_OWNER,
|
||||
CONTAINER_LOG_TYPE), AHSController.class, "logs");
|
||||
}
|
||||
}
|
|
@ -56,21 +56,18 @@ public class AHSWebServices extends WebServices {
|
|||
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public AppsInfo get(
|
||||
@Context HttpServletRequest req,
|
||||
public AppsInfo get(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res) {
|
||||
return getApps(req, res, null, Collections.<String> emptySet(), null, null,
|
||||
null, null, null, null, null, null, Collections.<String> emptySet());
|
||||
null, null, null, null, null, null, Collections.<String> emptySet());
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/apps")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public AppsInfo getApps(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@QueryParam("state") String stateQuery,
|
||||
public AppsInfo getApps(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @QueryParam("state") String stateQuery,
|
||||
@QueryParam("states") Set<String> statesQuery,
|
||||
@QueryParam("finalStatus") String finalStatusQuery,
|
||||
@QueryParam("user") String userQuery,
|
||||
|
@ -84,18 +81,16 @@ public class AHSWebServices extends WebServices {
|
|||
init(res);
|
||||
validateStates(stateQuery, statesQuery);
|
||||
return super.getApps(req, res, stateQuery, statesQuery, finalStatusQuery,
|
||||
userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin,
|
||||
finishEnd, applicationTypes);
|
||||
userQuery, queueQuery, count, startedBegin, startedEnd, finishBegin,
|
||||
finishEnd, applicationTypes);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/apps/{appid}")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public AppInfo getApp(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@PathParam("appid") String appId) {
|
||||
public AppInfo getApp(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @PathParam("appid") String appId) {
|
||||
init(res);
|
||||
return super.getApp(req, res, appId);
|
||||
}
|
||||
|
@ -104,10 +99,8 @@ public class AHSWebServices extends WebServices {
|
|||
@Path("/apps/{appid}/appattempts")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public AppAttemptsInfo getAppAttempts(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@PathParam("appid") String appId) {
|
||||
public AppAttemptsInfo getAppAttempts(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @PathParam("appid") String appId) {
|
||||
init(res);
|
||||
return super.getAppAttempts(req, res, appId);
|
||||
}
|
||||
|
@ -116,10 +109,8 @@ public class AHSWebServices extends WebServices {
|
|||
@Path("/apps/{appid}/appattempts/{appattemptid}")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public AppAttemptInfo getAppAttempt(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@PathParam("appid") String appId,
|
||||
public AppAttemptInfo getAppAttempt(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @PathParam("appid") String appId,
|
||||
@PathParam("appattemptid") String appAttemptId) {
|
||||
init(res);
|
||||
return super.getAppAttempt(req, res, appId, appAttemptId);
|
||||
|
@ -129,10 +120,8 @@ public class AHSWebServices extends WebServices {
|
|||
@Path("/apps/{appid}/appattempts/{appattemptid}/containers")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public ContainersInfo getContainers(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@PathParam("appid") String appId,
|
||||
public ContainersInfo getContainers(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @PathParam("appid") String appId,
|
||||
@PathParam("appattemptid") String appAttemptId) {
|
||||
init(res);
|
||||
return super.getContainers(req, res, appId, appAttemptId);
|
||||
|
@ -142,18 +131,16 @@ public class AHSWebServices extends WebServices {
|
|||
@Path("/apps/{appid}/appattempts/{appattemptid}/containers/{containerid}")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Override
|
||||
public ContainerInfo getContainer(
|
||||
@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res,
|
||||
@PathParam("appid") String appId,
|
||||
public ContainerInfo getContainer(@Context HttpServletRequest req,
|
||||
@Context HttpServletResponse res, @PathParam("appid") String appId,
|
||||
@PathParam("appattemptid") String appAttemptId,
|
||||
@PathParam("containerid") String containerId) {
|
||||
init(res);
|
||||
return super.getContainer(req, res, appId, appAttemptId, containerId);
|
||||
}
|
||||
|
||||
private static void validateStates(
|
||||
String stateQuery, Set<String> statesQuery) {
|
||||
private static void
|
||||
validateStates(String stateQuery, Set<String> statesQuery) {
|
||||
// stateQuery is deprecated.
|
||||
if (stateQuery != null && !stateQuery.isEmpty()) {
|
||||
statesQuery.add(stateQuery);
|
||||
|
@ -166,9 +153,8 @@ public class AHSWebServices extends WebServices {
|
|||
case KILLED:
|
||||
continue;
|
||||
default:
|
||||
throw new BadRequestException(
|
||||
"Invalid application-state " + appState
|
||||
+ " specified. It should be a final state");
|
||||
throw new BadRequestException("Invalid application-state " + appState
|
||||
+ " specified. It should be a final state");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,9 +34,11 @@ public class AppAttemptPage extends AHSView {
|
|||
commonPreHead(html);
|
||||
|
||||
String appAttemptId = $(YarnWebParams.APPLICATION_ATTEMPT_ID);
|
||||
set(TITLE, appAttemptId.isEmpty() ?
|
||||
"Bad request: missing application attempt ID" : join(
|
||||
"Application Attempt ", $(YarnWebParams.APPLICATION_ATTEMPT_ID)));
|
||||
set(
|
||||
TITLE,
|
||||
appAttemptId.isEmpty() ? "Bad request: missing application attempt ID"
|
||||
: join("Application Attempt ",
|
||||
$(YarnWebParams.APPLICATION_ATTEMPT_ID)));
|
||||
|
||||
set(DATATABLES_ID, "containers");
|
||||
set(initID(DATATABLES, "containers"), containersTableInit());
|
||||
|
@ -49,13 +51,10 @@ public class AppAttemptPage extends AHSView {
|
|||
}
|
||||
|
||||
private String containersTableInit() {
|
||||
return tableInit()
|
||||
.append(", 'aaData': containersTableData")
|
||||
.append(", bDeferRender: true")
|
||||
.append(", bProcessing: true")
|
||||
return tableInit().append(", 'aaData': containersTableData")
|
||||
.append(", bDeferRender: true").append(", bProcessing: true")
|
||||
|
||||
.append("\n, aoColumnDefs: ")
|
||||
.append(getContainersTableColumnDefs())
|
||||
.append("\n, aoColumnDefs: ").append(getContainersTableColumnDefs())
|
||||
|
||||
// Sort by id upon page load
|
||||
.append(", aaSorting: [[0, 'desc']]}").toString();
|
||||
|
@ -63,9 +62,7 @@ public class AppAttemptPage extends AHSView {
|
|||
|
||||
protected String getContainersTableColumnDefs() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb
|
||||
.append("[\n")
|
||||
.append("{'sType':'numeric', 'aTargets': [0]")
|
||||
return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]")
|
||||
.append(", 'mRender': parseHadoopID }]").toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
/**
|
||||
* 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.
|
||||
*/
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.server.applicationhistoryservice.webapp;
|
||||
|
||||
|
@ -30,31 +30,31 @@ import org.apache.hadoop.yarn.webapp.YarnWebParams;
|
|||
|
||||
public class AppPage extends AHSView {
|
||||
|
||||
@Override protected void preHead(Page.HTML<_> html) {
|
||||
@Override
|
||||
protected void preHead(Page.HTML<_> html) {
|
||||
commonPreHead(html);
|
||||
|
||||
String appId = $(YarnWebParams.APPLICATION_ID);
|
||||
set(TITLE, appId.isEmpty() ?
|
||||
"Bad request: missing application ID" : join(
|
||||
set(
|
||||
TITLE,
|
||||
appId.isEmpty() ? "Bad request: missing application ID" : join(
|
||||
"Application ", $(YarnWebParams.APPLICATION_ID)));
|
||||
|
||||
|
||||
set(DATATABLES_ID, "attempts");
|
||||
set(initID(DATATABLES, "attempts"), attemptsTableInit());
|
||||
setTableStyles(html, "attempts", ".queue {width:6em}", ".ui {width:8em}");
|
||||
}
|
||||
|
||||
@Override protected Class<? extends SubView> content() {
|
||||
@Override
|
||||
protected Class<? extends SubView> content() {
|
||||
return AppBlock.class;
|
||||
}
|
||||
|
||||
private String attemptsTableInit() {
|
||||
return tableInit()
|
||||
.append(", 'aaData': attemptsTableData")
|
||||
.append(", bDeferRender: true")
|
||||
.append(", bProcessing: true")
|
||||
return tableInit().append(", 'aaData': attemptsTableData")
|
||||
.append(", bDeferRender: true").append(", bProcessing: true")
|
||||
|
||||
.append("\n, aoColumnDefs: ")
|
||||
.append(getAttemptsTableColumnDefs())
|
||||
.append("\n, aoColumnDefs: ").append(getAttemptsTableColumnDefs())
|
||||
|
||||
// Sort by id upon page load
|
||||
.append(", aaSorting: [[0, 'desc']]}").toString();
|
||||
|
@ -62,9 +62,7 @@ public class AppPage extends AHSView {
|
|||
|
||||
protected String getAttemptsTableColumnDefs() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
return sb
|
||||
.append("[\n")
|
||||
.append("{'sType':'numeric', 'aTargets': [0]")
|
||||
return sb.append("[\n").append("{'sType':'numeric', 'aTargets': [0]")
|
||||
.append(", 'mRender': parseHadoopID }")
|
||||
|
||||
.append("\n, {'sType':'numeric', 'aTargets': [1]")
|
||||
|
|
|
@ -30,12 +30,12 @@ public class ContainerPage extends AHSView {
|
|||
commonPreHead(html);
|
||||
|
||||
String containerId = $(YarnWebParams.CONTAINER_ID);
|
||||
set(TITLE, containerId.isEmpty() ?
|
||||
"Bad request: missing container ID" : join(
|
||||
"Container ", $(YarnWebParams.CONTAINER_ID)));
|
||||
set(TITLE, containerId.isEmpty() ? "Bad request: missing container ID"
|
||||
: join("Container ", $(YarnWebParams.CONTAINER_ID)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends SubView> content() {
|
||||
return ContainerBlock.class;
|
||||
}}
|
||||
}
|
||||
}
|
|
@ -52,8 +52,9 @@ public class JAXBContextResolver implements ContextResolver<JAXBContext> {
|
|||
|
||||
public JAXBContextResolver() throws Exception {
|
||||
this.types = new HashSet<Class>(Arrays.asList(cTypes));
|
||||
this.context = new JSONJAXBContext(JSONConfiguration.natural()
|
||||
.rootUnwrapping(false).build(), cTypes);
|
||||
this.context =
|
||||
new JSONJAXBContext(JSONConfiguration.natural().rootUnwrapping(false)
|
||||
.build(), cTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -43,50 +43,43 @@ public class ApplicationHistoryStoreTestUtils {
|
|||
|
||||
protected void writeApplicationStartData(ApplicationId appId)
|
||||
throws IOException {
|
||||
store.applicationStarted(
|
||||
ApplicationStartData.newInstance(appId, appId.toString(), "test type",
|
||||
"test queue",
|
||||
"test user", 0, 0));
|
||||
store.applicationStarted(ApplicationStartData.newInstance(appId,
|
||||
appId.toString(), "test type", "test queue", "test user", 0, 0));
|
||||
}
|
||||
|
||||
protected void writeApplicationFinishData(ApplicationId appId)
|
||||
throws IOException {
|
||||
store.applicationFinished(
|
||||
ApplicationFinishData.newInstance(
|
||||
appId, 0, appId.toString(), FinalApplicationStatus.UNDEFINED,
|
||||
YarnApplicationState.FINISHED));
|
||||
store.applicationFinished(ApplicationFinishData.newInstance(appId, 0,
|
||||
appId.toString(), FinalApplicationStatus.UNDEFINED,
|
||||
YarnApplicationState.FINISHED));
|
||||
}
|
||||
|
||||
protected void writeApplicationAttemptStartData(
|
||||
ApplicationAttemptId appAttemptId) throws IOException {
|
||||
store.applicationAttemptStarted(
|
||||
ApplicationAttemptStartData.newInstance(
|
||||
appAttemptId, appAttemptId.toString(), 0,
|
||||
ContainerId.newInstance(appAttemptId, 1)));
|
||||
store.applicationAttemptStarted(ApplicationAttemptStartData.newInstance(
|
||||
appAttemptId, appAttemptId.toString(), 0,
|
||||
ContainerId.newInstance(appAttemptId, 1)));
|
||||
}
|
||||
|
||||
protected void writeApplicationAttemptFinishData(
|
||||
ApplicationAttemptId appAttemptId) throws IOException {
|
||||
store.applicationAttemptFinished(
|
||||
ApplicationAttemptFinishData.newInstance(appAttemptId,
|
||||
appAttemptId.toString(), "test tracking url",
|
||||
FinalApplicationStatus.UNDEFINED,
|
||||
YarnApplicationAttemptState.FINISHED));
|
||||
store.applicationAttemptFinished(ApplicationAttemptFinishData.newInstance(
|
||||
appAttemptId, appAttemptId.toString(), "test tracking url",
|
||||
FinalApplicationStatus.UNDEFINED, YarnApplicationAttemptState.FINISHED));
|
||||
}
|
||||
|
||||
protected void writeContainerStartData(ContainerId containerId)
|
||||
throws IOException {
|
||||
store.containerStarted(
|
||||
ContainerStartData.newInstance(containerId, Resource.newInstance(0, 0),
|
||||
NodeId.newInstance("localhost", 0),
|
||||
Priority.newInstance(containerId.getId()), 0));
|
||||
store.containerStarted(ContainerStartData.newInstance(containerId,
|
||||
Resource.newInstance(0, 0), NodeId.newInstance("localhost", 0),
|
||||
Priority.newInstance(containerId.getId()), 0));
|
||||
}
|
||||
|
||||
protected void writeContainerFinishData(ContainerId containerId)
|
||||
throws IOException {
|
||||
store.containerFinished(
|
||||
ContainerFinishData.newInstance(containerId, 0, containerId.toString(),
|
||||
"http://localhost:0/log", 0, ContainerState.COMPLETE));
|
||||
store.containerFinished(ContainerFinishData.newInstance(containerId, 0,
|
||||
containerId.toString(), "http://localhost:0/log", 0,
|
||||
ContainerState.COMPLETE));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -58,11 +58,12 @@ public class TestApplicationHistoryClientService extends
|
|||
historyServer = new ApplicationHistoryServer();
|
||||
Configuration config = new YarnConfiguration();
|
||||
config.setClass(YarnConfiguration.AHS_STORE,
|
||||
MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
|
||||
MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
|
||||
historyServer.init(config);
|
||||
historyServer.start();
|
||||
store = ((ApplicationHistoryManagerImpl) historyServer
|
||||
.getApplicationHistory()).getHistoryStore();
|
||||
store =
|
||||
((ApplicationHistoryManagerImpl) historyServer.getApplicationHistory())
|
||||
.getHistoryStore();
|
||||
}
|
||||
|
||||
@After
|
||||
|
@ -76,14 +77,15 @@ public class TestApplicationHistoryClientService extends
|
|||
appId = ApplicationId.newInstance(0, 1);
|
||||
writeApplicationStartData(appId);
|
||||
writeApplicationFinishData(appId);
|
||||
GetApplicationReportRequest request = GetApplicationReportRequest
|
||||
.newInstance(appId);
|
||||
GetApplicationReportResponse response = historyServer.getClientService()
|
||||
.getClientHandler().getApplicationReport(request);
|
||||
GetApplicationReportRequest request =
|
||||
GetApplicationReportRequest.newInstance(appId);
|
||||
GetApplicationReportResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getApplicationReport(request);
|
||||
ApplicationReport appReport = response.getApplicationReport();
|
||||
Assert.assertNotNull(appReport);
|
||||
Assert.assertEquals("application_0_0001", appReport.getApplicationId()
|
||||
.toString());
|
||||
.toString());
|
||||
Assert.assertEquals("test type", appReport.getApplicationType().toString());
|
||||
Assert.assertEquals("test queue", appReport.getQueue().toString());
|
||||
}
|
||||
|
@ -98,8 +100,9 @@ public class TestApplicationHistoryClientService extends
|
|||
writeApplicationStartData(appId1);
|
||||
writeApplicationFinishData(appId1);
|
||||
GetApplicationsRequest request = GetApplicationsRequest.newInstance();
|
||||
GetApplicationsResponse response = historyServer.getClientService()
|
||||
.getClientHandler().getApplications(request);
|
||||
GetApplicationsResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getApplications(request);
|
||||
List<ApplicationReport> appReport = response.getApplicationList();
|
||||
Assert.assertNotNull(appReport);
|
||||
Assert.assertEquals(appId, appReport.get(0).getApplicationId());
|
||||
|
@ -109,58 +112,60 @@ public class TestApplicationHistoryClientService extends
|
|||
@Test
|
||||
public void testApplicationAttemptReport() throws IOException, YarnException {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||
1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
writeApplicationAttemptFinishData(appAttemptId);
|
||||
GetApplicationAttemptReportRequest request = GetApplicationAttemptReportRequest
|
||||
.newInstance(appAttemptId);
|
||||
GetApplicationAttemptReportResponse response = historyServer
|
||||
.getClientService().getClientHandler().getApplicationAttemptReport(
|
||||
request);
|
||||
ApplicationAttemptReport attemptReport = response
|
||||
.getApplicationAttemptReport();
|
||||
GetApplicationAttemptReportRequest request =
|
||||
GetApplicationAttemptReportRequest.newInstance(appAttemptId);
|
||||
GetApplicationAttemptReportResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getApplicationAttemptReport(request);
|
||||
ApplicationAttemptReport attemptReport =
|
||||
response.getApplicationAttemptReport();
|
||||
Assert.assertNotNull(attemptReport);
|
||||
Assert.assertEquals("appattempt_0_0001_000001", attemptReport
|
||||
.getApplicationAttemptId().toString());
|
||||
.getApplicationAttemptId().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplicationAttempts() throws IOException, YarnException {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||
1);
|
||||
ApplicationAttemptId appAttemptId1 = ApplicationAttemptId.newInstance(
|
||||
appId, 2);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
ApplicationAttemptId appAttemptId1 =
|
||||
ApplicationAttemptId.newInstance(appId, 2);
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
writeApplicationAttemptFinishData(appAttemptId);
|
||||
writeApplicationAttemptStartData(appAttemptId1);
|
||||
writeApplicationAttemptFinishData(appAttemptId1);
|
||||
GetApplicationAttemptsRequest request = GetApplicationAttemptsRequest
|
||||
.newInstance(appId);
|
||||
GetApplicationAttemptsResponse response = historyServer.getClientService()
|
||||
.getClientHandler().getApplicationAttempts(request);
|
||||
List<ApplicationAttemptReport> attemptReports = response
|
||||
.getApplicationAttemptList();
|
||||
GetApplicationAttemptsRequest request =
|
||||
GetApplicationAttemptsRequest.newInstance(appId);
|
||||
GetApplicationAttemptsResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getApplicationAttempts(request);
|
||||
List<ApplicationAttemptReport> attemptReports =
|
||||
response.getApplicationAttemptList();
|
||||
Assert.assertNotNull(attemptReports);
|
||||
Assert.assertEquals(appAttemptId, attemptReports.get(0)
|
||||
.getApplicationAttemptId());
|
||||
.getApplicationAttemptId());
|
||||
Assert.assertEquals(appAttemptId1, attemptReports.get(1)
|
||||
.getApplicationAttemptId());
|
||||
.getApplicationAttemptId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testContainerReport() throws IOException, YarnException {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||
1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
|
||||
writeContainerStartData(containerId);
|
||||
writeContainerFinishData(containerId);
|
||||
GetContainerReportRequest request = GetContainerReportRequest
|
||||
.newInstance(containerId);
|
||||
GetContainerReportResponse response = historyServer.getClientService()
|
||||
.getClientHandler().getContainerReport(request);
|
||||
GetContainerReportRequest request =
|
||||
GetContainerReportRequest.newInstance(containerId);
|
||||
GetContainerReportResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getContainerReport(request);
|
||||
ContainerReport container = response.getContainerReport();
|
||||
Assert.assertNotNull(container);
|
||||
Assert.assertEquals(containerId, container.getContainerId());
|
||||
|
@ -169,18 +174,19 @@ public class TestApplicationHistoryClientService extends
|
|||
@Test
|
||||
public void testContainers() throws IOException, YarnException {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||
1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
|
||||
ContainerId containerId1 = ContainerId.newInstance(appAttemptId, 2);
|
||||
writeContainerStartData(containerId);
|
||||
writeContainerFinishData(containerId);
|
||||
writeContainerStartData(containerId1);
|
||||
writeContainerFinishData(containerId1);
|
||||
GetContainersRequest request = GetContainersRequest
|
||||
.newInstance(appAttemptId);
|
||||
GetContainersResponse response = historyServer.getClientService()
|
||||
.getClientHandler().getContainers(request);
|
||||
GetContainersRequest request =
|
||||
GetContainersRequest.newInstance(appAttemptId);
|
||||
GetContainersResponse response =
|
||||
historyServer.getClientService().getClientHandler()
|
||||
.getContainers(request);
|
||||
List<ContainerReport> containers = response.getContainerList();
|
||||
Assert.assertNotNull(containers);
|
||||
Assert.assertEquals(containerId, containers.get(1).getContainerId());
|
||||
|
|
|
@ -39,7 +39,7 @@ public class TestApplicationHistoryManagerImpl extends
|
|||
public void setup() throws Exception {
|
||||
Configuration config = new Configuration();
|
||||
config.setClass(YarnConfiguration.AHS_STORE,
|
||||
MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
|
||||
MemoryApplicationHistoryStore.class, ApplicationHistoryStore.class);
|
||||
applicationHistoryManagerImpl = new ApplicationHistoryManagerImpl();
|
||||
applicationHistoryManagerImpl.init(config);
|
||||
applicationHistoryManagerImpl.start();
|
||||
|
@ -57,16 +57,16 @@ public class TestApplicationHistoryManagerImpl extends
|
|||
appId = ApplicationId.newInstance(0, 1);
|
||||
writeApplicationStartData(appId);
|
||||
writeApplicationFinishData(appId);
|
||||
ApplicationAttemptId appAttemptId = ApplicationAttemptId.newInstance(appId,
|
||||
1);
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
writeApplicationAttemptFinishData(appAttemptId);
|
||||
ApplicationReport appReport = applicationHistoryManagerImpl
|
||||
.getApplication(appId);
|
||||
ApplicationReport appReport =
|
||||
applicationHistoryManagerImpl.getApplication(appId);
|
||||
Assert.assertNotNull(appReport);
|
||||
Assert.assertEquals(appId, appReport.getApplicationId());
|
||||
Assert.assertEquals(appAttemptId, appReport
|
||||
.getCurrentApplicationAttemptId());
|
||||
Assert.assertEquals(appAttemptId,
|
||||
appReport.getCurrentApplicationAttemptId());
|
||||
Assert.assertEquals(appAttemptId.toString(), appReport.getHost());
|
||||
Assert.assertEquals("test type", appReport.getApplicationType().toString());
|
||||
Assert.assertEquals("test queue", appReport.getQueue().toString());
|
||||
|
|
|
@ -41,8 +41,8 @@ public class TestApplicationHistoryServer {
|
|||
historyServer.init(config);
|
||||
assertEquals(STATE.INITED, historyServer.getServiceState());
|
||||
assertEquals(2, historyServer.getServices().size());
|
||||
ApplicationHistoryClientService historyService = historyServer
|
||||
.getClientService();
|
||||
ApplicationHistoryClientService historyService =
|
||||
historyServer.getClientService();
|
||||
assertNotNull(historyServer.getClientService());
|
||||
assertEquals(STATE.INITED, historyService.getServiceState());
|
||||
|
||||
|
@ -59,8 +59,8 @@ public class TestApplicationHistoryServer {
|
|||
|
||||
ExitUtil.disableSystemExit();
|
||||
try {
|
||||
historyServer = ApplicationHistoryServer
|
||||
.launchAppHistoryServer(new String[0]);
|
||||
historyServer =
|
||||
ApplicationHistoryServer.launchAppHistoryServer(new String[0]);
|
||||
} catch (ExitUtil.ExitException e) {
|
||||
assertEquals(0, e.status);
|
||||
ExitUtil.resetFirstExitException();
|
||||
|
|
|
@ -108,8 +108,7 @@ public class TestFileSystemApplicationHistoryStore extends
|
|||
Assert.assertEquals(appId.toString(), appData.getDiagnosticsInfo());
|
||||
|
||||
// read application attempt history data
|
||||
Assert.assertEquals(
|
||||
num, store.getApplicationAttempts(appId).size());
|
||||
Assert.assertEquals(num, store.getApplicationAttempts(appId).size());
|
||||
for (int j = 1; j <= num; ++j) {
|
||||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, j);
|
||||
|
@ -118,25 +117,24 @@ public class TestFileSystemApplicationHistoryStore extends
|
|||
Assert.assertNotNull(attemptData);
|
||||
Assert.assertEquals(appAttemptId.toString(), attemptData.getHost());
|
||||
Assert.assertEquals(appAttemptId.toString(),
|
||||
attemptData.getDiagnosticsInfo());
|
||||
attemptData.getDiagnosticsInfo());
|
||||
|
||||
// read container history data
|
||||
Assert.assertEquals(
|
||||
num, store.getContainers(appAttemptId).size());
|
||||
Assert.assertEquals(num, store.getContainers(appAttemptId).size());
|
||||
for (int k = 1; k <= num; ++k) {
|
||||
ContainerId containerId = ContainerId.newInstance(appAttemptId, k);
|
||||
ContainerHistoryData containerData = store.getContainer(containerId);
|
||||
Assert.assertNotNull(containerData);
|
||||
Assert.assertEquals(Priority.newInstance(containerId.getId()),
|
||||
containerData.getPriority());
|
||||
containerData.getPriority());
|
||||
Assert.assertEquals(containerId.toString(),
|
||||
containerData.getDiagnosticsInfo());
|
||||
containerData.getDiagnosticsInfo());
|
||||
}
|
||||
ContainerHistoryData masterContainer =
|
||||
store.getAMContainer(appAttemptId);
|
||||
Assert.assertNotNull(masterContainer);
|
||||
Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
|
||||
masterContainer.getContainerId());
|
||||
masterContainer.getContainerId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class TestMemoryApplicationHistoryStore extends
|
|||
Assert.fail();
|
||||
} catch (IOException e) {
|
||||
Assert.assertTrue(e.getMessage().contains(
|
||||
"is stored before the start information"));
|
||||
"is stored before the start information"));
|
||||
}
|
||||
// Normal
|
||||
int numApps = 5;
|
||||
|
@ -93,22 +93,20 @@ public class TestMemoryApplicationHistoryStore extends
|
|||
Assert.fail();
|
||||
} catch (IOException e) {
|
||||
Assert.assertTrue(e.getMessage().contains(
|
||||
"is stored before the start information"));
|
||||
"is stored before the start information"));
|
||||
}
|
||||
// Normal
|
||||
int numAppAttempts = 5;
|
||||
writeApplicationStartData(appId);
|
||||
for (int i = 1; i <= numAppAttempts; ++i) {
|
||||
appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, i);
|
||||
appAttemptId = ApplicationAttemptId.newInstance(appId, i);
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
writeApplicationAttemptFinishData(appAttemptId);
|
||||
}
|
||||
Assert.assertEquals(
|
||||
numAppAttempts, store.getApplicationAttempts(appId).size());
|
||||
Assert.assertEquals(numAppAttempts, store.getApplicationAttempts(appId)
|
||||
.size());
|
||||
for (int i = 1; i <= numAppAttempts; ++i) {
|
||||
appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, i);
|
||||
appAttemptId = ApplicationAttemptId.newInstance(appId, i);
|
||||
ApplicationAttemptHistoryData data =
|
||||
store.getApplicationAttempt(appAttemptId);
|
||||
Assert.assertNotNull(data);
|
||||
|
@ -117,8 +115,7 @@ public class TestMemoryApplicationHistoryStore extends
|
|||
}
|
||||
writeApplicationFinishData(appId);
|
||||
// Write again
|
||||
appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
appAttemptId = ApplicationAttemptId.newInstance(appId, 1);
|
||||
try {
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
Assert.fail();
|
||||
|
@ -145,7 +142,7 @@ public class TestMemoryApplicationHistoryStore extends
|
|||
Assert.fail();
|
||||
} catch (IOException e) {
|
||||
Assert.assertTrue(e.getMessage().contains(
|
||||
"is stored before the start information"));
|
||||
"is stored before the start information"));
|
||||
}
|
||||
// Normal
|
||||
writeApplicationAttemptStartData(appAttemptId);
|
||||
|
@ -155,20 +152,20 @@ public class TestMemoryApplicationHistoryStore extends
|
|||
writeContainerStartData(containerId);
|
||||
writeContainerFinishData(containerId);
|
||||
}
|
||||
Assert.assertEquals(
|
||||
numContainers, store.getContainers(appAttemptId).size());
|
||||
Assert
|
||||
.assertEquals(numContainers, store.getContainers(appAttemptId).size());
|
||||
for (int i = 1; i <= numContainers; ++i) {
|
||||
containerId = ContainerId.newInstance(appAttemptId, i);
|
||||
ContainerHistoryData data = store.getContainer(containerId);
|
||||
Assert.assertNotNull(data);
|
||||
Assert.assertEquals(Priority.newInstance(containerId.getId()),
|
||||
data.getPriority());
|
||||
data.getPriority());
|
||||
Assert.assertEquals(containerId.toString(), data.getDiagnosticsInfo());
|
||||
}
|
||||
ContainerHistoryData masterContainer = store.getAMContainer(appAttemptId);
|
||||
Assert.assertNotNull(masterContainer);
|
||||
Assert.assertEquals(ContainerId.newInstance(appAttemptId, 1),
|
||||
masterContainer.getContainerId());
|
||||
masterContainer.getContainerId());
|
||||
writeApplicationAttemptFinishData(appAttemptId);
|
||||
// Write again
|
||||
containerId = ContainerId.newInstance(appAttemptId, 1);
|
||||
|
|
|
@ -47,7 +47,7 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
public void setApplicationHistoryStore(ApplicationHistoryStore store) {
|
||||
this.store = store;
|
||||
}
|
||||
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
store = new MemoryApplicationHistoryStore();
|
||||
|
@ -58,31 +58,30 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
ApplicationHistoryManager ahManager = mock(ApplicationHistoryManager.class);
|
||||
Injector injector =
|
||||
WebAppTests.createMockInjector(ApplicationHistoryManager.class,
|
||||
ahManager);
|
||||
AHSController controller =
|
||||
injector.getInstance(AHSController.class);
|
||||
ahManager);
|
||||
AHSController controller = injector.getInstance(AHSController.class);
|
||||
controller.index();
|
||||
Assert
|
||||
.assertEquals("Application History", controller.get(TITLE, "unknown"));
|
||||
.assertEquals("Application History", controller.get(TITLE, "unknown"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testView() throws Exception {
|
||||
Injector injector =
|
||||
WebAppTests.createMockInjector(ApplicationContext.class,
|
||||
mockApplicationHistoryManager(5, 1, 1));
|
||||
mockApplicationHistoryManager(5, 1, 1));
|
||||
AHSView ahsViewInstance = injector.getInstance(AHSView.class);
|
||||
|
||||
ahsViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
|
||||
ahsViewInstance.set(YarnWebParams.APP_STATE,
|
||||
YarnApplicationState.FAILED.toString());
|
||||
YarnApplicationState.FAILED.toString());
|
||||
ahsViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
|
||||
ahsViewInstance.set(YarnWebParams.APP_STATE, StringHelper.cjoin(
|
||||
YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
|
||||
YarnApplicationState.FAILED.toString(), YarnApplicationState.KILLED));
|
||||
ahsViewInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
@ -91,14 +90,14 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
public void testAppPage() throws Exception {
|
||||
Injector injector =
|
||||
WebAppTests.createMockInjector(ApplicationContext.class,
|
||||
mockApplicationHistoryManager(1, 5, 1));
|
||||
mockApplicationHistoryManager(1, 5, 1));
|
||||
AppPage appPageInstance = injector.getInstance(AppPage.class);
|
||||
|
||||
appPageInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
|
||||
appPageInstance.set(YarnWebParams.APPLICATION_ID,
|
||||
ApplicationId.newInstance(0, 1).toString());
|
||||
appPageInstance.set(YarnWebParams.APPLICATION_ID, ApplicationId
|
||||
.newInstance(0, 1).toString());
|
||||
appPageInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
@ -107,7 +106,7 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
public void testAppAttemptPage() throws Exception {
|
||||
Injector injector =
|
||||
WebAppTests.createMockInjector(ApplicationContext.class,
|
||||
mockApplicationHistoryManager(1, 1, 5));
|
||||
mockApplicationHistoryManager(1, 1, 5));
|
||||
AppAttemptPage appAttemptPageInstance =
|
||||
injector.getInstance(AppAttemptPage.class);
|
||||
|
||||
|
@ -115,8 +114,8 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
WebAppTests.flushOutput(injector);
|
||||
|
||||
appAttemptPageInstance.set(YarnWebParams.APPLICATION_ATTEMPT_ID,
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1)
|
||||
.toString());
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1)
|
||||
.toString());
|
||||
appAttemptPageInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
@ -125,7 +124,7 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
public void testContainerPage() throws Exception {
|
||||
Injector injector =
|
||||
WebAppTests.createMockInjector(ApplicationContext.class,
|
||||
mockApplicationHistoryManager(1, 1, 1));
|
||||
mockApplicationHistoryManager(1, 1, 1));
|
||||
ContainerPage containerPageInstance =
|
||||
injector.getInstance(ContainerPage.class);
|
||||
|
||||
|
@ -133,17 +132,17 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
WebAppTests.flushOutput(injector);
|
||||
|
||||
containerPageInstance.set(
|
||||
YarnWebParams.CONTAINER_ID,
|
||||
ContainerId
|
||||
.newInstance(
|
||||
ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1), 1).toString());
|
||||
YarnWebParams.CONTAINER_ID,
|
||||
ContainerId
|
||||
.newInstance(
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
|
||||
1).toString());
|
||||
containerPageInstance.render();
|
||||
WebAppTests.flushOutput(injector);
|
||||
}
|
||||
|
||||
ApplicationHistoryManager mockApplicationHistoryManager(
|
||||
int numApps, int numAppAttempts, int numContainers) throws Exception {
|
||||
ApplicationHistoryManager mockApplicationHistoryManager(int numApps,
|
||||
int numAppAttempts, int numContainers) throws Exception {
|
||||
ApplicationHistoryManager ahManager =
|
||||
new MockApplicationHistoryManagerImpl(store);
|
||||
for (int i = 1; i <= numApps; ++i) {
|
||||
|
@ -165,8 +164,7 @@ public class TestAHSWebApp extends ApplicationHistoryStoreTestUtils {
|
|||
return ahManager;
|
||||
}
|
||||
|
||||
class MockApplicationHistoryManagerImpl extends
|
||||
ApplicationHistoryManagerImpl {
|
||||
class MockApplicationHistoryManagerImpl extends ApplicationHistoryManagerImpl {
|
||||
|
||||
public MockApplicationHistoryManagerImpl(ApplicationHistoryStore store) {
|
||||
super();
|
||||
|
|
|
@ -69,7 +69,7 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
bind(JAXBContextResolver.class);
|
||||
bind(AHSWebServices.class);
|
||||
bind(GenericExceptionHandler.class);
|
||||
try{
|
||||
try {
|
||||
ahManager = mockApplicationHistoryManager();
|
||||
} catch (Exception e) {
|
||||
Assert.fail();
|
||||
|
@ -99,10 +99,10 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
|
||||
public TestAHSWebServices() {
|
||||
super(new WebAppDescriptor.Builder(
|
||||
"org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
|
||||
.contextListenerClass(GuiceServletConfig.class)
|
||||
.filterClass(com.google.inject.servlet.GuiceFilter.class)
|
||||
.contextPath("jersey-guice-filter").servletPath("/").build());
|
||||
"org.apache.hadoop.yarn.server.applicationhistoryservice.webapp")
|
||||
.contextListenerClass(GuiceServletConfig.class)
|
||||
.filterClass(com.google.inject.servlet.GuiceFilter.class)
|
||||
.contextPath("jersey-guice-filter").servletPath("/").build());
|
||||
}
|
||||
|
||||
@Before
|
||||
|
@ -116,15 +116,16 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
WebResource r = resource();
|
||||
String responseStr = "";
|
||||
try {
|
||||
responseStr = r.path("ws").path("v1").path("applicationhistory")
|
||||
.path("bogus").accept(MediaType.APPLICATION_JSON).get(String.class);
|
||||
responseStr =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("bogus")
|
||||
.accept(MediaType.APPLICATION_JSON).get(String.class);
|
||||
fail("should have thrown exception on invalid uri");
|
||||
} catch (UniformInterfaceException ue) {
|
||||
ClientResponse response = ue.getResponse();
|
||||
assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
|
||||
|
||||
WebServicesTestUtils.checkStringMatch(
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,7 +140,7 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
ClientResponse response = ue.getResponse();
|
||||
assertEquals(Status.NOT_FOUND, response.getClientResponseStatus());
|
||||
WebServicesTestUtils.checkStringMatch(
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -148,25 +149,26 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
WebResource r = resource();
|
||||
String responseStr = "";
|
||||
try {
|
||||
responseStr = r.path("ws").path("v1").path("applicationhistory")
|
||||
.accept(MediaType.TEXT_PLAIN).get(String.class);
|
||||
responseStr =
|
||||
r.path("ws").path("v1").path("applicationhistory")
|
||||
.accept(MediaType.TEXT_PLAIN).get(String.class);
|
||||
fail("should have thrown exception on invalid uri");
|
||||
} catch (UniformInterfaceException ue) {
|
||||
ClientResponse response = ue.getResponse();
|
||||
assertEquals(Status.INTERNAL_SERVER_ERROR,
|
||||
response.getClientResponseStatus());
|
||||
response.getClientResponseStatus());
|
||||
WebServicesTestUtils.checkStringMatch(
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
"error string exists and shouldn't", "", responseStr);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAppsQuery() throws Exception {
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps")
|
||||
.queryParam("state", YarnApplicationState.FINISHED.toString())
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.queryParam("state", YarnApplicationState.FINISHED.toString())
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
|
@ -180,9 +182,10 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
public void testSingleApp() throws Exception {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps").path(appId.toString())
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.path(appId.toString()).accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
|
@ -194,19 +197,18 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
assertEquals("test user", app.get("user"));
|
||||
assertEquals("test type", app.get("type"));
|
||||
assertEquals(FinalApplicationStatus.UNDEFINED.toString(),
|
||||
app.get("finalAppStatus"));
|
||||
assertEquals(YarnApplicationState.FINISHED.toString(),
|
||||
app.get("appState"));
|
||||
app.get("finalAppStatus"));
|
||||
assertEquals(YarnApplicationState.FINISHED.toString(), app.get("appState"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleAttempts() throws Exception {
|
||||
ApplicationId appId = ApplicationId.newInstance(0, 1);
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps").path(appId.toString())
|
||||
.path("appattempts").accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.path(appId.toString()).path("appattempts")
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
|
@ -222,23 +224,22 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps").path(appId.toString())
|
||||
.path("appattempts").path(appAttemptId.toString())
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.path(appId.toString()).path("appattempts")
|
||||
.path(appAttemptId.toString()).accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
JSONObject appAttempt = json.getJSONObject("appAttempt");
|
||||
assertEquals(appAttemptId.toString(),
|
||||
appAttempt.getString("appAttemptId"));
|
||||
assertEquals(appAttemptId.toString(), appAttempt.getString("appAttemptId"));
|
||||
assertEquals(appAttemptId.toString(), appAttempt.getString("host"));
|
||||
assertEquals(appAttemptId.toString(),
|
||||
appAttempt.getString("diagnosticsInfo"));
|
||||
appAttempt.getString("diagnosticsInfo"));
|
||||
assertEquals("test tracking url", appAttempt.getString("trackingUrl"));
|
||||
assertEquals(YarnApplicationAttemptState.FINISHED.toString(),
|
||||
appAttempt.get("appAttemptState"));
|
||||
appAttempt.get("appAttemptState"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -247,11 +248,11 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
ApplicationAttemptId appAttemptId =
|
||||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps").path(appId.toString())
|
||||
.path("appattempts").path(appAttemptId.toString())
|
||||
.path("containers").accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.path(appId.toString()).path("appattempts")
|
||||
.path(appAttemptId.toString()).path("containers")
|
||||
.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
|
@ -268,29 +269,27 @@ public class TestAHSWebServices extends JerseyTest {
|
|||
ApplicationAttemptId.newInstance(appId, 1);
|
||||
ContainerId containerId = ContainerId.newInstance(appAttemptId, 1);
|
||||
WebResource r = resource();
|
||||
ClientResponse response = r.path("ws").path("v1")
|
||||
.path("applicationhistory").path("apps").path(appId.toString())
|
||||
.path("appattempts").path(appAttemptId.toString())
|
||||
.path("containers").path(containerId.toString())
|
||||
.accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
ClientResponse response =
|
||||
r.path("ws").path("v1").path("applicationhistory").path("apps")
|
||||
.path(appId.toString()).path("appattempts")
|
||||
.path(appAttemptId.toString()).path("containers")
|
||||
.path(containerId.toString()).accept(MediaType.APPLICATION_JSON)
|
||||
.get(ClientResponse.class);
|
||||
assertEquals(MediaType.APPLICATION_JSON_TYPE, response.getType());
|
||||
JSONObject json = response.getEntity(JSONObject.class);
|
||||
assertEquals("incorrect number of elements", 1, json.length());
|
||||
JSONObject container = json.getJSONObject("container");
|
||||
assertEquals(containerId.toString(), container.getString("containerId"));
|
||||
assertEquals(containerId.toString(),
|
||||
container.getString("diagnosticsInfo"));
|
||||
assertEquals(containerId.toString(), container.getString("diagnosticsInfo"));
|
||||
assertEquals("0", container.getString("allocatedMB"));
|
||||
assertEquals("0", container.getString("allocatedVCores"));
|
||||
assertEquals(NodeId.newInstance("localhost", 0).toString(),
|
||||
container.getString("assignedNodeId"));
|
||||
container.getString("assignedNodeId"));
|
||||
assertEquals(Priority.newInstance(containerId.getId()).toString(),
|
||||
container.getString("priority"));
|
||||
container.getString("priority"));
|
||||
assertEquals("http://localhost:0/log", container.getString("logUrl"));
|
||||
assertEquals(ContainerState.COMPLETE.toString(),
|
||||
container.getString("containerState"));
|
||||
container.getString("containerState"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -36,10 +36,11 @@ public interface ApplicationContext {
|
|||
/**
|
||||
* This method returns Application {@link ApplicationReport} for the specified
|
||||
* {@link ApplicationId}.
|
||||
* @param appId
|
||||
*
|
||||
* @param appId
|
||||
*
|
||||
* @return {@link ApplicationReport} for the ApplicationId.
|
||||
* @throws IOException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
|
@ -59,7 +60,8 @@ public interface ApplicationContext {
|
|||
* Application can have multiple application attempts
|
||||
* {@link ApplicationAttemptReport}. This method returns the all
|
||||
* {@link ApplicationAttemptReport}s for the Application.
|
||||
* @param appId
|
||||
*
|
||||
* @param appId
|
||||
*
|
||||
* @return all {@link ApplicationAttemptReport}s for the Application.
|
||||
* @throws IOException
|
||||
|
@ -73,7 +75,8 @@ public interface ApplicationContext {
|
|||
* This method returns {@link ApplicationAttemptReport} for specified
|
||||
* {@link ApplicationId}.
|
||||
*
|
||||
* @param appAttemptId {@link ApplicationAttemptId}
|
||||
* @param appAttemptId
|
||||
* {@link ApplicationAttemptId}
|
||||
* @return {@link ApplicationAttemptReport} for ApplicationAttemptId
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -86,7 +89,8 @@ public interface ApplicationContext {
|
|||
* This method returns {@link ContainerReport} for specified
|
||||
* {@link ContainerId}.
|
||||
*
|
||||
* @param containerId {@link ContainerId}
|
||||
* @param containerId
|
||||
* {@link ContainerId}
|
||||
* @return {@link ContainerReport} for ContainerId
|
||||
* @throws IOException
|
||||
*/
|
||||
|
@ -98,7 +102,8 @@ public interface ApplicationContext {
|
|||
* This method returns {@link ContainerReport} for specified
|
||||
* {@link ApplicationAttemptId}.
|
||||
*
|
||||
* @param appAttemptId {@link ApplicationAttemptId}
|
||||
* @param appAttemptId
|
||||
* {@link ApplicationAttemptId}
|
||||
* @return {@link ContainerReport} for ApplicationAttemptId
|
||||
* @throws IOException
|
||||
*/
|
||||
|
|
|
@ -91,17 +91,19 @@ public class AppAttemptBlock extends HtmlBlock {
|
|||
&& appAttempt.getRpcPort() < 65536) {
|
||||
node = appAttempt.getHost() + ":" + appAttempt.getRpcPort();
|
||||
}
|
||||
info("Application Attempt Overview").
|
||||
_("State", appAttempt.getAppAttemptState()).
|
||||
_("Master Container",
|
||||
appAttempt.getAmContainerId() == null ? "#" : root_url("container",
|
||||
appAttempt.getAmContainerId()),
|
||||
String.valueOf(appAttempt.getAmContainerId())).
|
||||
_("Node:", node).
|
||||
_("Tracking URL:",
|
||||
appAttempt.getTrackingUrl() == null ? "#" : root_url(appAttempt
|
||||
.getTrackingUrl()), "History").
|
||||
_("Diagnostics Info:", appAttempt.getDiagnosticsInfo());
|
||||
info("Application Attempt Overview")
|
||||
._("State", appAttempt.getAppAttemptState())
|
||||
._(
|
||||
"Master Container",
|
||||
appAttempt.getAmContainerId() == null ? "#" : root_url("container",
|
||||
appAttempt.getAmContainerId()),
|
||||
String.valueOf(appAttempt.getAmContainerId()))
|
||||
._("Node:", node)
|
||||
._(
|
||||
"Tracking URL:",
|
||||
appAttempt.getTrackingUrl() == null ? "#" : root_url(appAttempt
|
||||
.getTrackingUrl()), "History")
|
||||
._("Diagnostics Info:", appAttempt.getDiagnosticsInfo());
|
||||
|
||||
html._(InfoBlock.class);
|
||||
|
||||
|
@ -109,54 +111,49 @@ public class AppAttemptBlock extends HtmlBlock {
|
|||
try {
|
||||
containers = appContext.getContainers(appAttemptId).values();
|
||||
} catch (IOException e) {
|
||||
html.p()._("Sorry, Failed to get containers for application attempt"
|
||||
+ attemptid + ".")._();
|
||||
html
|
||||
.p()
|
||||
._(
|
||||
"Sorry, Failed to get containers for application attempt" + attemptid
|
||||
+ ".")._();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Container Table
|
||||
TBODY<TABLE<Hamlet>> tbody = html.
|
||||
table("#containers").
|
||||
thead().
|
||||
tr().
|
||||
th(".id", "Container ID").
|
||||
th(".node", "Node").
|
||||
th(".exitstatus", "Container Exit Status").
|
||||
th(".logs", "Logs")._()._().
|
||||
tbody();
|
||||
TBODY<TABLE<Hamlet>> tbody =
|
||||
html.table("#containers").thead().tr().th(".id", "Container ID")
|
||||
.th(".node", "Node").th(".exitstatus", "Container Exit Status")
|
||||
.th(".logs", "Logs")._()._().tbody();
|
||||
|
||||
StringBuilder containersTableData = new StringBuilder("[\n");
|
||||
for (ContainerReport containerReport : containers) {
|
||||
String logURL = containerReport.getLogUrl();
|
||||
logURL = getPartUrl(logURL, "log");
|
||||
ContainerInfo container = new ContainerInfo(containerReport);
|
||||
// ConatinerID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
|
||||
// ConatinerID numerical value parsed by parseHadoopID in
|
||||
// yarn.dt.plugins.js
|
||||
containersTableData
|
||||
.append("[\"<a href='")
|
||||
.append(url("container", container.getContainerId()))
|
||||
.append("'>")
|
||||
.append(container.getContainerId())
|
||||
.append("</a>\",\"<a href='")
|
||||
.append(container.getAssignedNodeId())
|
||||
.append("'>")
|
||||
.append(StringEscapeUtils.escapeJavaScript(
|
||||
StringEscapeUtils.escapeHtml(container.getAssignedNodeId())))
|
||||
.append("</a>\",\"")
|
||||
.append(container.getContainerExitStatus())
|
||||
.append("\",\"<a href='")
|
||||
.append(logURL == null ? "#" : url(logURL))
|
||||
.append("'>")
|
||||
.append(logURL == null ? "N/A" : "Logs")
|
||||
.append("</a>\"],\n");
|
||||
.append("[\"<a href='")
|
||||
.append(url("container", container.getContainerId()))
|
||||
.append("'>")
|
||||
.append(container.getContainerId())
|
||||
.append("</a>\",\"<a href='")
|
||||
.append(container.getAssignedNodeId())
|
||||
.append("'>")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils
|
||||
.escapeHtml(container.getAssignedNodeId()))).append("</a>\",\"")
|
||||
.append(container.getContainerExitStatus()).append("\",\"<a href='")
|
||||
.append(logURL == null ? "#" : url(logURL)).append("'>")
|
||||
.append(logURL == null ? "N/A" : "Logs").append("</a>\"],\n");
|
||||
}
|
||||
if (containersTableData.charAt(containersTableData.length() - 2) == ',') {
|
||||
containersTableData.delete(containersTableData.length() - 2,
|
||||
containersTableData.length() - 1);
|
||||
containersTableData.length() - 1);
|
||||
}
|
||||
containersTableData.append("]");
|
||||
html.script().$type("text/javascript").
|
||||
_("var containersTableData=" + containersTableData)._();
|
||||
|
||||
html.script().$type("text/javascript")
|
||||
._("var containersTableData=" + containersTableData)._();
|
||||
|
||||
tbody._()._();
|
||||
}
|
||||
|
|
|
@ -76,8 +76,7 @@ public class AppBlock extends HtmlBlock {
|
|||
try {
|
||||
appReport = appContext.getApplication(appID);
|
||||
} catch (IOException e) {
|
||||
String message =
|
||||
"Failed to read the application " + appID + ".";
|
||||
String message = "Failed to read the application " + appID + ".";
|
||||
LOG.error(message, e);
|
||||
html.p()._(message)._();
|
||||
return;
|
||||
|
@ -90,19 +89,20 @@ public class AppBlock extends HtmlBlock {
|
|||
|
||||
setTitle(join("Application ", aid));
|
||||
|
||||
info("Application Overview").
|
||||
_("User:", app.getUser()).
|
||||
_("Name:", app.getName()).
|
||||
_("Application Type:", app.getType()).
|
||||
_("State:", app.getAppState()).
|
||||
_("FinalStatus:", app.getFinalAppStatus()).
|
||||
_("Started:", Times.format(app.getStartedTime())).
|
||||
_("Elapsed:", StringUtils.formatTime(
|
||||
Times.elapsed(app.getStartedTime(), app.getFinishedTime()))).
|
||||
_("Tracking URL:",
|
||||
app.getTrackingUrl() == null ? "#" : root_url(app.getTrackingUrl()),
|
||||
"History").
|
||||
_("Diagnostics:", app.getDiagnosticsInfo());
|
||||
info("Application Overview")
|
||||
._("User:", app.getUser())
|
||||
._("Name:", app.getName())
|
||||
._("Application Type:", app.getType())
|
||||
._("State:", app.getAppState())
|
||||
._("FinalStatus:", app.getFinalAppStatus())
|
||||
._("Started:", Times.format(app.getStartedTime()))
|
||||
._(
|
||||
"Elapsed:",
|
||||
StringUtils.formatTime(Times.elapsed(app.getStartedTime(),
|
||||
app.getFinishedTime())))
|
||||
._("Tracking URL:",
|
||||
app.getTrackingUrl() == null ? "#" : root_url(app.getTrackingUrl()),
|
||||
"History")._("Diagnostics:", app.getDiagnosticsInfo());
|
||||
|
||||
html._(InfoBlock.class);
|
||||
|
||||
|
@ -118,23 +118,19 @@ public class AppBlock extends HtmlBlock {
|
|||
}
|
||||
|
||||
// Application Attempt Table
|
||||
TBODY<TABLE<Hamlet>> tbody = html.
|
||||
table("#attempts").
|
||||
thead().
|
||||
tr().
|
||||
th(".id", "Attempt ID").
|
||||
th(".started", "Started").
|
||||
th(".node", "Node").
|
||||
th(".logs", "Logs")._()._().
|
||||
tbody();
|
||||
TBODY<TABLE<Hamlet>> tbody =
|
||||
html.table("#attempts").thead().tr().th(".id", "Attempt ID")
|
||||
.th(".started", "Started").th(".node", "Node").th(".logs", "Logs")
|
||||
._()._().tbody();
|
||||
|
||||
StringBuilder attemptsTableData = new StringBuilder("[\n");
|
||||
for (ApplicationAttemptReport appAttemptReport : attempts) {
|
||||
AppAttemptInfo appAttempt = new AppAttemptInfo(appAttemptReport);
|
||||
ContainerReport containerReport;
|
||||
try {
|
||||
containerReport = appContext.getAMContainer(appAttemptReport
|
||||
.getApplicationAttemptId());
|
||||
containerReport =
|
||||
appContext.getAMContainer(appAttemptReport
|
||||
.getApplicationAttemptId());
|
||||
} catch (IOException e) {
|
||||
String message =
|
||||
"Failed to read the AM container of the application attempt "
|
||||
|
@ -149,41 +145,40 @@ public class AppBlock extends HtmlBlock {
|
|||
ContainerInfo container = new ContainerInfo(containerReport);
|
||||
startTime = container.getStartedTime();
|
||||
logsLink = containerReport.getLogUrl();
|
||||
logsLink = getPartUrl(logsLink,"log");
|
||||
logsLink = getPartUrl(logsLink, "log");
|
||||
}
|
||||
String nodeLink = null;
|
||||
if (appAttempt.getHost() != null && appAttempt.getRpcPort() >= 0
|
||||
&& appAttempt.getRpcPort() < 65536) {
|
||||
nodeLink = appAttempt.getHost() + ":" + appAttempt.getRpcPort();
|
||||
}
|
||||
// AppAttemptID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
|
||||
// AppAttemptID numerical value parsed by parseHadoopID in
|
||||
// yarn.dt.plugins.js
|
||||
attemptsTableData
|
||||
.append("[\"<a href='")
|
||||
.append(url("appattempt", appAttempt.getAppAttemptId()))
|
||||
.append("'>")
|
||||
.append(appAttempt.getAppAttemptId())
|
||||
.append("</a>\",\"")
|
||||
.append(startTime)
|
||||
.append("\",\"<a href='")
|
||||
.append(nodeLink == null ? "#" : url(HttpConfig.getSchemePrefix(),
|
||||
nodeLink))
|
||||
.append("'>")
|
||||
.append(nodeLink == null ? "N/A" : StringEscapeUtils.escapeJavaScript(
|
||||
StringEscapeUtils.escapeHtml(nodeLink)))
|
||||
.append("</a>\",\"<a href='")
|
||||
.append(logsLink == null ? "#" : url(logsLink))
|
||||
.append("'>")
|
||||
.append(nodeLink == null ? "N/A" : "Logs")
|
||||
.append("</a>\"],\n");
|
||||
.append("[\"<a href='")
|
||||
.append(url("appattempt", appAttempt.getAppAttemptId()))
|
||||
.append("'>")
|
||||
.append(appAttempt.getAppAttemptId())
|
||||
.append("</a>\",\"")
|
||||
.append(startTime)
|
||||
.append("\",\"<a href='")
|
||||
.append(
|
||||
nodeLink == null ? "#" : url(HttpConfig.getSchemePrefix(), nodeLink))
|
||||
.append("'>")
|
||||
.append(
|
||||
nodeLink == null ? "N/A" : StringEscapeUtils
|
||||
.escapeJavaScript(StringEscapeUtils.escapeHtml(nodeLink)))
|
||||
.append("</a>\",\"<a href='")
|
||||
.append(logsLink == null ? "#" : url(logsLink)).append("'>")
|
||||
.append(nodeLink == null ? "N/A" : "Logs").append("</a>\"],\n");
|
||||
}
|
||||
if (attemptsTableData.charAt(attemptsTableData.length() - 2) == ',') {
|
||||
attemptsTableData.delete(attemptsTableData.length() - 2,
|
||||
attemptsTableData.length() - 1);
|
||||
attemptsTableData.length() - 1);
|
||||
}
|
||||
attemptsTableData.append("]");
|
||||
html.script().$type("text/javascript").
|
||||
_("var attemptsTableData=" + attemptsTableData)._();
|
||||
|
||||
html.script().$type("text/javascript")
|
||||
._("var attemptsTableData=" + attemptsTableData)._();
|
||||
|
||||
tbody._()._();
|
||||
}
|
||||
|
|
|
@ -53,22 +53,13 @@ public class AppsBlock extends HtmlBlock {
|
|||
public void render(Block html) {
|
||||
setTitle("Applications");
|
||||
|
||||
TBODY<TABLE<Hamlet>> tbody = html.
|
||||
table("#apps").
|
||||
thead().
|
||||
tr().
|
||||
th(".id", "ID").
|
||||
th(".user", "User").
|
||||
th(".name", "Name").
|
||||
th(".type", "Application Type").
|
||||
th(".queue", "Queue").
|
||||
th(".starttime", "StartTime").
|
||||
th(".finishtime", "FinishTime").
|
||||
th(".state", "State").
|
||||
th(".finalstatus", "FinalStatus").
|
||||
th(".progress", "Progress").
|
||||
th(".ui", "Tracking UI")._()._().
|
||||
tbody();
|
||||
TBODY<TABLE<Hamlet>> tbody =
|
||||
html.table("#apps").thead().tr().th(".id", "ID").th(".user", "User")
|
||||
.th(".name", "Name").th(".type", "Application Type")
|
||||
.th(".queue", "Queue").th(".starttime", "StartTime")
|
||||
.th(".finishtime", "FinishTime").th(".state", "State")
|
||||
.th(".finalstatus", "FinalStatus").th(".progress", "Progress")
|
||||
.th(".ui", "Tracking UI")._()._().tbody();
|
||||
Collection<YarnApplicationState> reqAppStates = null;
|
||||
String reqStateString = $(APP_STATE);
|
||||
if (reqStateString != null && !reqStateString.isEmpty()) {
|
||||
|
@ -83,8 +74,7 @@ public class AppsBlock extends HtmlBlock {
|
|||
try {
|
||||
appReports = appContext.getAllApplications().values();
|
||||
} catch (IOException e) {
|
||||
String message =
|
||||
"Failed to read the applications.";
|
||||
String message = "Failed to read the applications.";
|
||||
LOG.error(message, e);
|
||||
html.p()._(message)._();
|
||||
return;
|
||||
|
@ -99,51 +89,53 @@ public class AppsBlock extends HtmlBlock {
|
|||
String percent = String.format("%.1f", app.getProgress());
|
||||
// AppID numerical value parsed by parseHadoopID in yarn.dt.plugins.js
|
||||
appsTableData
|
||||
.append("[\"<a href='")
|
||||
.append(url("app", app.getAppId()))
|
||||
.append("'>")
|
||||
.append(app.getAppId())
|
||||
.append("</a>\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
||||
app.getUser())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
||||
app.getName())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
||||
app.getType())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(
|
||||
app.getQueue()))).append("\",\"")
|
||||
.append(app.getStartedTime()).append("\",\"")
|
||||
.append(app.getFinishedTime()).append("\",\"")
|
||||
.append(app.getAppState()).append("\",\"")
|
||||
.append(app.getFinalAppStatus()).append("\",\"")
|
||||
// Progress bar
|
||||
.append("<br title='").append(percent)
|
||||
.append("'> <div class='").append(C_PROGRESSBAR).append("' title='")
|
||||
.append(join(percent, '%')).append("'> ").append("<div class='")
|
||||
.append(C_PROGRESSBAR_VALUE).append("' style='")
|
||||
.append(join("width:", percent, '%')).append("'> </div> </div>")
|
||||
.append("\",\"<a href='");
|
||||
.append("[\"<a href='")
|
||||
.append(url("app", app.getAppId()))
|
||||
.append("'>")
|
||||
.append(app.getAppId())
|
||||
.append("</a>\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
|
||||
.getUser())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
|
||||
.getName())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
|
||||
.getType())))
|
||||
.append("\",\"")
|
||||
.append(
|
||||
StringEscapeUtils.escapeJavaScript(StringEscapeUtils.escapeHtml(app
|
||||
.getQueue()))).append("\",\"").append(app.getStartedTime())
|
||||
.append("\",\"").append(app.getFinishedTime())
|
||||
.append("\",\"")
|
||||
.append(app.getAppState())
|
||||
.append("\",\"")
|
||||
.append(app.getFinalAppStatus())
|
||||
.append("\",\"")
|
||||
// Progress bar
|
||||
.append("<br title='").append(percent).append("'> <div class='")
|
||||
.append(C_PROGRESSBAR).append("' title='").append(join(percent, '%'))
|
||||
.append("'> ").append("<div class='").append(C_PROGRESSBAR_VALUE)
|
||||
.append("' style='").append(join("width:", percent, '%'))
|
||||
.append("'> </div> </div>").append("\",\"<a href='");
|
||||
|
||||
String trackingURL = app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
|
||||
String trackingURL =
|
||||
app.getTrackingUrl() == null ? "#" : app.getTrackingUrl();
|
||||
|
||||
appsTableData.append(trackingURL).append("'>")
|
||||
.append("History").append("</a>\"],\n");
|
||||
appsTableData.append(trackingURL).append("'>").append("History")
|
||||
.append("</a>\"],\n");
|
||||
|
||||
}
|
||||
if (appsTableData.charAt(appsTableData.length() - 2) == ',') {
|
||||
appsTableData.delete(appsTableData.length() - 2,
|
||||
appsTableData.length() - 1);
|
||||
appsTableData.length() - 1);
|
||||
}
|
||||
appsTableData.append("]");
|
||||
html.script().$type("text/javascript").
|
||||
_("var appsTableData=" + appsTableData)._();
|
||||
html.script().$type("text/javascript")
|
||||
._("var appsTableData=" + appsTableData)._();
|
||||
|
||||
tbody._()._();
|
||||
}
|
||||
|
|
|
@ -77,25 +77,28 @@ public class ContainerBlock extends HtmlBlock {
|
|||
puts("Container not found: " + containerid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
ContainerInfo container = new ContainerInfo(containerReport);
|
||||
String logURL = containerReport.getLogUrl();
|
||||
logURL = getPartUrl(logURL,"log");
|
||||
logURL = getPartUrl(logURL, "log");
|
||||
setTitle(join("Container ", containerid));
|
||||
|
||||
info("Container Overview").
|
||||
_("State:", container.getContainerState()).
|
||||
_("Exit Status:", container.getContainerExitStatus()).
|
||||
_("Node:", container.getAssignedNodeId()).
|
||||
_("Priority:", container.getPriority()).
|
||||
_("Started:", Times.format(container.getStartedTime())).
|
||||
_("Elapsed:", StringUtils.formatTime(
|
||||
Times.elapsed(container.getStartedTime(),
|
||||
container.getFinishedTime()))).
|
||||
_("Resource:", container.getAllocatedMB() + " Memory, " +
|
||||
container.getAllocatedVCores() + " VCores").
|
||||
_("Logs:", logURL == null ? "#" : url(logURL), "Logs").
|
||||
_("Diagnostics:", container.getDiagnosticsInfo());
|
||||
info("Container Overview")
|
||||
._("State:", container.getContainerState())
|
||||
._("Exit Status:", container.getContainerExitStatus())
|
||||
._("Node:", container.getAssignedNodeId())
|
||||
._("Priority:", container.getPriority())
|
||||
._("Started:", Times.format(container.getStartedTime()))
|
||||
._(
|
||||
"Elapsed:",
|
||||
StringUtils.formatTime(Times.elapsed(container.getStartedTime(),
|
||||
container.getFinishedTime())))
|
||||
._(
|
||||
"Resource:",
|
||||
container.getAllocatedMB() + " Memory, "
|
||||
+ container.getAllocatedVCores() + " VCores")
|
||||
._("Logs:", logURL == null ? "#" : url(logURL), "Logs")
|
||||
._("Diagnostics:", container.getDiagnosticsInfo());
|
||||
|
||||
html._(InfoBlock.class);
|
||||
}
|
||||
|
|
|
@ -55,19 +55,10 @@ public class WebServices {
|
|||
this.appContext = appContext;
|
||||
}
|
||||
|
||||
public AppsInfo getApps(
|
||||
HttpServletRequest req,
|
||||
HttpServletResponse res,
|
||||
String stateQuery,
|
||||
Set<String> statesQuery,
|
||||
String finalStatusQuery,
|
||||
String userQuery,
|
||||
String queueQuery,
|
||||
String count,
|
||||
String startedBegin,
|
||||
String startedEnd,
|
||||
String finishBegin,
|
||||
String finishEnd,
|
||||
public AppsInfo getApps(HttpServletRequest req, HttpServletResponse res,
|
||||
String stateQuery, Set<String> statesQuery, String finalStatusQuery,
|
||||
String userQuery, String queueQuery, String count, String startedBegin,
|
||||
String startedEnd, String finishBegin, String finishEnd,
|
||||
Set<String> applicationTypes) {
|
||||
long num = 0;
|
||||
boolean checkCount = false;
|
||||
|
@ -107,7 +98,7 @@ public class WebServices {
|
|||
}
|
||||
if (sBegin > sEnd) {
|
||||
throw new BadRequestException(
|
||||
"startedTimeEnd must be greater than startTimeBegin");
|
||||
"startedTimeEnd must be greater than startTimeBegin");
|
||||
}
|
||||
|
||||
if (finishBegin != null && !finishBegin.isEmpty()) {
|
||||
|
@ -126,7 +117,7 @@ public class WebServices {
|
|||
}
|
||||
if (fBegin > fEnd) {
|
||||
throw new BadRequestException(
|
||||
"finishTimeEnd must be greater than finishTimeBegin");
|
||||
"finishTimeEnd must be greater than finishTimeBegin");
|
||||
}
|
||||
|
||||
Set<String> appTypes = parseQueries(applicationTypes, false);
|
||||
|
@ -156,14 +147,15 @@ public class WebServices {
|
|||
break;
|
||||
}
|
||||
|
||||
if (checkAppStates && !appStates.contains(
|
||||
appReport.getYarnApplicationState().toString().toLowerCase())) {
|
||||
if (checkAppStates
|
||||
&& !appStates.contains(appReport.getYarnApplicationState().toString()
|
||||
.toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
if (finalStatusQuery != null && !finalStatusQuery.isEmpty()) {
|
||||
FinalApplicationStatus.valueOf(finalStatusQuery);
|
||||
if (!appReport.getFinalApplicationStatus().toString()
|
||||
.equalsIgnoreCase(finalStatusQuery)) {
|
||||
.equalsIgnoreCase(finalStatusQuery)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -177,19 +169,18 @@ public class WebServices {
|
|||
continue;
|
||||
}
|
||||
}
|
||||
if (checkAppTypes && !appTypes.contains(
|
||||
appReport.getApplicationType().trim().toLowerCase())) {
|
||||
if (checkAppTypes
|
||||
&& !appTypes.contains(appReport.getApplicationType().trim()
|
||||
.toLowerCase())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (checkStart
|
||||
&& (appReport.getStartTime() < sBegin ||
|
||||
appReport.getStartTime() > sEnd)) {
|
||||
&& (appReport.getStartTime() < sBegin || appReport.getStartTime() > sEnd)) {
|
||||
continue;
|
||||
}
|
||||
if (checkEnd
|
||||
&& (appReport.getFinishTime() < fBegin ||
|
||||
appReport.getFinishTime() > fEnd)) {
|
||||
&& (appReport.getFinishTime() < fBegin || appReport.getFinishTime() > fEnd)) {
|
||||
continue;
|
||||
}
|
||||
AppInfo app = new AppInfo(appReport);
|
||||
|
@ -200,8 +191,8 @@ public class WebServices {
|
|||
return allApps;
|
||||
}
|
||||
|
||||
public AppInfo getApp(
|
||||
HttpServletRequest req, HttpServletResponse res, String appId) {
|
||||
public AppInfo getApp(HttpServletRequest req, HttpServletResponse res,
|
||||
String appId) {
|
||||
ApplicationId id = parseApplicationId(appId);
|
||||
ApplicationReport app = null;
|
||||
try {
|
||||
|
@ -215,8 +206,8 @@ public class WebServices {
|
|||
return new AppInfo(app);
|
||||
}
|
||||
|
||||
public AppAttemptsInfo getAppAttempts(
|
||||
HttpServletRequest req, HttpServletResponse res, String appId) {
|
||||
public AppAttemptsInfo getAppAttempts(HttpServletRequest req,
|
||||
HttpServletResponse res, String appId) {
|
||||
ApplicationId id = parseApplicationId(appId);
|
||||
Collection<ApplicationAttemptReport> appAttemptReports = null;
|
||||
try {
|
||||
|
@ -233,9 +224,8 @@ public class WebServices {
|
|||
return appAttemptsInfo;
|
||||
}
|
||||
|
||||
public AppAttemptInfo getAppAttempt(
|
||||
HttpServletRequest req, HttpServletResponse res,
|
||||
String appId, String appAttemptId) {
|
||||
public AppAttemptInfo getAppAttempt(HttpServletRequest req,
|
||||
HttpServletResponse res, String appId, String appAttemptId) {
|
||||
ApplicationId aid = parseApplicationId(appId);
|
||||
ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
|
||||
validateIds(aid, aaid, null);
|
||||
|
@ -246,15 +236,14 @@ public class WebServices {
|
|||
throw new WebApplicationException(e);
|
||||
}
|
||||
if (appAttempt == null) {
|
||||
throw new NotFoundException(
|
||||
"app attempt with id: " + appAttemptId + " not found");
|
||||
throw new NotFoundException("app attempt with id: " + appAttemptId
|
||||
+ " not found");
|
||||
}
|
||||
return new AppAttemptInfo(appAttempt);
|
||||
}
|
||||
|
||||
public ContainersInfo getContainers(
|
||||
HttpServletRequest req, HttpServletResponse res,
|
||||
String appId, String appAttemptId) {
|
||||
public ContainersInfo getContainers(HttpServletRequest req,
|
||||
HttpServletResponse res, String appId, String appAttemptId) {
|
||||
ApplicationId aid = parseApplicationId(appId);
|
||||
ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
|
||||
validateIds(aid, aaid, null);
|
||||
|
@ -272,9 +261,9 @@ public class WebServices {
|
|||
return containersInfo;
|
||||
}
|
||||
|
||||
public ContainerInfo getContainer(
|
||||
HttpServletRequest req, HttpServletResponse res,
|
||||
String appId, String appAttemptId, String containerId) {
|
||||
public ContainerInfo getContainer(HttpServletRequest req,
|
||||
HttpServletResponse res, String appId, String appAttemptId,
|
||||
String containerId) {
|
||||
ApplicationId aid = parseApplicationId(appId);
|
||||
ApplicationAttemptId aaid = parseApplicationAttemptId(appAttemptId);
|
||||
ContainerId cid = parseContainerId(containerId);
|
||||
|
@ -286,18 +275,19 @@ public class WebServices {
|
|||
throw new WebApplicationException(e);
|
||||
}
|
||||
if (container == null) {
|
||||
throw new NotFoundException(
|
||||
"container with id: " + containerId + " not found");
|
||||
throw new NotFoundException("container with id: " + containerId
|
||||
+ " not found");
|
||||
}
|
||||
return new ContainerInfo(container);
|
||||
}
|
||||
|
||||
protected void init(HttpServletResponse response) {
|
||||
// clear content type
|
||||
response.setContentType(null);
|
||||
}
|
||||
|
||||
protected static Set<String> parseQueries(
|
||||
Set<String> queries, boolean isState) {
|
||||
protected static Set<String>
|
||||
parseQueries(Set<String> queries, boolean isState) {
|
||||
Set<String> params = new HashSet<String>();
|
||||
if (!queries.isEmpty()) {
|
||||
for (String query : queries) {
|
||||
|
@ -313,9 +303,9 @@ public class WebServices {
|
|||
YarnApplicationState[] stateArray =
|
||||
YarnApplicationState.values();
|
||||
String allAppStates = Arrays.toString(stateArray);
|
||||
throw new BadRequestException(
|
||||
"Invalid application-state " + paramStr.trim()
|
||||
+ " specified. It should be one of " + allAppStates);
|
||||
throw new BadRequestException("Invalid application-state "
|
||||
+ paramStr.trim() + " specified. It should be one of "
|
||||
+ allAppStates);
|
||||
}
|
||||
}
|
||||
params.add(paramStr.trim().toLowerCase());
|
||||
|
@ -341,8 +331,8 @@ public class WebServices {
|
|||
protected static ApplicationAttemptId parseApplicationAttemptId(
|
||||
String appAttemptId) {
|
||||
if (appAttemptId == null || appAttemptId.isEmpty()) {
|
||||
throw new NotFoundException(
|
||||
"appAttemptId, " + appAttemptId + ", is empty or null");
|
||||
throw new NotFoundException("appAttemptId, " + appAttemptId
|
||||
+ ", is empty or null");
|
||||
}
|
||||
ApplicationAttemptId aaid =
|
||||
ConverterUtils.toApplicationAttemptId(appAttemptId);
|
||||
|
@ -354,8 +344,8 @@ public class WebServices {
|
|||
|
||||
protected static ContainerId parseContainerId(String containerId) {
|
||||
if (containerId == null || containerId.isEmpty()) {
|
||||
throw new NotFoundException(
|
||||
"containerId, " + containerId + ", is empty or null");
|
||||
throw new NotFoundException("containerId, " + containerId
|
||||
+ ", is empty or null");
|
||||
}
|
||||
ContainerId cid = ConverterUtils.toContainerId(containerId);
|
||||
if (cid == null) {
|
||||
|
@ -365,8 +355,7 @@ public class WebServices {
|
|||
}
|
||||
|
||||
protected void validateIds(ApplicationId appId,
|
||||
ApplicationAttemptId appAttemptId,
|
||||
ContainerId containerId) {
|
||||
ApplicationAttemptId appAttemptId, ContainerId containerId) {
|
||||
if (!appAttemptId.getApplicationId().equals(appId)) {
|
||||
throw new NotFoundException("appId and appAttemptId don't match");
|
||||
}
|
||||
|
|
|
@ -44,4 +44,3 @@ public class AppAttemptsInfo {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@ import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
|
|||
@Unstable
|
||||
public class RMApplicationHistoryWriter extends CompositeService {
|
||||
|
||||
public static final Log LOG =
|
||||
LogFactory.getLog(RMApplicationHistoryWriter.class);
|
||||
public static final Log LOG = LogFactory
|
||||
.getLog(RMApplicationHistoryWriter.class);
|
||||
|
||||
private Dispatcher dispatcher;
|
||||
private ApplicationHistoryWriter writer;
|
||||
|
@ -75,27 +75,29 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected synchronized void serviceInit(
|
||||
Configuration conf) throws Exception {
|
||||
protected synchronized void serviceInit(Configuration conf) throws Exception {
|
||||
|
||||
historyServiceEnabled = conf.getBoolean(
|
||||
YarnConfiguration.YARN_HISTORY_SERVICE_ENABLED,
|
||||
YarnConfiguration.DEFAULT_YARN_HISTORY_SERVICE_ENABLED);
|
||||
historyServiceEnabled =
|
||||
conf.getBoolean(YarnConfiguration.YARN_HISTORY_SERVICE_ENABLED,
|
||||
YarnConfiguration.DEFAULT_YARN_HISTORY_SERVICE_ENABLED);
|
||||
|
||||
writer = createApplicationHistoryStore(conf);
|
||||
addIfService(writer);
|
||||
|
||||
dispatcher = createDispatcher(conf);
|
||||
dispatcher.register(
|
||||
WritingHistoryEventType.class, new ForwardingEventHandler());
|
||||
dispatcher.register(WritingHistoryEventType.class,
|
||||
new ForwardingEventHandler());
|
||||
addIfService(dispatcher);
|
||||
super.serviceInit(conf);
|
||||
}
|
||||
|
||||
protected Dispatcher createDispatcher(Configuration conf) {
|
||||
MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher(conf.getInt(
|
||||
YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
|
||||
YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
|
||||
MultiThreadedDispatcher dispatcher =
|
||||
new MultiThreadedDispatcher(
|
||||
conf
|
||||
.getInt(
|
||||
YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
|
||||
YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
|
||||
dispatcher.setDrainEventsOnStop();
|
||||
return dispatcher;
|
||||
}
|
||||
|
@ -108,13 +110,13 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
try {
|
||||
Class<? extends ApplicationHistoryStore> storeClass =
|
||||
conf.getClass(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
|
||||
NullApplicationHistoryStore.class,
|
||||
ApplicationHistoryStore.class);
|
||||
NullApplicationHistoryStore.class, ApplicationHistoryStore.class);
|
||||
return storeClass.newInstance();
|
||||
} catch (Exception e) {
|
||||
String msg = "Could not instantiate ApplicationHistoryWriter: " +
|
||||
conf.get(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
|
||||
NullApplicationHistoryStore.class.getName());
|
||||
String msg =
|
||||
"Could not instantiate ApplicationHistoryWriter: "
|
||||
+ conf.get(YarnConfiguration.RM_HISTORY_WRITER_CLASS,
|
||||
NullApplicationHistoryStore.class.getName());
|
||||
LOG.error(msg, e);
|
||||
throw new YarnRuntimeException(msg, e);
|
||||
}
|
||||
|
@ -155,7 +157,7 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
(WritingApplicationAttemptStartEvent) event;
|
||||
try {
|
||||
writer.applicationAttemptStarted(waasEvent
|
||||
.getApplicationAttemptStartData());
|
||||
.getApplicationAttemptStartData());
|
||||
LOG.info("Stored the start data of application attempt "
|
||||
+ waasEvent.getApplicationAttemptId());
|
||||
} catch (IOException e) {
|
||||
|
@ -168,12 +170,13 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
(WritingApplicationAttemptFinishEvent) event;
|
||||
try {
|
||||
writer.applicationAttemptFinished(waafEvent
|
||||
.getApplicationAttemptFinishData());
|
||||
.getApplicationAttemptFinishData());
|
||||
LOG.info("Stored the finish data of application attempt "
|
||||
+ waafEvent.getApplicationAttemptId());
|
||||
} catch (IOException e) {
|
||||
LOG.error("Error when storing the finish data of application attempt "
|
||||
+ waafEvent.getApplicationAttemptId());
|
||||
LOG
|
||||
.error("Error when storing the finish data of application attempt "
|
||||
+ waafEvent.getApplicationAttemptId());
|
||||
}
|
||||
break;
|
||||
case CONTAINER_START:
|
||||
|
@ -209,21 +212,19 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
@SuppressWarnings("unchecked")
|
||||
public void applicationStarted(RMApp app) {
|
||||
dispatcher.getEventHandler().handle(
|
||||
new WritingApplicationStartEvent(app.getApplicationId(),
|
||||
ApplicationStartData.newInstance(app.getApplicationId(),
|
||||
app.getName(), app.getApplicationType(), app.getQueue(),
|
||||
app.getUser(), app.getSubmitTime(), app.getStartTime())));
|
||||
new WritingApplicationStartEvent(app.getApplicationId(),
|
||||
ApplicationStartData.newInstance(app.getApplicationId(), app.getName(),
|
||||
app.getApplicationType(), app.getQueue(), app.getUser(),
|
||||
app.getSubmitTime(), app.getStartTime())));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void applicationFinished(RMApp app) {
|
||||
dispatcher.getEventHandler().handle(
|
||||
new WritingApplicationFinishEvent(app.getApplicationId(),
|
||||
ApplicationFinishData.newInstance(app.getApplicationId(),
|
||||
app.getFinishTime(),
|
||||
app.getDiagnostics().toString(),
|
||||
app.getFinalApplicationStatus(),
|
||||
app.createApplicationState())));
|
||||
new WritingApplicationFinishEvent(app.getApplicationId(),
|
||||
ApplicationFinishData.newInstance(app.getApplicationId(),
|
||||
app.getFinishTime(), app.getDiagnostics().toString(),
|
||||
app.getFinalApplicationStatus(), app.createApplicationState())));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
@ -277,8 +278,8 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
* EventHandler implementation which forward events to HistoryWriter Making
|
||||
* use of it, HistoryWriter can avoid to have a public handle method
|
||||
*/
|
||||
private final class ForwardingEventHandler
|
||||
implements EventHandler<WritingApplicationHistoryEvent> {
|
||||
private final class ForwardingEventHandler implements
|
||||
EventHandler<WritingApplicationHistoryEvent> {
|
||||
|
||||
@Override
|
||||
public void handle(WritingApplicationHistoryEvent event) {
|
||||
|
@ -288,8 +289,8 @@ public class RMApplicationHistoryWriter extends CompositeService {
|
|||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
protected static class MultiThreadedDispatcher
|
||||
extends CompositeService implements Dispatcher {
|
||||
protected static class MultiThreadedDispatcher extends CompositeService
|
||||
implements Dispatcher {
|
||||
|
||||
private List<AsyncDispatcher> dispatchers =
|
||||
new ArrayList<AsyncDispatcher>();
|
||||
|
|
|
@ -18,12 +18,7 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.resourcemanager.ahs;
|
||||
|
||||
|
||||
public enum WritingHistoryEventType {
|
||||
APP_START,
|
||||
APP_FINISH,
|
||||
APP_ATTEMPT_START,
|
||||
APP_ATTEMPT_FINISH,
|
||||
CONTAINER_START,
|
||||
CONTAINER_FINISH
|
||||
APP_START, APP_FINISH, APP_ATTEMPT_START, APP_ATTEMPT_FINISH,
|
||||
CONTAINER_START, CONTAINER_FINISH
|
||||
}
|
|
@ -88,9 +88,12 @@ public class TestRMApplicationHistoryWriter {
|
|||
|
||||
@Override
|
||||
protected Dispatcher createDispatcher(Configuration conf) {
|
||||
MultiThreadedDispatcher dispatcher = new MultiThreadedDispatcher(conf.getInt(
|
||||
YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
|
||||
YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
|
||||
MultiThreadedDispatcher dispatcher =
|
||||
new MultiThreadedDispatcher(
|
||||
conf
|
||||
.getInt(
|
||||
YarnConfiguration.RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE,
|
||||
YarnConfiguration.DEFAULT_RM_HISTORY_WRITER_MULTI_THREADED_DISPATCHER_POOL_SIZE));
|
||||
dispatcher.setDrainEventsOnStop();
|
||||
return dispatcher;
|
||||
}
|
||||
|
@ -131,11 +134,11 @@ public class TestRMApplicationHistoryWriter {
|
|||
when(app.getStartTime()).thenReturn(1L);
|
||||
when(app.getFinishTime()).thenReturn(2L);
|
||||
when(app.getDiagnostics()).thenReturn(
|
||||
new StringBuilder("test diagnostics info"));
|
||||
new StringBuilder("test diagnostics info"));
|
||||
when(app.getFinalApplicationStatus()).thenReturn(
|
||||
FinalApplicationStatus.UNDEFINED);
|
||||
FinalApplicationStatus.UNDEFINED);
|
||||
when(app.createApplicationState())
|
||||
.thenReturn(YarnApplicationState.FINISHED);
|
||||
.thenReturn(YarnApplicationState.FINISHED);
|
||||
return app;
|
||||
}
|
||||
|
||||
|
@ -146,26 +149,25 @@ public class TestRMApplicationHistoryWriter {
|
|||
when(appAttempt.getHost()).thenReturn("test host");
|
||||
when(appAttempt.getRpcPort()).thenReturn(-100);
|
||||
Container container = mock(Container.class);
|
||||
when(container.getId()).thenReturn(
|
||||
ContainerId.newInstance(appAttemptId, 1));
|
||||
when(container.getId())
|
||||
.thenReturn(ContainerId.newInstance(appAttemptId, 1));
|
||||
when(appAttempt.getMasterContainer()).thenReturn(container);
|
||||
when(appAttempt.getDiagnostics()).thenReturn("test diagnostics info");
|
||||
when(appAttempt.getTrackingUrl()).thenReturn("test url");
|
||||
when(appAttempt.getFinalApplicationStatus()).thenReturn(
|
||||
FinalApplicationStatus.UNDEFINED);
|
||||
FinalApplicationStatus.UNDEFINED);
|
||||
when(appAttempt.createApplicationAttemptState()).thenReturn(
|
||||
YarnApplicationAttemptState.FINISHED);
|
||||
YarnApplicationAttemptState.FINISHED);
|
||||
return appAttempt;
|
||||
}
|
||||
|
||||
private static RMContainer createRMContainer(
|
||||
ContainerId containerId) {
|
||||
private static RMContainer createRMContainer(ContainerId containerId) {
|
||||
RMContainer container = mock(RMContainer.class);
|
||||
when(container.getContainerId()).thenReturn(containerId);
|
||||
when(container.getAllocatedNode()).thenReturn(
|
||||
NodeId.newInstance("test host", -100));
|
||||
NodeId.newInstance("test host", -100));
|
||||
when(container.getAllocatedResource()).thenReturn(
|
||||
Resource.newInstance(-1, -1));
|
||||
Resource.newInstance(-1, -1));
|
||||
when(container.getAllocatedPriority()).thenReturn(Priority.UNDEFINED);
|
||||
when(container.getStartTime()).thenReturn(0L);
|
||||
when(container.getFinishTime()).thenReturn(1L);
|
||||
|
@ -210,22 +212,22 @@ public class TestRMApplicationHistoryWriter {
|
|||
Assert.assertEquals(2L, appHD.getFinishTime());
|
||||
Assert.assertEquals("test diagnostics info", appHD.getDiagnosticsInfo());
|
||||
Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
|
||||
appHD.getFinalApplicationStatus());
|
||||
appHD.getFinalApplicationStatus());
|
||||
Assert.assertEquals(YarnApplicationState.FINISHED,
|
||||
appHD.getYarnApplicationState());
|
||||
appHD.getYarnApplicationState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteApplicationAttempt() throws Exception {
|
||||
RMAppAttempt appAttempt = createRMAppAttempt(
|
||||
ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
RMAppAttempt appAttempt =
|
||||
createRMAppAttempt(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
writer.applicationAttemptStarted(appAttempt);
|
||||
ApplicationAttemptHistoryData appAttemptHD = null;
|
||||
for (int i = 0; i < MAX_RETRIES; ++i) {
|
||||
appAttemptHD =
|
||||
store.getApplicationAttempt(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
if (appAttemptHD != null) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -235,16 +237,15 @@ public class TestRMApplicationHistoryWriter {
|
|||
Assert.assertNotNull(appAttemptHD);
|
||||
Assert.assertEquals("test host", appAttemptHD.getHost());
|
||||
Assert.assertEquals(-100, appAttemptHD.getRPCPort());
|
||||
Assert.assertEquals(
|
||||
ContainerId.newInstance(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1), 1),
|
||||
appAttemptHD.getMasterContainerId());
|
||||
Assert.assertEquals(ContainerId.newInstance(
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1), 1),
|
||||
appAttemptHD.getMasterContainerId());
|
||||
|
||||
writer.applicationAttemptFinished(appAttempt);
|
||||
for (int i = 0; i < MAX_RETRIES; ++i) {
|
||||
appAttemptHD =
|
||||
store.getApplicationAttempt(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
ApplicationId.newInstance(0, 1), 1));
|
||||
if (appAttemptHD.getYarnApplicationAttemptState() != null) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -252,26 +253,26 @@ public class TestRMApplicationHistoryWriter {
|
|||
}
|
||||
}
|
||||
Assert.assertEquals("test diagnostics info",
|
||||
appAttemptHD.getDiagnosticsInfo());
|
||||
appAttemptHD.getDiagnosticsInfo());
|
||||
Assert.assertEquals("test url", appAttemptHD.getTrackingURL());
|
||||
Assert.assertEquals(FinalApplicationStatus.UNDEFINED,
|
||||
appAttemptHD.getFinalApplicationStatus());
|
||||
appAttemptHD.getFinalApplicationStatus());
|
||||
Assert.assertEquals(YarnApplicationAttemptState.FINISHED,
|
||||
appAttemptHD.getYarnApplicationAttemptState());
|
||||
appAttemptHD.getYarnApplicationAttemptState());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testWriteContainer() throws Exception {
|
||||
RMContainer container = createRMContainer(
|
||||
ContainerId.newInstance(ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1), 1));
|
||||
RMContainer container =
|
||||
createRMContainer(ContainerId.newInstance(
|
||||
ApplicationAttemptId.newInstance(ApplicationId.newInstance(0, 1), 1),
|
||||
1));
|
||||
writer.containerStarted(container);
|
||||
ContainerHistoryData containerHD = null;
|
||||
for (int i = 0; i < MAX_RETRIES; ++i) {
|
||||
containerHD =
|
||||
store.getContainer(ContainerId.newInstance(
|
||||
ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1), 1));
|
||||
store.getContainer(ContainerId.newInstance(ApplicationAttemptId
|
||||
.newInstance(ApplicationId.newInstance(0, 1), 1), 1));
|
||||
if (containerHD != null) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -280,18 +281,17 @@ public class TestRMApplicationHistoryWriter {
|
|||
}
|
||||
Assert.assertNotNull(containerHD);
|
||||
Assert.assertEquals(NodeId.newInstance("test host", -100),
|
||||
containerHD.getAssignedNode());
|
||||
containerHD.getAssignedNode());
|
||||
Assert.assertEquals(Resource.newInstance(-1, -1),
|
||||
containerHD.getAllocatedResource());
|
||||
containerHD.getAllocatedResource());
|
||||
Assert.assertEquals(Priority.UNDEFINED, containerHD.getPriority());
|
||||
Assert.assertEquals(0L, container.getStartTime());
|
||||
|
||||
writer.containerFinished(container);
|
||||
for (int i = 0; i < MAX_RETRIES; ++i) {
|
||||
containerHD =
|
||||
store.getContainer(ContainerId.newInstance(
|
||||
ApplicationAttemptId.newInstance(
|
||||
ApplicationId.newInstance(0, 1), 1), 1));
|
||||
store.getContainer(ContainerId.newInstance(ApplicationAttemptId
|
||||
.newInstance(ApplicationId.newInstance(0, 1), 1), 1));
|
||||
if (containerHD.getContainerState() != null) {
|
||||
break;
|
||||
} else {
|
||||
|
@ -299,11 +299,11 @@ public class TestRMApplicationHistoryWriter {
|
|||
}
|
||||
}
|
||||
Assert.assertEquals("test diagnostics info",
|
||||
containerHD.getDiagnosticsInfo());
|
||||
containerHD.getDiagnosticsInfo());
|
||||
Assert.assertEquals("test log url", containerHD.getLogURL());
|
||||
Assert.assertEquals(-1, containerHD.getContainerExitStatus());
|
||||
Assert.assertEquals(ContainerState.COMPLETE,
|
||||
containerHD.getContainerState());
|
||||
containerHD.getContainerState());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -367,18 +367,23 @@ public class TestRMApplicationHistoryWriter {
|
|||
@Override
|
||||
public void applicationStarted(RMApp app) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applicationFinished(RMApp app) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applicationAttemptStarted(RMAppAttempt appAttempt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applicationAttemptFinished(RMAppAttempt appAttempt) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void containerStarted(RMContainer container) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void containerFinished(RMContainer container) {
|
||||
}
|
||||
|
@ -410,17 +415,18 @@ public class TestRMApplicationHistoryWriter {
|
|||
am.registerAppAttempt();
|
||||
|
||||
int request = 10000;
|
||||
am.allocate("127.0.0.1" , 1024, request,
|
||||
new ArrayList<ContainerId>());
|
||||
am.allocate("127.0.0.1", 1024, request, new ArrayList<ContainerId>());
|
||||
nm.nodeHeartbeat(true);
|
||||
List<Container> allocated = am.allocate(new ArrayList<ResourceRequest>(),
|
||||
new ArrayList<ContainerId>()).getAllocatedContainers();
|
||||
List<Container> allocated =
|
||||
am.allocate(new ArrayList<ResourceRequest>(),
|
||||
new ArrayList<ContainerId>()).getAllocatedContainers();
|
||||
int waitCount = 0;
|
||||
int allocatedSize = allocated.size();
|
||||
while (allocatedSize < request && waitCount++ < 200) {
|
||||
Thread.sleep(100);
|
||||
allocated = am.allocate(new ArrayList<ResourceRequest>(),
|
||||
new ArrayList<ContainerId>()).getAllocatedContainers();
|
||||
allocated =
|
||||
am.allocate(new ArrayList<ResourceRequest>(),
|
||||
new ArrayList<ContainerId>()).getAllocatedContainers();
|
||||
allocatedSize += allocated.size();
|
||||
nm.nodeHeartbeat(true);
|
||||
}
|
||||
|
@ -470,27 +476,28 @@ public class TestRMApplicationHistoryWriter {
|
|||
(WritingApplicationHistoryEvent) event;
|
||||
switch (ashEvent.getType()) {
|
||||
case APP_START:
|
||||
incrementCounts(((WritingApplicationStartEvent) event).getApplicationId());
|
||||
incrementCounts(((WritingApplicationStartEvent) event)
|
||||
.getApplicationId());
|
||||
break;
|
||||
case APP_FINISH:
|
||||
incrementCounts(((WritingApplicationFinishEvent) event)
|
||||
.getApplicationId());
|
||||
.getApplicationId());
|
||||
break;
|
||||
case APP_ATTEMPT_START:
|
||||
incrementCounts(((WritingApplicationAttemptStartEvent) event)
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
break;
|
||||
case APP_ATTEMPT_FINISH:
|
||||
incrementCounts(((WritingApplicationAttemptFinishEvent) event)
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
break;
|
||||
case CONTAINER_START:
|
||||
incrementCounts(((WritingContainerStartEvent) event).getContainerId()
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
incrementCounts(((WritingContainerStartEvent) event)
|
||||
.getContainerId().getApplicationAttemptId().getApplicationId());
|
||||
break;
|
||||
case CONTAINER_FINISH:
|
||||
incrementCounts(((WritingContainerFinishEvent) event).getContainerId()
|
||||
.getApplicationAttemptId().getApplicationId());
|
||||
incrementCounts(((WritingContainerFinishEvent) event)
|
||||
.getContainerId().getApplicationAttemptId().getApplicationId());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue