YARN-979. Added more APIs for getting information about ApplicationAttempts and Containers from ApplicationHistoryProtocol. Contributed by Mayank Bansal and Zhijie Shen.
svn merge --ignore-ancestry -c 1556731 ../YARN-321 git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1562187 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
cb52671a9b
commit
e8a09094f5
|
@ -483,6 +483,10 @@ Branch YARN-321: Generic ApplicationHistoryService
|
|||
YARN-1123. Added a new ContainerReport and its Protobuf implementation. (Mayank
|
||||
Bansal via vinodkv)
|
||||
|
||||
YARN-979. Added more APIs for getting information about ApplicationAttempts
|
||||
and Containers from ApplicationHistoryProtocol. (Mayank Bansal and Zhijie Shen
|
||||
via vinodkv)
|
||||
|
||||
Release 2.2.0 - 2013-10-13
|
||||
|
||||
INCOMPATIBLE CHANGES
|
||||
|
|
|
@ -18,39 +18,57 @@
|
|||
|
||||
package org.apache.hadoop.yarn.api;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationReport;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||
import org.apache.hadoop.yarn.api.records.Token;
|
||||
import org.apache.hadoop.yarn.exceptions.YarnException;
|
||||
|
||||
/**
|
||||
* <p>The protocol between clients and the <code>ApplicationHistoryService</code>
|
||||
* to get information on 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>HistoryServer</code>.</p>
|
||||
* 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>HistoryServer</code> verifies access to the
|
||||
* application etc. before accepting the request.</p>
|
||||
* <p> In secure mode,the <code>ApplicationHistoryServer</code> verifies
|
||||
* access to the application, queue etc. before accepting the request.</p>
|
||||
*
|
||||
* <p>The <code>HistoryServer</code> responds with a
|
||||
* <p>The <code>ApplicationHistoryServer</code> responds with a
|
||||
* {@link GetApplicationReportResponse} which includes the
|
||||
* {@link ApplicationReport} for the application.</p>
|
||||
*
|
||||
|
@ -69,16 +87,19 @@ public interface ApplicationHistoryProtocol {
|
|||
* @param request request for an application report
|
||||
* @return application report
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetApplicationReportResponse getApplicationReport(
|
||||
GetApplicationReportRequest request) throws YarnException;
|
||||
GetApplicationReportRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get a report of all Applications
|
||||
* in the cluster from the <code>HistoryServer</code>.</p>
|
||||
* in the cluster from the <code>ApplicationHistoryServer</code>.</p>
|
||||
*
|
||||
* <p>The <code>HistoryServer</code> responds with a
|
||||
* {@link GetApplicationsRequest} which includes the
|
||||
* <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
|
||||
|
@ -86,26 +107,147 @@ public interface ApplicationHistoryProtocol {
|
|||
* described in {@link #getApplicationReport(GetApplicationReportRequest)}.
|
||||
* </p>
|
||||
*
|
||||
* @param request request for report on all running applications
|
||||
* @return report on all running applications
|
||||
* @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 GetApplicationsResponse getApplications(
|
||||
GetApplicationsRequest request) throws YarnException;
|
||||
@Public
|
||||
@Unstable
|
||||
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
|
||||
* {@link GetApplicationAttemptReportResponse} which includes the
|
||||
* {@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>diagnostics - set to "N/A"</li>
|
||||
* <li>tracking URL </li>
|
||||
* </ul>
|
||||
* </p>
|
||||
*
|
||||
* @param request
|
||||
* request for an application attempt report
|
||||
* @return application attempt report
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
|
||||
GetApplicationAttemptReportRequest request) throws YarnException,
|
||||
IOException;
|
||||
|
||||
/**
|
||||
* <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>
|
||||
*
|
||||
* <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>
|
||||
*
|
||||
* @param request
|
||||
* request for reports on all application attempts of an application
|
||||
* @return reports on all application attempts of an application
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetApplicationAttemptsResponse getApplicationAttempts(
|
||||
GetApplicationAttemptsRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* <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>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 GetContainerReportResponse} which includes the
|
||||
* {@link ContainerReport} for the container.</p>
|
||||
*
|
||||
* @param request
|
||||
* request for a container report
|
||||
* @return container report
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetContainerReportResponse getContainer(
|
||||
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 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>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>
|
||||
*
|
||||
* @param request
|
||||
* request for a list of container reports of an application attempt.
|
||||
* @return reports on all containers of an application attempt
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetContainersResponse getContainers(GetContainersRequest request)
|
||||
throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* <p>The interface used by clients to get delegation token, enabling the
|
||||
* containers to be able to talk to the service using those tokens.
|
||||
* 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>
|
||||
*
|
||||
* <p> The <code>HistoryServer</code> responds with the delegation token
|
||||
* {@link Token} that can be used by the client to speak to this
|
||||
* service.
|
||||
* @param request request to get a delegation token for the client.
|
||||
* @return delegation token that can be used to talk to this service
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public GetDelegationTokenResponse getDelegationToken(
|
||||
GetDelegationTokenRequest request) throws YarnException;
|
||||
GetDelegationTokenRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* Renew an existing delegation token.
|
||||
|
@ -113,10 +255,12 @@ public interface ApplicationHistoryProtocol {
|
|||
* @param request the delegation token to be renewed.
|
||||
* @return the new expiry time for the delegation token.
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Private
|
||||
@Unstable
|
||||
public RenewDelegationTokenResponse renewDelegationToken(
|
||||
RenewDelegationTokenRequest request) throws YarnException;
|
||||
RenewDelegationTokenRequest request) throws YarnException, IOException;
|
||||
|
||||
/**
|
||||
* Cancel an existing delegation token.
|
||||
|
@ -124,8 +268,10 @@ public interface ApplicationHistoryProtocol {
|
|||
* @param request the delegation token to be cancelled.
|
||||
* @return an empty response.
|
||||
* @throws YarnException
|
||||
* @throws IOException
|
||||
*/
|
||||
@Private
|
||||
@Unstable
|
||||
public CancelDelegationTokenResponse cancelDelegationToken(
|
||||
CancelDelegationTokenRequest request) throws YarnException;
|
||||
CancelDelegationTokenRequest request) throws YarnException, IOException;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
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>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetApplicationAttemptReportRequest {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetApplicationAttemptReportRequest newInstance(
|
||||
ApplicationAttemptId applicationAttemptId) {
|
||||
GetApplicationAttemptReportRequest request =
|
||||
Records.newRecord(GetApplicationAttemptReportRequest.class);
|
||||
request.setApplicationAttemptId(applicationAttemptId);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptId</code> of an application attempt.
|
||||
*
|
||||
* @return <code>ApplicationAttemptId</code> of an application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ApplicationAttemptId getApplicationAttemptId();
|
||||
|
||||
/**
|
||||
* Set the <code>ApplicationAttemptId</code> of an application attempt
|
||||
*
|
||||
* @param applicationAttemptId <code>ApplicationAttemptId</code> of an
|
||||
* application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setApplicationAttemptId(
|
||||
ApplicationAttemptId applicationAttemptId);
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
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>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetApplicationAttemptReportResponse {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetApplicationAttemptReportResponse newInstance(
|
||||
ApplicationAttemptReport ApplicationAttemptReport) {
|
||||
GetApplicationAttemptReportResponse response =
|
||||
Records.newRecord(GetApplicationAttemptReportResponse.class);
|
||||
response.setApplicationAttemptReport(ApplicationAttemptReport);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptReport</code> for the application attempt.
|
||||
*
|
||||
* @return <code>ApplicationAttemptReport</code> for the application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ApplicationAttemptReport getApplicationAttemptReport();
|
||||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptReport</code> for the application attempt.
|
||||
*
|
||||
* @param ApplicationAttemptReport <code>ApplicationAttemptReport</code> for
|
||||
* the application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setApplicationAttemptReport(
|
||||
ApplicationAttemptReport applicationAttemptReport);
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
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>
|
||||
*
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetApplicationAttemptsRequest {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetApplicationAttemptsRequest newInstance(
|
||||
ApplicationId applicationId) {
|
||||
GetApplicationAttemptsRequest request =
|
||||
Records.newRecord(GetApplicationAttemptsRequest.class);
|
||||
request.setApplicationId(applicationId);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ApplicationId</code> of an application
|
||||
*
|
||||
* @return <code>ApplicationId</code> of an application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ApplicationId getApplicationId();
|
||||
|
||||
/**
|
||||
* Set the <code>ApplicationId</code> of an application
|
||||
*
|
||||
* @param ApplicationId <code>ApplicationId</code> of an application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setApplicationId(ApplicationId applicationId);
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
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>
|
||||
*
|
||||
* @see ApplicationAttemptReport
|
||||
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetApplicationAttemptsResponse {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetApplicationAttemptsResponse newInstance(
|
||||
List<ApplicationAttemptReport> applicationAttempts) {
|
||||
GetApplicationAttemptsResponse response =
|
||||
Records.newRecord(GetApplicationAttemptsResponse.class);
|
||||
response.setApplicationAttemptList(applicationAttempts);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of <code>ApplicationReport</code> of an application.
|
||||
*
|
||||
* @return a list of <code>ApplicationReport</code> of an application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract List<ApplicationAttemptReport> getApplicationAttemptList();
|
||||
|
||||
/**
|
||||
* Get a list of <code>ApplicationReport</code> of an application.
|
||||
*
|
||||
* @param applicationAttempts a list of <code>ApplicationReport</code> of an
|
||||
* application
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setApplicationAttemptList(
|
||||
List<ApplicationAttemptReport> applicationAttempts);
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
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>
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetContainerReportRequest {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetContainerReportRequest newInstance(ContainerId containerId) {
|
||||
GetContainerReportRequest request = Records.newRecord(GetContainerReportRequest.class);
|
||||
request.setContainerId(containerId);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ContainerId</code> of the Container.
|
||||
*
|
||||
* @return <code>ContainerId</code> of the Container
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ContainerId getContainerId();
|
||||
|
||||
/**
|
||||
* Set the <code>ContainerId</code> of the container
|
||||
*
|
||||
* @param ContainerId
|
||||
* <code>ContainerId</code> of the container
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setContainerId(ContainerId containerId);
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
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 includes a {@link ContainerReport} which has details of a
|
||||
* container.</p>
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetContainerReportResponse {
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetContainerReportResponse newInstance(
|
||||
ContainerReport containerReport) {
|
||||
GetContainerReportResponse response =
|
||||
Records.newRecord(GetContainerReportResponse.class);
|
||||
response.setContainerReport(containerReport);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ContainerReport</code> for the container.
|
||||
*
|
||||
* @return <code>ContainerReport</code> for the container
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ContainerReport getContainerReport();
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setContainerReport(ContainerReport containerReport);
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
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>
|
||||
*
|
||||
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetContainersRequest {
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetContainersRequest newInstance(
|
||||
ApplicationAttemptId applicationAttemptId) {
|
||||
GetContainersRequest request =
|
||||
Records.newRecord(GetContainersRequest.class);
|
||||
request.setApplicationAttemptId(applicationAttemptId);
|
||||
return request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the <code>ApplicationAttemptId</code> of an application attempt.
|
||||
*
|
||||
* @return <code>ApplicationAttemptId</code> of an application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract ApplicationAttemptId getApplicationAttemptId();
|
||||
|
||||
/**
|
||||
* Set the <code>ApplicationAttemptId</code> of an application attempt
|
||||
*
|
||||
* @param applicationAttemptId <code>ApplicationAttemptId</code> of an
|
||||
* application attempt
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setApplicationAttemptId(
|
||||
ApplicationAttemptId applicationAttemptId);
|
||||
}
|
|
@ -0,0 +1,75 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Public;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
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>
|
||||
*
|
||||
* @see ContainerReport
|
||||
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract class GetContainersResponse {
|
||||
|
||||
@Public
|
||||
@Unstable
|
||||
public static GetContainersResponse newInstance(List<ContainerReport> containers) {
|
||||
GetContainersResponse response =
|
||||
Records.newRecord(GetContainersResponse.class);
|
||||
response.setContainerList(containers);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract List<ContainerReport> getContainerList();
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
@Public
|
||||
@Unstable
|
||||
public abstract void setContainerList(List<ContainerReport> containers);
|
||||
}
|
|
@ -20,13 +20,18 @@ option java_package = "org.apache.hadoop.yarn.proto";
|
|||
option java_outer_classname = "ApplicationHistoryProtocol";
|
||||
option java_generic_services = true;
|
||||
option java_generate_equals_and_hash = true;
|
||||
package hadoop.yarn;
|
||||
|
||||
import "Security.proto";
|
||||
import "yarn_service_protos.proto";
|
||||
|
||||
service ApplicationHistoryProtocolService {
|
||||
rpc getApplicationReport (GetApplicationReportRequestProto) returns (GetApplicationReportResponseProto);
|
||||
rpc getAllApplications (GetAllApplicationsRequestProto) returns (GetAllApplicationsResponseProto);
|
||||
rpc getApplications (GetApplicationsRequestProto) returns (GetApplicationsResponseProto);
|
||||
rpc getApplicationAttemptReport (GetApplicationAttemptReportRequestProto) returns (GetApplicationAttemptReportResponseProto);
|
||||
rpc getApplicationAttempts (GetApplicationAttemptsRequestProto) returns (GetApplicationAttemptsResponseProto);
|
||||
rpc getContainerReport (GetContainerReportRequestProto) returns (GetContainerReportResponseProto);
|
||||
rpc getContainers (GetContainersRequestProto) returns (GetContainersResponseProto);
|
||||
rpc getDelegationToken(hadoop.common.GetDelegationTokenRequestProto) returns (hadoop.common.GetDelegationTokenResponseProto);
|
||||
rpc renewDelegationToken(hadoop.common.RenewDelegationTokenRequestProto) returns (hadoop.common.RenewDelegationTokenResponseProto);
|
||||
rpc cancelDelegationToken(hadoop.common.CancelDelegationTokenRequestProto) returns (hadoop.common.CancelDelegationTokenResponseProto);
|
|
@ -232,3 +232,39 @@ message GetContainerStatusesResponseProto {
|
|||
repeated ContainerStatusProto status = 1;
|
||||
repeated ContainerExceptionMapProto failed_requests = 2;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
/////// Application_History_Protocol /////////////////
|
||||
//////////////////////////////////////////////////////
|
||||
|
||||
message GetApplicationAttemptReportRequestProto {
|
||||
optional ApplicationAttemptIdProto application_attempt_id = 1;
|
||||
}
|
||||
|
||||
message GetApplicationAttemptReportResponseProto {
|
||||
optional ApplicationAttemptReportProto application_attempt_report = 1;
|
||||
}
|
||||
|
||||
message GetApplicationAttemptsRequestProto {
|
||||
optional ApplicationIdProto application_id = 1;
|
||||
}
|
||||
|
||||
message GetApplicationAttemptsResponseProto {
|
||||
repeated ApplicationAttemptReportProto application_attempts = 1;
|
||||
}
|
||||
|
||||
message GetContainerReportRequestProto {
|
||||
optional ContainerIdProto container_id = 1;
|
||||
}
|
||||
|
||||
message GetContainerReportResponseProto {
|
||||
optional ContainerReportProto container_report = 1;
|
||||
}
|
||||
|
||||
message GetContainersRequestProto {
|
||||
optional ApplicationAttemptIdProto application_attempt_id = 1;
|
||||
}
|
||||
|
||||
message GetContainersResponseProto {
|
||||
repeated ContainerReportProto containers = 1;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,138 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportRequestProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetApplicationAttemptReportRequestPBImpl extends
|
||||
GetApplicationAttemptReportRequest {
|
||||
|
||||
GetApplicationAttemptReportRequestProto proto =
|
||||
GetApplicationAttemptReportRequestProto.getDefaultInstance();
|
||||
GetApplicationAttemptReportRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
private ApplicationAttemptId applicationAttemptId = null;
|
||||
|
||||
public GetApplicationAttemptReportRequestPBImpl() {
|
||||
builder = GetApplicationAttemptReportRequestProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetApplicationAttemptReportRequestPBImpl(
|
||||
GetApplicationAttemptReportRequestProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetApplicationAttemptReportRequestProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (applicationAttemptId != null) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetApplicationAttemptReportRequestProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAttemptId getApplicationAttemptId() {
|
||||
if (this.applicationAttemptId != null) {
|
||||
return this.applicationAttemptId;
|
||||
}
|
||||
GetApplicationAttemptReportRequestProtoOrBuilder p
|
||||
= viaProto ? proto : builder;
|
||||
if (!p.hasApplicationAttemptId()) {
|
||||
return null;
|
||||
}
|
||||
this.applicationAttemptId =
|
||||
convertFromProtoFormat(p.getApplicationAttemptId());
|
||||
return this.applicationAttemptId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttemptId == null) {
|
||||
builder.clearApplicationAttemptId();
|
||||
}
|
||||
this.applicationAttemptId = applicationAttemptId;
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdPBImpl convertFromProtoFormat(
|
||||
ApplicationAttemptIdProto p) {
|
||||
return new ApplicationAttemptIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdProto convertToProtoFormat(ApplicationAttemptId t) {
|
||||
return ((ApplicationAttemptIdPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,140 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptReportPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptReportProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptReportResponseProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetApplicationAttemptReportResponsePBImpl extends
|
||||
GetApplicationAttemptReportResponse {
|
||||
|
||||
GetApplicationAttemptReportResponseProto proto =
|
||||
GetApplicationAttemptReportResponseProto.getDefaultInstance();
|
||||
GetApplicationAttemptReportResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
private ApplicationAttemptReport applicationAttemptReport = null;
|
||||
|
||||
public GetApplicationAttemptReportResponsePBImpl() {
|
||||
builder = GetApplicationAttemptReportResponseProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetApplicationAttemptReportResponsePBImpl(
|
||||
GetApplicationAttemptReportResponseProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetApplicationAttemptReportResponseProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationAttemptReport != null) {
|
||||
builder.setApplicationAttemptReport(
|
||||
convertToProtoFormat(this.applicationAttemptReport));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetApplicationAttemptReportResponseProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAttemptReport getApplicationAttemptReport() {
|
||||
if (this.applicationAttemptReport != null) {
|
||||
return this.applicationAttemptReport;
|
||||
}
|
||||
GetApplicationAttemptReportResponseProtoOrBuilder p
|
||||
= viaProto ? proto : builder;
|
||||
if (!p.hasApplicationAttemptReport()) {
|
||||
return null;
|
||||
}
|
||||
this.applicationAttemptReport =
|
||||
convertFromProtoFormat(p.getApplicationAttemptReport());
|
||||
return this.applicationAttemptReport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptReport(
|
||||
ApplicationAttemptReport ApplicationAttemptReport) {
|
||||
maybeInitBuilder();
|
||||
if (ApplicationAttemptReport == null) {
|
||||
builder.clearApplicationAttemptReport();
|
||||
}
|
||||
this.applicationAttemptReport = ApplicationAttemptReport;
|
||||
}
|
||||
|
||||
private ApplicationAttemptReportPBImpl convertFromProtoFormat(
|
||||
ApplicationAttemptReportProto p) {
|
||||
return new ApplicationAttemptReportPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptReportProto convertToProtoFormat(
|
||||
ApplicationAttemptReport t) {
|
||||
return ((ApplicationAttemptReportPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,134 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationId;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsRequestProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetApplicationAttemptsRequestPBImpl extends
|
||||
GetApplicationAttemptsRequest {
|
||||
|
||||
GetApplicationAttemptsRequestProto proto =
|
||||
GetApplicationAttemptsRequestProto.getDefaultInstance();
|
||||
GetApplicationAttemptsRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
ApplicationId applicationId = null;
|
||||
|
||||
public GetApplicationAttemptsRequestPBImpl() {
|
||||
builder = GetApplicationAttemptsRequestProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetApplicationAttemptsRequestPBImpl(
|
||||
GetApplicationAttemptsRequestProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetApplicationAttemptsRequestProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (applicationId != null) {
|
||||
builder.setApplicationId(convertToProtoFormat(this.applicationId));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetApplicationAttemptsRequestProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationId getApplicationId() {
|
||||
if (this.applicationId != null) {
|
||||
return this.applicationId;
|
||||
}
|
||||
GetApplicationAttemptsRequestProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasApplicationId()) {
|
||||
return null;
|
||||
}
|
||||
this.applicationId = convertFromProtoFormat(p.getApplicationId());
|
||||
return this.applicationId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationId(ApplicationId applicationId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationId == null) {
|
||||
builder.clearApplicationId();
|
||||
}
|
||||
this.applicationId = applicationId;
|
||||
}
|
||||
|
||||
private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
|
||||
return new ApplicationIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationIdProto convertToProtoFormat(ApplicationId t) {
|
||||
return ((ApplicationIdPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptReportPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptReportProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetApplicationAttemptsResponseProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetApplicationAttemptsResponsePBImpl extends
|
||||
GetApplicationAttemptsResponse {
|
||||
|
||||
GetApplicationAttemptsResponseProto proto =
|
||||
GetApplicationAttemptsResponseProto.getDefaultInstance();
|
||||
GetApplicationAttemptsResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
List<ApplicationAttemptReport> applicationAttemptList;
|
||||
|
||||
public GetApplicationAttemptsResponsePBImpl() {
|
||||
builder = GetApplicationAttemptsResponseProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetApplicationAttemptsResponsePBImpl(
|
||||
GetApplicationAttemptsResponseProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationAttemptReport> getApplicationAttemptList() {
|
||||
initLocalApplicationAttemptsList();
|
||||
return this.applicationAttemptList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptList(
|
||||
List<ApplicationAttemptReport> applicationAttempts) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttempts == null) {
|
||||
builder.clearApplicationAttempts();
|
||||
}
|
||||
this.applicationAttemptList = applicationAttempts;
|
||||
}
|
||||
|
||||
public GetApplicationAttemptsResponseProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.applicationAttemptList != null) {
|
||||
addLocalApplicationAttemptsToProto();
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetApplicationAttemptsResponseProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
// Once this is called. containerList will never be null - until a getProto
|
||||
// is called.
|
||||
private void initLocalApplicationAttemptsList() {
|
||||
if (this.applicationAttemptList != null) {
|
||||
return;
|
||||
}
|
||||
GetApplicationAttemptsResponseProtoOrBuilder p = viaProto ? proto : builder;
|
||||
List<ApplicationAttemptReportProto> list = p.getApplicationAttemptsList();
|
||||
applicationAttemptList = new ArrayList<ApplicationAttemptReport>();
|
||||
|
||||
for (ApplicationAttemptReportProto a : list) {
|
||||
applicationAttemptList.add(convertFromProtoFormat(a));
|
||||
}
|
||||
}
|
||||
|
||||
private void addLocalApplicationAttemptsToProto() {
|
||||
maybeInitBuilder();
|
||||
builder.clearApplicationAttempts();
|
||||
if (applicationAttemptList == null) {
|
||||
return;
|
||||
}
|
||||
Iterable<ApplicationAttemptReportProto> iterable =
|
||||
new Iterable<ApplicationAttemptReportProto>() {
|
||||
@Override
|
||||
public Iterator<ApplicationAttemptReportProto> iterator() {
|
||||
return new Iterator<ApplicationAttemptReportProto>() {
|
||||
|
||||
Iterator<ApplicationAttemptReport> iter =
|
||||
applicationAttemptList.iterator();
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return iter.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAttemptReportProto next() {
|
||||
return convertToProtoFormat(iter.next());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
throw new UnsupportedOperationException();
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
builder.addAllApplicationAttempts(iterable);
|
||||
}
|
||||
|
||||
private ApplicationAttemptReportPBImpl convertFromProtoFormat(
|
||||
ApplicationAttemptReportProto p) {
|
||||
return new ApplicationAttemptReportPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptReportProto convertToProtoFormat(
|
||||
ApplicationAttemptReport t) {
|
||||
return ((ApplicationAttemptReportPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportRequestProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetContainerReportRequestPBImpl extends GetContainerReportRequest {
|
||||
GetContainerReportRequestProto proto =
|
||||
GetContainerReportRequestProto.getDefaultInstance();
|
||||
GetContainerReportRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
private ContainerId containerId = null;
|
||||
|
||||
public GetContainerReportRequestPBImpl() {
|
||||
builder = GetContainerReportRequestProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetContainerReportRequestPBImpl(GetContainerReportRequestProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetContainerReportRequestProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null)
|
||||
return false;
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (containerId != null) {
|
||||
builder.setContainerId(convertToProtoFormat(this.containerId));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto)
|
||||
maybeInitBuilder();
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetContainerReportRequestProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainerId getContainerId() {
|
||||
if (this.containerId != null) {
|
||||
return this.containerId;
|
||||
}
|
||||
GetContainerReportRequestProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasContainerId()) {
|
||||
return null;
|
||||
}
|
||||
this.containerId = convertFromProtoFormat(p.getContainerId());
|
||||
return this.containerId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerId(ContainerId containerId) {
|
||||
maybeInitBuilder();
|
||||
if (containerId == null) {
|
||||
builder.clearContainerId();
|
||||
}
|
||||
this.containerId = containerId;
|
||||
}
|
||||
|
||||
private ContainerIdPBImpl convertFromProtoFormat(ContainerIdProto p) {
|
||||
return new ContainerIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ContainerIdProto convertToProtoFormat(ContainerId t) {
|
||||
return ((ContainerIdPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerReportPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerReportProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainerReportResponseProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class GetContainerReportResponsePBImpl
|
||||
extends GetContainerReportResponse {
|
||||
|
||||
GetContainerReportResponseProto proto =
|
||||
GetContainerReportResponseProto.getDefaultInstance();
|
||||
GetContainerReportResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
private ContainerReport containerReport = null;
|
||||
|
||||
public GetContainerReportResponsePBImpl() {
|
||||
builder = GetContainerReportResponseProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetContainerReportResponsePBImpl(
|
||||
GetContainerReportResponseProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetContainerReportResponseProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null)
|
||||
return false;
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.containerReport != null) {
|
||||
builder.setContainerReport(convertToProtoFormat(this.containerReport));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto)
|
||||
maybeInitBuilder();
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetContainerReportResponseProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContainerReport getContainerReport() {
|
||||
if (this.containerReport != null) {
|
||||
return this.containerReport;
|
||||
}
|
||||
GetContainerReportResponseProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasContainerReport()) {
|
||||
return null;
|
||||
}
|
||||
this.containerReport = convertFromProtoFormat(p.getContainerReport());
|
||||
return this.containerReport;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerReport(ContainerReport containerReport) {
|
||||
maybeInitBuilder();
|
||||
if (containerReport == null) {
|
||||
builder.clearContainerReport();
|
||||
}
|
||||
this.containerReport = containerReport;
|
||||
}
|
||||
|
||||
private ContainerReportPBImpl convertFromProtoFormat(
|
||||
ContainerReportProto p) {
|
||||
return new ContainerReportPBImpl(p);
|
||||
}
|
||||
|
||||
private ContainerReportProto convertToProtoFormat(ContainerReport t) {
|
||||
return ((ContainerReportPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,131 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest;
|
||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersRequestProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersRequestProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
public class GetContainersRequestPBImpl extends GetContainersRequest {
|
||||
GetContainersRequestProto proto =
|
||||
GetContainersRequestProto.getDefaultInstance();
|
||||
GetContainersRequestProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
private ApplicationAttemptId applicationAttemptId = null;
|
||||
|
||||
public GetContainersRequestPBImpl() {
|
||||
builder = GetContainersRequestProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetContainersRequestPBImpl(GetContainersRequestProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
public GetContainersRequestProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (applicationAttemptId != null) {
|
||||
builder.setApplicationAttemptId(
|
||||
convertToProtoFormat(this.applicationAttemptId));
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetContainersRequestProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ApplicationAttemptId getApplicationAttemptId() {
|
||||
if (this.applicationAttemptId != null) {
|
||||
return this.applicationAttemptId;
|
||||
}
|
||||
GetContainersRequestProtoOrBuilder p = viaProto ? proto : builder;
|
||||
if (!p.hasApplicationAttemptId()) {
|
||||
return null;
|
||||
}
|
||||
this.applicationAttemptId =
|
||||
convertFromProtoFormat(p.getApplicationAttemptId());
|
||||
return this.applicationAttemptId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationAttemptId(
|
||||
ApplicationAttemptId applicationAttemptId) {
|
||||
maybeInitBuilder();
|
||||
if (applicationAttemptId == null) {
|
||||
builder.clearApplicationAttemptId();
|
||||
}
|
||||
this.applicationAttemptId = applicationAttemptId;
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdPBImpl convertFromProtoFormat(
|
||||
ApplicationAttemptIdProto p) {
|
||||
return new ApplicationAttemptIdPBImpl(p);
|
||||
}
|
||||
|
||||
private ApplicationAttemptIdProto convertToProtoFormat(
|
||||
ApplicationAttemptId t) {
|
||||
return ((ApplicationAttemptIdPBImpl) t).getProto();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,180 @@
|
|||
/**
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.hadoop.classification.InterfaceAudience.Private;
|
||||
import org.apache.hadoop.classification.InterfaceStability.Unstable;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse;
|
||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerReportPBImpl;
|
||||
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerReportProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersResponseProto;
|
||||
import org.apache.hadoop.yarn.proto.YarnServiceProtos.GetContainersResponseProtoOrBuilder;
|
||||
|
||||
import com.google.protobuf.TextFormat;
|
||||
|
||||
@Private
|
||||
@Unstable
|
||||
public class GetContainersResponsePBImpl
|
||||
extends GetContainersResponse {
|
||||
|
||||
GetContainersResponseProto proto =
|
||||
GetContainersResponseProto.getDefaultInstance();
|
||||
GetContainersResponseProto.Builder builder = null;
|
||||
boolean viaProto = false;
|
||||
|
||||
List<ContainerReport> containerList;
|
||||
|
||||
public GetContainersResponsePBImpl() {
|
||||
builder = GetContainersResponseProto.newBuilder();
|
||||
}
|
||||
|
||||
public GetContainersResponsePBImpl(GetContainersResponseProto proto) {
|
||||
this.proto = proto;
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContainerReport> getContainerList() {
|
||||
initLocalContainerList();
|
||||
return this.containerList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setContainerList(List<ContainerReport> containers) {
|
||||
maybeInitBuilder();
|
||||
if (containers == null) {
|
||||
builder.clearContainers();
|
||||
}
|
||||
this.containerList = containers;
|
||||
}
|
||||
|
||||
public GetContainersResponseProto getProto() {
|
||||
mergeLocalToProto();
|
||||
proto = viaProto ? proto : builder.build();
|
||||
viaProto = true;
|
||||
return proto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return getProto().hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (other == null) {
|
||||
return false;
|
||||
}
|
||||
if (other.getClass().isAssignableFrom(this.getClass())) {
|
||||
return this.getProto().equals(this.getClass().cast(other).getProto());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return TextFormat.shortDebugString(getProto());
|
||||
}
|
||||
|
||||
private void mergeLocalToBuilder() {
|
||||
if (this.containerList != null) {
|
||||
addLocalContainersToProto();
|
||||
}
|
||||
}
|
||||
|
||||
private void mergeLocalToProto() {
|
||||
if (viaProto) {
|
||||
maybeInitBuilder();
|
||||
}
|
||||
mergeLocalToBuilder();
|
||||
proto = builder.build();
|
||||
viaProto = true;
|
||||
}
|
||||
|
||||
private void maybeInitBuilder() {
|
||||
if (viaProto || builder == null) {
|
||||
builder = GetContainersResponseProto.newBuilder(proto);
|
||||
}
|
||||
viaProto = false;
|
||||
}
|
||||
|
||||
// Once this is called. containerList will never be null - until a getProto
|
||||
// is called.
|
||||
private void initLocalContainerList() {
|
||||
if (this.containerList != null) {
|
||||
return;
|
||||
}
|
||||
GetContainersResponseProtoOrBuilder p = viaProto ? proto : builder;
|
||||
List<ContainerReportProto> list = p.getContainersList();
|
||||
containerList = new ArrayList<ContainerReport>();
|
||||
|
||||
for (ContainerReportProto c : list) {
|
||||
containerList.add(convertFromProtoFormat(c));
|
||||
}
|
||||
}
|
||||
|
||||
private void addLocalContainersToProto() {
|
||||
maybeInitBuilder();
|
||||
builder.clearContainers();
|
||||
if (containerList == null) {
|
||||
return;
|
||||
}
|
||||
Iterable<ContainerReportProto> iterable = new Iterable<ContainerReportProto>() {
|
||||
@Override
|
||||
public Iterator<ContainerReportProto> iterator() {
|
||||
return new Iterator<ContainerReportProto>() {
|
||||
|
||||
Iterator<ContainerReport> iter = containerList.iterator();
|
||||
|
||||
@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);
|
||||
}
|
||||
|
||||
private ContainerReportPBImpl convertFromProtoFormat(ContainerReportProto p) {
|
||||
return new ContainerReportPBImpl(p);
|
||||
}
|
||||
|
||||
private ContainerReportProto convertToProtoFormat(ContainerReport t) {
|
||||
return ((ContainerReportPBImpl) t).getProto();
|
||||
}
|
||||
|
||||
}
|
|
@ -18,14 +18,24 @@
|
|||
|
||||
package org.apache.hadoop.yarn.server.applicationhistoryservice;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.hadoop.service.AbstractService;
|
||||
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.CancelDelegationTokenResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationAttemptsResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerReportResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetContainersResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetDelegationTokenResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.RenewDelegationTokenRequest;
|
||||
|
@ -73,4 +83,33 @@ public class AHSClientService extends AbstractService implements
|
|||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GetApplicationAttemptReportResponse getApplicationAttemptReport(
|
||||
GetApplicationAttemptReportRequest request) throws YarnException,
|
||||
IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GetApplicationAttemptsResponse getApplicationAttempts(
|
||||
GetApplicationAttemptsRequest request) throws YarnException, IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GetContainerReportResponse getContainer(
|
||||
GetContainerReportRequest request) throws YarnException, IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GetContainersResponse getContainers(GetContainersRequest request)
|
||||
throws YarnException, IOException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue