@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class YarnClient
extends org.apache.hadoop.service.AbstractService
| Modifier | Constructor and Description |
|---|---|
protected |
YarnClient(String name) |
| Modifier and Type | Method and Description |
|---|---|
abstract YarnClientApplication |
createApplication()
Obtain a
YarnClientApplication for a new application,
which in turn contains the ApplicationSubmissionContext and
GetNewApplicationResponse
objects. |
static YarnClient |
createYarnClient()
Create a new instance of YarnClient.
|
abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse |
deleteReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest request)
The interface used by clients to remove an existing Reservation.
|
abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> |
getAllQueues()
Get information (
QueueInfo) about all queues, recursively if there
is a hierarchy |
abstract org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier> |
getAMRMToken(org.apache.hadoop.yarn.api.records.ApplicationId appId)
Get the AMRM token of the application.
|
abstract org.apache.hadoop.yarn.api.records.ApplicationAttemptReport |
getApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId)
Get a report of the given ApplicationAttempt.
|
abstract List<org.apache.hadoop.yarn.api.records.ApplicationAttemptReport> |
getApplicationAttempts(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Get a report of all (ApplicationAttempts) of Application in the cluster.
|
abstract org.apache.hadoop.yarn.api.records.ApplicationReport |
getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId appId)
Get a report of the given Application.
|
abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
getApplications()
Get a report (ApplicationReport) of all Applications in the cluster.
|
abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
getApplications(EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates)
Get a report (ApplicationReport) of Applications matching the given
application states in the cluster.
|
abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
getApplications(Set<String> applicationTypes)
Get a report (ApplicationReport) of Applications
matching the given application types in the cluster.
|
abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
getApplications(Set<String> applicationTypes,
EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates)
Get a report (ApplicationReport) of Applications matching the given
application types and application states in the cluster.
|
abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> |
getChildQueueInfos(String parent)
Get information (
QueueInfo) about all the immediate children queues
of the given queue |
abstract Set<String> |
getClusterNodeLabels()
The interface used by client to get node labels in the cluster
|
abstract org.apache.hadoop.yarn.api.records.ContainerReport |
getContainerReport(org.apache.hadoop.yarn.api.records.ContainerId containerId)
Get a report of the given Container.
|
abstract List<org.apache.hadoop.yarn.api.records.ContainerReport> |
getContainers(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId)
Get a report of all (Containers) of ApplicationAttempt in the cluster.
|
abstract List<org.apache.hadoop.yarn.api.records.NodeReport> |
getNodeReports(org.apache.hadoop.yarn.api.records.NodeState... states)
Get a report of nodes (
NodeReport) in the cluster. |
abstract Map<org.apache.hadoop.yarn.api.records.NodeId,Set<String>> |
getNodeToLabels()
The interface used by client to get node to labels mappings in existing cluster
|
abstract List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> |
getQueueAclsInfo()
Get information about acls for current user on all the
existing queues.
|
abstract org.apache.hadoop.yarn.api.records.QueueInfo |
getQueueInfo(String queueName)
Get information (
QueueInfo) about a given queue. |
abstract org.apache.hadoop.yarn.api.records.Token |
getRMDelegationToken(org.apache.hadoop.io.Text renewer)
Get a delegation token so as to be able to talk to YARN using those tokens.
|
abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> |
getRootQueueInfos()
Get information (
QueueInfo) about top level queues. |
abstract org.apache.hadoop.yarn.api.records.YarnClusterMetrics |
getYarnClusterMetrics()
Get metrics (
YarnClusterMetrics) about the cluster. |
abstract void |
killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Kill an application identified by given ID.
|
abstract void |
moveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId,
String queue)
Attempts to move the given application to the given queue.
|
abstract org.apache.hadoop.yarn.api.records.ApplicationId |
submitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext)
Submit a new application to
YARN. It is a blocking call - it
will not return ApplicationId until the submitted application is
submitted successfully and accepted by the ResourceManager. |
abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse |
submitReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request)
The interface used by clients to submit a new reservation to the
ResourceManager. |
abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse |
updateReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest request)
The interface used by clients to update an existing Reservation.
|
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceInit, serviceStart, serviceStop, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop@InterfaceAudience.Private protected YarnClient(String name)
@InterfaceAudience.Public public static YarnClient createYarnClient()
public abstract YarnClientApplication createApplication() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Obtain a YarnClientApplication for a new application,
which in turn contains the ApplicationSubmissionContext and
GetNewApplicationResponse
objects.
YarnClientApplication built for a new applicationorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.ApplicationId submitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Submit a new application to YARN. It is a blocking call - it
will not return ApplicationId until the submitted application is
submitted successfully and accepted by the ResourceManager.
Users should provide an ApplicationId as part of the parameter
ApplicationSubmissionContext when submitting a new application,
otherwise it will throw the ApplicationIdNotProvidedException.
This internally calls (SubmitApplicationRequest), and after that, it internally invokes
(GetApplicationReportRequest) and waits till it can make sure that the
application gets properly submitted. If RM fails over or RM restart
happens before ResourceManager saves the application's state,
#getApplicationReport(GetApplicationReportRequest) will throw
the ApplicationNotFoundException. This API automatically resubmits
the application with the same ApplicationSubmissionContext when it
catches the ApplicationNotFoundException
appContext - ApplicationSubmissionContext containing all the details
needed to submit a new applicationApplicationId of the accepted applicationorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptioncreateApplication()public abstract void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Kill an application identified by given ID.
applicationId - ApplicationId of the application that needs to be killedorg.apache.hadoop.yarn.exceptions.YarnException - in case of errors or if YARN rejects the request due to
access-control restrictions.IOExceptiongetQueueAclsInfo()public abstract org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId appId)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Get a report of the given Application.
In secure mode, YARN verifies access to the application, queue
etc. before accepting the request.
If the user does not have VIEW_APP access then the following
fields in the report will be set to stubbed values:
appId - ApplicationId of the application that needs a reportorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.security.token.Token<org.apache.hadoop.yarn.security.AMRMTokenIdentifier> getAMRMToken(org.apache.hadoop.yarn.api.records.ApplicationId appId)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
UserGroupInformation of the
current user.
The AMRM token will be returned only if all the following conditions are
met:
appId - ApplicationId of the application to get the AMRM tokenorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report (ApplicationReport) of all Applications in the cluster.
If the user does not have VIEW_APP access for an application
then the corresponding report will be filtered as described in
getApplicationReport(ApplicationId).
org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> applicationTypes) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report (ApplicationReport) of Applications matching the given application types in the cluster.
If the user does not have VIEW_APP access for an application
then the corresponding report will be filtered as described in
getApplicationReport(ApplicationId).
applicationTypes - org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report (ApplicationReport) of Applications matching the given application states in the cluster.
If the user does not have VIEW_APP access for an application
then the corresponding report will be filtered as described in
getApplicationReport(ApplicationId).
applicationStates - org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> applicationTypes, EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report (ApplicationReport) of Applications matching the given application types and application states in the cluster.
If the user does not have VIEW_APP access for an application
then the corresponding report will be filtered as described in
getApplicationReport(ApplicationId).
applicationTypes - applicationStates - org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.YarnClusterMetrics getYarnClusterMetrics()
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Get metrics (YarnClusterMetrics) about the cluster.
org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.NodeReport> getNodeReports(org.apache.hadoop.yarn.api.records.NodeState... states) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report of nodes (NodeReport) in the cluster.
states - The NodeStates to filter on. If no filter states are
given, nodes in all states will be returned.org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.Token getRMDelegationToken(org.apache.hadoop.io.Text renewer)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Get a delegation token so as to be able to talk to YARN using those tokens.
renewer - Address of the renewer who can renew these tokens when needed by
securely talking to YARN.Token) that can be used to
talk to YARNorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get information (QueueInfo) about a given queue.
queueName - Name of the queue whose information is neededorg.apache.hadoop.yarn.exceptions.YarnException - in case of errors or if YARN rejects the request due to
access-control restrictions.IOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> getAllQueues() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get information (QueueInfo) about all queues, recursively if there
is a hierarchy
org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> getRootQueueInfos() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get information (QueueInfo) about top level queues.
org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.QueueInfo> getChildQueueInfos(String parent) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get information (QueueInfo) about all the immediate children queues
of the given queue
parent - Name of the queue whose child-queues' information is neededorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueAclsInfo() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get information about acls for current user on all the existing queues.
QueueUserACLInfo) for
current userorg.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.ApplicationAttemptReport getApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Get a report of the given ApplicationAttempt.
In secure mode, YARN verifies access to the application, queue
etc. before accepting the request.
applicationAttemptId - ApplicationAttemptId of the application attempt that needs
a reportorg.apache.hadoop.yarn.exceptions.YarnException{@link - ApplicationAttemptNotFoundException} if application attempt
not foundIOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ApplicationAttemptReport> getApplicationAttempts(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report of all (ApplicationAttempts) of Application in the cluster.
applicationId - org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract org.apache.hadoop.yarn.api.records.ContainerReport getContainerReport(org.apache.hadoop.yarn.api.records.ContainerId containerId)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Get a report of the given Container.
In secure mode, YARN verifies access to the application, queue
etc. before accepting the request.
containerId - ContainerId of the container that needs a reportorg.apache.hadoop.yarn.exceptions.YarnException{@link - ContainerNotFoundException} if container not found.IOExceptionpublic abstract List<org.apache.hadoop.yarn.api.records.ContainerReport> getContainers(org.apache.hadoop.yarn.api.records.ApplicationAttemptId applicationAttemptId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
Get a report of all (Containers) of ApplicationAttempt in the cluster.
applicationAttemptId - org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionpublic abstract void moveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId,
String queue)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
Attempts to move the given application to the given queue.
appId - Application to move.queue - Queue to place it in to.org.apache.hadoop.yarn.exceptions.YarnExceptionIOException@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse submitReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
The interface used by clients to submit a new reservation to the
ResourceManager.
The client packages all details of its request in a
ReservationSubmissionRequest object. This contains information
about the amount of capacity, temporal constraints, and gang needs.
Furthermore, the reservation might be composed of multiple stages, with
ordering dependencies among them.
In order to respond, a new admission control component in the
ResourceManager performs an analysis of the resources that have
been committed over the period of time the user is requesting, verify that
the user requests can be fulfilled, and that it respect a sharing policy
(e.g., CapacityOverTimePolicy). Once it has positively determined
that the ReservationRequest is satisfiable the ResourceManager
answers with a ReservationSubmissionResponse that includes a
ReservationId. Upon failure to find a valid allocation the response
is an exception with the message detailing the reason of failure.
The semantics guarantees that the ReservationId returned,
corresponds to a valid reservation existing in the time-range request by
the user. The amount of capacity dedicated to such reservation can vary
overtime, depending of the allocation that has been determined. But it is
guaranteed to satisfy all the constraint expressed by the user in the
ReservationDefinition
request - request to submit a new ReservationReservationId on accepting the
submissionorg.apache.hadoop.yarn.exceptions.YarnException - if the reservation cannot be created successfullyIOException@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse updateReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest request)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
The interface used by clients to update an existing Reservation. This is referred to as a re-negotiation process, in which a user that has previously submitted a Reservation.
The allocation is attempted by virtually substituting all previous
allocations related to this Reservation with new ones, that satisfy the new
ReservationDefinition. Upon success the previous allocation is
atomically substituted by the new one, and on failure (i.e., if the system
cannot find a valid allocation for the updated request), the previous
allocation remains valid.
request - to update an existing Reservation (the
ReservationUpdateRequest should refer to an existing valid
ReservationId)org.apache.hadoop.yarn.exceptions.YarnException - if the request is invalid or reservation cannot be
updated successfullyIOException@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse deleteReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest request)
throws org.apache.hadoop.yarn.exceptions.YarnException,
IOException
The interface used by clients to remove an existing Reservation.
request - to remove an existing Reservation (the
ReservationDeleteRequest should refer to an existing valid
ReservationId)org.apache.hadoop.yarn.exceptions.YarnException - if the request is invalid or reservation cannot be
deleted successfullyIOException@InterfaceAudience.Public @InterfaceStability.Unstable public abstract Map<org.apache.hadoop.yarn.api.records.NodeId,Set<String>> getNodeToLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
The interface used by client to get node to labels mappings in existing cluster
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException@InterfaceAudience.Public @InterfaceStability.Unstable public abstract Set<String> getClusterNodeLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
The interface used by client to get node labels in the cluster
org.apache.hadoop.yarn.exceptions.YarnExceptionIOExceptionCopyright © 2016 Apache Software Foundation. All Rights Reserved.