YARN-5870. Expose getApplications API in YarnClient with GetApplicationsRequest parameter. Contributed by Jian He.
This commit is contained in:
parent
04a024b683
commit
ce2847e794
@ -32,6 +32,8 @@
|
||||
import org.apache.hadoop.io.Text;
|
||||
import org.apache.hadoop.service.AbstractService;
|
||||
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest;
|
||||
import org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse;
|
||||
@ -377,6 +379,30 @@ public abstract List<ApplicationReport> getApplications(Set<String> queues,
|
||||
EnumSet<YarnApplicationState> applicationStates) throws YarnException,
|
||||
IOException;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Get a list of ApplicationReports that match the given
|
||||
* {@link GetApplicationsRequest}.
|
||||
*</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(ApplicationId)}.
|
||||
* </p>
|
||||
*
|
||||
* @param request the request object to get the list of applications.
|
||||
* @return The list of ApplicationReports that match the request
|
||||
* @throws YarnException Exception specific to YARN.
|
||||
* @throws IOException Exception mostly related to connection errors.
|
||||
*/
|
||||
public List<ApplicationReport> getApplications(GetApplicationsRequest request)
|
||||
throws YarnException, IOException {
|
||||
throw new UnsupportedOperationException(
|
||||
"The sub-class extending " + YarnClient.class.getName()
|
||||
+ " is expected to implement this !");
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Get metrics ({@link YarnClusterMetrics}) about the cluster.
|
||||
|
@ -543,6 +543,13 @@ public List<ApplicationReport> getApplications(Set<String> queues,
|
||||
return response.getApplicationList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ApplicationReport> getApplications(
|
||||
GetApplicationsRequest request) throws YarnException, IOException {
|
||||
GetApplicationsResponse response = rmClient.getApplications(request);
|
||||
return response.getApplicationList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public YarnClusterMetrics getYarnClusterMetrics() throws YarnException,
|
||||
IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user