@InterfaceAudience.Private @InterfaceStability.Unstable public class YarnClientImpl extends YarnClient
Service.STATE| Modifier and Type | Field and Description |
|---|---|
protected AHSClient |
historyClient |
protected ApplicationClientProtocol |
rmClient |
protected long |
submitPollIntervalMillis |
protected TimelineClient |
timelineClient |
protected boolean |
timelineServiceBestEffort |
protected boolean |
timelineServiceEnabled |
| Constructor and Description |
|---|
YarnClientImpl() |
| Modifier and Type | Method and Description |
|---|---|
YarnClientApplication |
createApplication()
Obtain a
YarnClientApplication for a new application,
which in turn contains the ApplicationSubmissionContext and
GetNewApplicationResponse
objects. |
ReservationDeleteResponse |
deleteReservation(ReservationDeleteRequest request)
The interface used by clients to remove an existing Reservation.
|
List<QueueInfo> |
getAllQueues()
Get information (
QueueInfo) about all queues, recursively if there
is a hierarchy |
org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> |
getAMRMToken(ApplicationId appId)
Get the AMRM token of the application.
|
ApplicationAttemptReport |
getApplicationAttemptReport(ApplicationAttemptId appAttemptId)
Get a report of the given ApplicationAttempt.
|
List<ApplicationAttemptReport> |
getApplicationAttempts(ApplicationId appId)
Get a report of all (ApplicationAttempts) of Application in the cluster.
|
ApplicationReport |
getApplicationReport(ApplicationId appId)
Get a report of the given Application.
|
List<ApplicationReport> |
getApplications()
Get a report (ApplicationReport) of all Applications in the cluster.
|
List<ApplicationReport> |
getApplications(EnumSet<YarnApplicationState> applicationStates)
Get a report (ApplicationReport) of Applications matching the given
application states in the cluster.
|
List<ApplicationReport> |
getApplications(Set<String> applicationTypes)
Get a report (ApplicationReport) of Applications
matching the given application types in the cluster.
|
List<ApplicationReport> |
getApplications(Set<String> applicationTypes,
EnumSet<YarnApplicationState> applicationStates)
Get a report (ApplicationReport) of Applications matching the given
application types and application states in the cluster.
|
List<QueueInfo> |
getChildQueueInfos(String parent)
Get information (
QueueInfo) about all the immediate children queues
of the given queue |
Set<String> |
getClusterNodeLabels()
The interface used by client to get node labels in the cluster
|
ContainerReport |
getContainerReport(ContainerId containerId)
Get a report of the given Container.
|
List<ContainerReport> |
getContainers(ApplicationAttemptId applicationAttemptId)
Get a report of all (Containers) of ApplicationAttempt in the cluster.
|
Map<String,Set<NodeId>> |
getLabelsToNodes()
The interface used by client to get labels to nodes mapping
in existing cluster
|
Map<String,Set<NodeId>> |
getLabelsToNodes(Set<String> labels)
The interface used by client to get labels to nodes mapping
for specified labels in existing cluster
|
List<NodeReport> |
getNodeReports(NodeState... states)
Get a report of nodes (
NodeReport) in the cluster. |
Map<NodeId,Set<String>> |
getNodeToLabels()
The interface used by client to get node to labels mappings in existing cluster
|
List<QueueUserACLInfo> |
getQueueAclsInfo()
Get information about acls for current user on all the
existing queues.
|
QueueInfo |
getQueueInfo(String queueName)
Get information (
QueueInfo) about a given queue. |
Token |
getRMDelegationToken(Text renewer)
Get a delegation token so as to be able to talk to YARN using those tokens.
|
List<QueueInfo> |
getRootQueueInfos()
Get information (
QueueInfo) about top level queues. |
YarnClusterMetrics |
getYarnClusterMetrics()
Get metrics (
YarnClusterMetrics) about the cluster. |
protected boolean |
isSecurityEnabled() |
void |
killApplication(ApplicationId applicationId)
Kill an application identified by given ID.
|
void |
moveApplicationAcrossQueues(ApplicationId appId,
String queue)
Attempts to move the given application to the given queue.
|
protected void |
serviceInit(Configuration conf) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
setRMClient(ApplicationClientProtocol rmClient) |
ApplicationId |
submitApplication(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. |
ReservationSubmissionResponse |
submitReservation(ReservationSubmissionRequest request)
The interface used by clients to submit a new reservation to the
ResourceManager. |
ReservationUpdateResponse |
updateReservation(ReservationUpdateRequest request)
The interface used by clients to update an existing Reservation.
|
createYarnClientclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected ApplicationClientProtocol rmClient
protected long submitPollIntervalMillis
protected AHSClient historyClient
protected TimelineClient timelineClient
protected boolean timelineServiceEnabled
protected boolean timelineServiceBestEffort
protected void serviceInit(Configuration conf) throws Exception
serviceInit in class AbstractServiceExceptionprotected void serviceStart()
throws Exception
serviceStart in class AbstractServiceExceptionprotected void serviceStop()
throws Exception
serviceStop in class AbstractServiceExceptionpublic YarnClientApplication createApplication() throws YarnException, IOException
YarnClient
Obtain a YarnClientApplication for a new application,
which in turn contains the ApplicationSubmissionContext and
GetNewApplicationResponse
objects.
createApplication in class YarnClientYarnClientApplication built for a new applicationYarnExceptionIOExceptionpublic ApplicationId submitApplication(ApplicationSubmissionContext appContext) throws YarnException, IOException
YarnClient
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
submitApplication in class YarnClientappContext - ApplicationSubmissionContext containing all the details
needed to submit a new applicationApplicationId of the accepted applicationYarnExceptionIOExceptionYarnClient.createApplication()@InterfaceAudience.Private protected boolean isSecurityEnabled()
public void killApplication(ApplicationId applicationId) throws YarnException, IOException
YarnClientKill an application identified by given ID.
killApplication in class YarnClientapplicationId - ApplicationId of the application that needs to be killedYarnException - in case of errors or if YARN rejects the request due to
access-control restrictions.IOExceptionYarnClient.getQueueAclsInfo()public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnException, IOException
YarnClientGet 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:
getApplicationReport in class YarnClientappId - ApplicationId of the application that needs a reportYarnExceptionIOExceptionpublic org.apache.hadoop.security.token.Token<AMRMTokenIdentifier> getAMRMToken(ApplicationId appId) throws YarnException, IOException
YarnClient
The AMRM token is required for AM to RM scheduling operations. For
managed Application Masters Yarn takes care of injecting it. For unmanaged
Applications Masters, the token must be obtained via this method and set
in the UserGroupInformation of the
current user.
The AMRM token will be returned only if all the following conditions are met:
getAMRMToken in class YarnClientappId - ApplicationId of the application to get the AMRM tokenYarnExceptionIOExceptionpublic List<ApplicationReport> getApplications() throws YarnException, IOException
YarnClientGet 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
YarnClient.getApplicationReport(ApplicationId).
getApplications in class YarnClientYarnExceptionIOExceptionpublic List<ApplicationReport> getApplications(Set<String> applicationTypes) throws YarnException, IOException
YarnClientGet 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
YarnClient.getApplicationReport(ApplicationId).
getApplications in class YarnClientYarnExceptionIOExceptionpublic List<ApplicationReport> getApplications(EnumSet<YarnApplicationState> applicationStates) throws YarnException, IOException
YarnClientGet 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
YarnClient.getApplicationReport(ApplicationId).
getApplications in class YarnClientYarnExceptionIOExceptionpublic List<ApplicationReport> getApplications(Set<String> applicationTypes, EnumSet<YarnApplicationState> applicationStates) throws YarnException, IOException
YarnClientGet 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
YarnClient.getApplicationReport(ApplicationId).
getApplications in class YarnClientYarnExceptionIOExceptionpublic YarnClusterMetrics getYarnClusterMetrics() throws YarnException, IOException
YarnClient
Get metrics (YarnClusterMetrics) about the cluster.
getYarnClusterMetrics in class YarnClientYarnExceptionIOExceptionpublic List<NodeReport> getNodeReports(NodeState... states) throws YarnException, IOException
YarnClient
Get a report of nodes (NodeReport) in the cluster.
getNodeReports in class YarnClientstates - The NodeStates to filter on. If no filter states are
given, nodes in all states will be returned.YarnExceptionIOExceptionpublic Token getRMDelegationToken(Text renewer) throws YarnException, IOException
YarnClientGet a delegation token so as to be able to talk to YARN using those tokens.
getRMDelegationToken in class YarnClientrenewer - Address of the renewer who can renew these tokens when needed by
securely talking to YARN.Token) that can be used to
talk to YARNYarnExceptionIOExceptionpublic QueueInfo getQueueInfo(String queueName) throws YarnException, IOException
YarnClient
Get information (QueueInfo) about a given queue.
getQueueInfo in class YarnClientqueueName - Name of the queue whose information is neededYarnException - in case of errors or if YARN rejects the request due to
access-control restrictions.IOExceptionpublic List<QueueUserACLInfo> getQueueAclsInfo() throws YarnException, IOException
YarnClientGet information about acls for current user on all the existing queues.
getQueueAclsInfo in class YarnClientQueueUserACLInfo) for
current userYarnExceptionIOExceptionpublic List<QueueInfo> getAllQueues() throws YarnException, IOException
YarnClient
Get information (QueueInfo) about all queues, recursively if there
is a hierarchy
getAllQueues in class YarnClientYarnExceptionIOExceptionpublic List<QueueInfo> getRootQueueInfos() throws YarnException, IOException
YarnClient
Get information (QueueInfo) about top level queues.
getRootQueueInfos in class YarnClientYarnExceptionIOExceptionpublic List<QueueInfo> getChildQueueInfos(String parent) throws YarnException, IOException
YarnClient
Get information (QueueInfo) about all the immediate children queues
of the given queue
getChildQueueInfos in class YarnClientparent - Name of the queue whose child-queues' information is neededYarnExceptionIOException@InterfaceAudience.Private public void setRMClient(ApplicationClientProtocol rmClient)
public ApplicationAttemptReport getApplicationAttemptReport(ApplicationAttemptId appAttemptId) throws YarnException, IOException
YarnClientGet a report of the given ApplicationAttempt.
In secure mode, YARN verifies access to the application, queue
etc. before accepting the request.
getApplicationAttemptReport in class YarnClientappAttemptId - ApplicationAttemptId of the application attempt that needs
a reportYarnExceptionApplicationAttemptNotFoundException - if application attempt
not foundIOExceptionpublic List<ApplicationAttemptReport> getApplicationAttempts(ApplicationId appId) throws YarnException, IOException
YarnClientGet a report of all (ApplicationAttempts) of Application in the cluster.
getApplicationAttempts in class YarnClientYarnExceptionIOExceptionpublic ContainerReport getContainerReport(ContainerId containerId) throws YarnException, IOException
YarnClientGet a report of the given Container.
In secure mode, YARN verifies access to the application, queue
etc. before accepting the request.
getContainerReport in class YarnClientcontainerId - ContainerId of the container that needs a reportYarnExceptionContainerNotFoundException - if container not found.IOExceptionpublic List<ContainerReport> getContainers(ApplicationAttemptId applicationAttemptId) throws YarnException, IOException
YarnClientGet a report of all (Containers) of ApplicationAttempt in the cluster.
getContainers in class YarnClientYarnExceptionIOExceptionpublic void moveApplicationAcrossQueues(ApplicationId appId, String queue) throws YarnException, IOException
YarnClientAttempts to move the given application to the given queue.
moveApplicationAcrossQueues in class YarnClientappId - Application to move.queue - Queue to place it in to.YarnExceptionIOExceptionpublic ReservationSubmissionResponse submitReservation(ReservationSubmissionRequest request) throws YarnException, IOException
YarnClient
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
submitReservation in class YarnClientrequest - request to submit a new ReservationReservationId on accepting the
submissionYarnException - if the reservation cannot be created successfullyIOExceptionpublic ReservationUpdateResponse updateReservation(ReservationUpdateRequest request) throws YarnException, IOException
YarnClientThe 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.
updateReservation in class YarnClientrequest - to update an existing Reservation (the
ReservationUpdateRequest should refer to an existing valid
ReservationId)YarnException - if the request is invalid or reservation cannot be
updated successfullyIOExceptionpublic ReservationDeleteResponse deleteReservation(ReservationDeleteRequest request) throws YarnException, IOException
YarnClientThe interface used by clients to remove an existing Reservation.
deleteReservation in class YarnClientrequest - to remove an existing Reservation (the
ReservationDeleteRequest should refer to an existing valid
ReservationId)YarnException - if the request is invalid or reservation cannot be
deleted successfullyIOExceptionpublic Map<NodeId,Set<String>> getNodeToLabels() throws YarnException, IOException
YarnClientThe interface used by client to get node to labels mappings in existing cluster
getNodeToLabels in class YarnClientYarnExceptionIOExceptionpublic Map<String,Set<NodeId>> getLabelsToNodes() throws YarnException, IOException
YarnClientThe interface used by client to get labels to nodes mapping in existing cluster
getLabelsToNodes in class YarnClientYarnExceptionIOExceptionpublic Map<String,Set<NodeId>> getLabelsToNodes(Set<String> labels) throws YarnException, IOException
YarnClientThe interface used by client to get labels to nodes mapping for specified labels in existing cluster
getLabelsToNodes in class YarnClientlabels - labels for which labels to nodes mapping has to be retrievedYarnExceptionIOExceptionpublic Set<String> getClusterNodeLabels() throws YarnException, IOException
YarnClientThe interface used by client to get node labels in the cluster
getClusterNodeLabels in class YarnClientYarnExceptionIOExceptionCopyright © 2018 CERN. All Rights Reserved.