Class YarnClientImpl
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AHSClientprotected org.apache.hadoop.yarn.api.ApplicationClientProtocolprotected longprotected org.apache.hadoop.yarn.client.api.TimelineClientprotected boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionObtain aYarnClientApplicationfor a new application, which in turn contains theApplicationSubmissionContextandGetNewApplicationResponseobjects.org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponseObtain aGetNewReservationResponsefor a new reservation, which contains theReservationIdobject.org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponsedeleteReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest request) The interface used by clients to remove an existing Reservation.voidfailApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attemptId) Fail an application attempt identified by given ID.List<org.apache.hadoop.yarn.api.records.QueueInfo>Get information (QueueInfo) about all queues, recursively if there is a hierarchyorg.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.org.apache.hadoop.yarn.api.records.ApplicationAttemptReportgetApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) Get a report of the given ApplicationAttempt.List<org.apache.hadoop.yarn.api.records.ApplicationAttemptReport>getApplicationAttempts(org.apache.hadoop.yarn.api.records.ApplicationId appId) Get a report of all (ApplicationAttempts) of Application in the cluster.org.apache.hadoop.yarn.api.records.ApplicationReportgetApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId appId) Get a report of the given Application.List<org.apache.hadoop.yarn.api.records.ApplicationReport>Get a report (ApplicationReport) of all Applications in the cluster.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.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.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.List<org.apache.hadoop.yarn.api.records.ApplicationReport>getApplications(Set<String> applicationTypes, EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates, Set<String> applicationTags) Get a report (ApplicationReport) of Applications matching the given application types, application states and application tags in the cluster.List<org.apache.hadoop.yarn.api.records.ApplicationReport>getApplications(Set<String> queues, Set<String> users, Set<String> applicationTypes, EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates) Get a report (ApplicationReport) of Applications matching the given users, queues, application types and application states in the cluster.List<org.apache.hadoop.yarn.api.records.ApplicationReport>getApplications(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest request) Get a list of ApplicationReports that match the givenGetApplicationsRequest.Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,List<org.apache.hadoop.yarn.api.records.NodeToAttributeValue>> getAttributesToNodes(Set<org.apache.hadoop.yarn.api.records.NodeAttributeKey> attributes) The interface used by client to get mapping of AttributeKey to associated NodeToAttributeValue list for specified node attributeKeys in the cluster.List<org.apache.hadoop.yarn.api.records.QueueInfo>getChildQueueInfos(String parent) Get information (QueueInfo) about all the immediate children queues of the given queueSet<org.apache.hadoop.yarn.api.records.NodeAttributeInfo>The interface used by client to get node attributes in the cluster.List<org.apache.hadoop.yarn.api.records.NodeLabel>The interface used by client to get node labels in the clusterorg.apache.hadoop.yarn.api.records.ContainerReportgetContainerReport(org.apache.hadoop.yarn.api.records.ContainerId containerId) Get a report of the given Container.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.The interface used by client to get labels to nodes mapping in existing clustergetLabelsToNodes(Set<String> labels) The interface used by client to get labels to nodes mapping for specified labels in existing clusterList<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.getNodeToAttributes(Set<String> hostNames) The interface used by client to get all node to attribute mapping in existing cluster.The interface used by client to get node to labels mappings in existing clusterList<org.apache.hadoop.yarn.api.records.QueueUserACLInfo>Get information about acls for current user on all the existing queues.org.apache.hadoop.yarn.api.records.QueueInfogetQueueInfo(String queueName) Get information (QueueInfo) about a given queue.org.apache.hadoop.yarn.api.records.QueueInfogetQueueInfo(String queueName, String subClusterId) Get information (QueueInfo) about a given queue.org.apache.hadoop.yarn.api.records.ResourcegetResourceProfile(String profile) Get the details of a specific resource profile from the RM.Get the resource profiles available in the RM.List<org.apache.hadoop.yarn.api.records.ResourceTypeInfo>Get available resource types supported by RM.org.apache.hadoop.yarn.api.records.TokengetRMDelegationToken(org.apache.hadoop.io.Text renewer) Get a delegation token so as to be able to talk to YARN using those tokens.List<org.apache.hadoop.yarn.api.records.QueueInfo>Get information (QueueInfo) about top level queues.org.apache.hadoop.yarn.api.records.YarnClusterMetricsGet metrics (YarnClusterMetrics) about the cluster.protected booleanvoidkillApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) Kill an application identified by given ID.voidkillApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String diagnostics) Kill an application identified by given ID.org.apache.hadoop.yarn.api.protocolrecords.ReservationListResponselistReservations(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest request) The interface used by clients to get the list of reservations in a plan.voidmoveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId, String queue) Attempts to move the given application to the given queue.protected voidserviceInit(org.apache.hadoop.conf.Configuration conf) protected voidprotected voidvoidsetRMClient(org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient) voidshellToContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.ShellContainerCommand command) The interface used by client to get a shell to a container.voidsignalToContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.SignalContainerCommand command) Signal a container identified by given ID.org.apache.hadoop.yarn.api.records.ApplicationIdsubmitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext) Submit a new application toYARN.It is a blocking call - it will not returnApplicationIduntil the submitted application is submitted successfully and accepted by the ResourceManager.org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponsesubmitReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request) The interface used by clients to submit a new reservation to theResourceManager.org.apache.hadoop.yarn.api.records.PriorityupdateApplicationPriority(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.yarn.api.records.Priority priority) The interface used by client to set priority of an applicationorg.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponseupdateApplicationTimeouts(org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest request) org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponseupdateReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest request) The interface used by clients to update an existing Reservation.Methods inherited from class org.apache.hadoop.yarn.client.api.YarnClient
createYarnClientMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
rmClient
protected org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient -
submitPollIntervalMillis
protected long submitPollIntervalMillis -
historyClient
-
timelineClient
protected volatile org.apache.hadoop.yarn.client.api.TimelineClient timelineClient -
timelineServiceBestEffort
protected boolean timelineServiceBestEffort
-
-
Constructor Details
-
YarnClientImpl
public YarnClientImpl()
-
-
Method Details
-
serviceInit
- Overrides:
serviceInitin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStart
- Overrides:
serviceStartin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
createApplication
public YarnClientApplication createApplication() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientObtain a
YarnClientApplicationfor a new application, which in turn contains theApplicationSubmissionContextandGetNewApplicationResponseobjects.- Specified by:
createApplicationin classYarnClient- Returns:
YarnClientApplicationbuilt for a new application- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
submitApplication
public org.apache.hadoop.yarn.api.records.ApplicationId submitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appContext) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientSubmit a new application to
YARN.It is a blocking call - it will not returnApplicationIduntil the submitted application is submitted successfully and accepted by the ResourceManager.Users should provide an
ApplicationIdas part of the parameterApplicationSubmissionContextwhen submitting a new application, otherwise it will throw theApplicationIdNotProvidedException.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 theApplicationNotFoundException. This API automatically resubmits the application with the sameApplicationSubmissionContextwhen it catches theApplicationNotFoundException- Specified by:
submitApplicationin classYarnClient- Parameters:
appContext-ApplicationSubmissionContextcontaining all the details needed to submit a new application- Returns:
ApplicationIdof the accepted application- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException- See Also:
-
isSecurityEnabled
@Private @VisibleForTesting protected boolean isSecurityEnabled() -
failApplicationAttempt
public void failApplicationAttempt(org.apache.hadoop.yarn.api.records.ApplicationAttemptId attemptId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientFail an application attempt identified by given ID.
- Specified by:
failApplicationAttemptin classYarnClient- Parameters:
attemptId-ApplicationAttemptIdof the attempt to fail.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- in case of errors or if YARN rejects the request due to access-control restrictions.IOException- See Also:
-
killApplication
public void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientKill an application identified by given ID.
- Specified by:
killApplicationin classYarnClient- Parameters:
applicationId-ApplicationIdof the application that needs to be killed- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- in case of errors or if YARN rejects the request due to access-control restrictions.IOException- See Also:
-
killApplication
public void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, String diagnostics) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientKill an application identified by given ID.
- Specified by:
killApplicationin classYarnClient- Parameters:
applicationId-ApplicationIdof the application that needs to be killeddiagnostics- for killing an application.- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- in case of errors or if YARN rejects the request due to access-control restrictions.IOException
-
getApplicationReport
public org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report of the given Application.
In secure mode,
YARNverifies access to the application, queue etc. before accepting the request.If the user does not have
VIEW_APPaccess then the following fields in the report will be set to stubbed values:- host - set to "N/A"
- RPC port - set to -1
- client token - set to "N/A"
- diagnostics - set to "N/A"
- tracking URL - set to "N/A"
- original tracking URL - set to "N/A"
- resource usage report - all values are -1
- Specified by:
getApplicationReportin classYarnClient- Parameters:
appId-ApplicationIdof the application that needs a report- Returns:
- application report
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getAMRMToken
public 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 Description copied from class:YarnClientGet the AMRM token of the application.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
UserGroupInformationof the current user.The AMRM token will be returned only if all the following conditions are met:
- the requester is the owner of the ApplicationMaster
- the application master is an unmanaged ApplicationMaster
- the application master is in ACCEPTED state
- Specified by:
getAMRMTokenin classYarnClient- Parameters:
appId-ApplicationIdof the application to get the AMRM token- Returns:
- the AMRM token if available
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet a report (ApplicationReport) of all Applications in the cluster.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Returns:
- a list of reports of all running applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> applicationTypes) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report (ApplicationReport) of Applications matching the given application types in the cluster.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Parameters:
applicationTypes- set of application types you are interested in- Returns:
- a list of reports of applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public 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 Description copied from class:YarnClientGet a report (ApplicationReport) of Applications matching the given application states in the cluster.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Parameters:
applicationStates- set of application states you are interested in- Returns:
- a list of reports of applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public 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 Description copied from class:YarnClientGet a report (ApplicationReport) of Applications matching the given application types and application states in the cluster.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Parameters:
applicationTypes- set of application types you are interested inapplicationStates- set of application states you are interested in- Returns:
- a list of reports of applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> applicationTypes, EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates, Set<String> applicationTags) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report (ApplicationReport) of Applications matching the given application types, application states and application tags in the cluster.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Parameters:
applicationTypes- set of application types you are interested inapplicationStates- set of application states you are interested inapplicationTags- set of application tags you are interested in- Returns:
- a list of reports of applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> queues, Set<String> users, Set<String> applicationTypes, EnumSet<org.apache.hadoop.yarn.api.records.YarnApplicationState> applicationStates) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report (ApplicationReport) of Applications matching the given users, queues, application types and application states in the cluster. If any of the params is set to null, it is not used when filtering.
If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Specified by:
getApplicationsin classYarnClient- Parameters:
queues- set of queues you are interested inusers- set of users you are interested inapplicationTypes- set of application types you are interested inapplicationStates- set of application states you are interested in- Returns:
- a list of reports of applications
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getApplications
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a list of ApplicationReports that match the given
GetApplicationsRequest.If the user does not have
VIEW_APPaccess for an application then the corresponding report will be filtered as described inYarnClient.getApplicationReport(ApplicationId).- Overrides:
getApplicationsin classYarnClient- Parameters:
request- the request object to get the list of applications.- Returns:
- The list of ApplicationReports that match the request
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- Exception specific to YARN.IOException- Exception mostly related to connection errors.
-
getYarnClusterMetrics
public org.apache.hadoop.yarn.api.records.YarnClusterMetrics getYarnClusterMetrics() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet metrics (
YarnClusterMetrics) about the cluster.- Specified by:
getYarnClusterMetricsin classYarnClient- Returns:
- cluster metrics
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getNodeReports
public 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 Description copied from class:YarnClientGet a report of nodes (
NodeReport) in the cluster.- Specified by:
getNodeReportsin classYarnClient- Parameters:
states- TheNodeStates to filter on. If no filter states are given, nodes in all states will be returned.- Returns:
- A list of node reports
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getRMDelegationToken
public org.apache.hadoop.yarn.api.records.Token getRMDelegationToken(org.apache.hadoop.io.Text renewer) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a delegation token so as to be able to talk to YARN using those tokens.
- Specified by:
getRMDelegationTokenin classYarnClient- Parameters:
renewer- Address of the renewer who can renew these tokens when needed by securely talking to YARN.- Returns:
- a delegation token (
Token) that can be used to talk to YARN - Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getQueueInfo
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet information (
QueueInfo) about a given queue.- Specified by:
getQueueInfoin classYarnClient- Parameters:
queueName- Name of the queue whose information is needed- Returns:
- queue information
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- in case of errors or if YARN rejects the request due to access-control restrictions.IOException- I/O exception has occurred.
-
getQueueInfo
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName, String subClusterId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet information (
QueueInfo) about a given queue.- Specified by:
getQueueInfoin classYarnClient- Parameters:
queueName- Name of the queue whose information is needed.subClusterId- sub-cluster Id.- Returns:
- queue information.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- in case of errors or if YARN rejects the request due to access-control restrictions.IOException- I/O exception has occurred.
-
getQueueAclsInfo
public List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueAclsInfo() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet information about acls for current user on all the existing queues.
- Specified by:
getQueueAclsInfoin classYarnClient- Returns:
- a list of queue acls (
QueueUserACLInfo) for current user - Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getAllQueues
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getAllQueues() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet information (
QueueInfo) about all queues, recursively if there is a hierarchy- Specified by:
getAllQueuesin classYarnClient- Returns:
- a list of queue-information for all queues
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getRootQueueInfos
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getRootQueueInfos() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet information (
QueueInfo) about top level queues.- Specified by:
getRootQueueInfosin classYarnClient- Returns:
- a list of queue-information for all the top-level queues
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getChildQueueInfos
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getChildQueueInfos(String parent) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet information (
QueueInfo) about all the immediate children queues of the given queue- Specified by:
getChildQueueInfosin classYarnClient- Parameters:
parent- Name of the queue whose child-queues' information is needed- Returns:
- a list of queue-information for all queues who are direct children of the given parent queue.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
setRMClient
@Private @VisibleForTesting public void setRMClient(org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient) -
getApplicationAttemptReport
public org.apache.hadoop.yarn.api.records.ApplicationAttemptReport getApplicationAttemptReport(org.apache.hadoop.yarn.api.records.ApplicationAttemptId appAttemptId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report of the given ApplicationAttempt.
In secure mode,
YARNverifies access to the application, queue etc. before accepting the request.- Specified by:
getApplicationAttemptReportin classYarnClient- Parameters:
appAttemptId-ApplicationAttemptIdof the application attempt that needs a report- Returns:
- application attempt report
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionorg.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException- if application attempt not foundIOException
-
getApplicationAttempts
public List<org.apache.hadoop.yarn.api.records.ApplicationAttemptReport> getApplicationAttempts(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report of all (ApplicationAttempts) of Application in the cluster.
- Specified by:
getApplicationAttemptsin classYarnClient- Parameters:
appId- application id of the app- Returns:
- a list of reports for all application attempts for specified application.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getContainerReport
public org.apache.hadoop.yarn.api.records.ContainerReport getContainerReport(org.apache.hadoop.yarn.api.records.ContainerId containerId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet a report of the given Container.
In secure mode,
YARNverifies access to the application, queue etc. before accepting the request.- Specified by:
getContainerReportin classYarnClient- Parameters:
containerId-ContainerIdof the container that needs a report- Returns:
- container report
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionorg.apache.hadoop.yarn.exceptions.ContainerNotFoundException- if container not found.IOException
-
getContainers
public 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 Description copied from class:YarnClientGet a report of all (Containers) of ApplicationAttempt in the cluster.
- Specified by:
getContainersin classYarnClient- Parameters:
applicationAttemptId- application attempt id- Returns:
- a list of reports of all containers for specified application attempts
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
moveApplicationAcrossQueues
public void moveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId, String queue) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientAttempts to move the given application to the given queue.
- Specified by:
moveApplicationAcrossQueuesin classYarnClient- Parameters:
appId- Application to move.queue- Queue to place it in to.- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
createReservation
public org.apache.hadoop.yarn.api.protocolrecords.GetNewReservationResponse createReservation() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientObtain a
GetNewReservationResponsefor a new reservation, which contains theReservationIdobject.- Specified by:
createReservationin classYarnClient- Returns:
- The
GetNewReservationResponsecontaining a newReservationIdobject. - Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if reservation cannot be created.IOException- if reservation cannot be created.
-
submitReservation
public org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse submitReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by clients to submit a new reservation to the
ResourceManager.The client packages all details of its request in a
ReservationSubmissionRequestobject. 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
ResourceManagerperforms 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 theResourceManageranswers with aReservationSubmissionResponsethat includes aReservationId. 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
ReservationIdreturned, 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 theReservationDefinition- Specified by:
submitReservationin classYarnClient- Parameters:
request- request to submit a new Reservation- Returns:
- response contains the
ReservationIdon accepting the submission - Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the reservation cannot be created successfullyIOException
-
updateReservation
public org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse updateReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class: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.- Specified by:
updateReservationin classYarnClient- Parameters:
request- to update an existing Reservation (theReservationUpdateRequestshould refer to an existing validReservationId)- Returns:
- response empty on successfully updating the existing reservation
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the request is invalid or reservation cannot be updated successfullyIOException
-
deleteReservation
public org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteResponse deleteReservation(org.apache.hadoop.yarn.api.protocolrecords.ReservationDeleteRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by clients to remove an existing Reservation.
- Specified by:
deleteReservationin classYarnClient- Parameters:
request- to remove an existing Reservation (theReservationDeleteRequestshould refer to an existing validReservationId)- Returns:
- response empty on successfully deleting the existing reservation
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the request is invalid or reservation cannot be deleted successfullyIOException
-
listReservations
public org.apache.hadoop.yarn.api.protocolrecords.ReservationListResponse listReservations(org.apache.hadoop.yarn.api.protocolrecords.ReservationListRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by clients to get the list of reservations in a plan. The reservationId will be used to search for reservations to list if it is provided. Otherwise, it will select active reservations within the startTime and endTime (inclusive).
- Specified by:
listReservationsin classYarnClient- Parameters:
request- to list reservations in a plan. Contains fields to select String queue, ReservationId reservationId, long startTime, long endTime, and a bool includeReservationAllocations. queue: Required. Cannot be null or empty. Refers to the reservable queue in the scheduler that was selected when creating a reservation submissionReservationSubmissionRequest. reservationId: Optional. If provided, other fields will be ignored. startTime: Optional. If provided, only reservations that end after the startTime will be selected. This defaults to 0 if an invalid number is used. endTime: Optional. If provided, only reservations that start on or before endTime will be selected. This defaults to Long.MAX_VALUE if an invalid number is used. includeReservationAllocations: Optional. Flag that determines whether the entire reservation allocations are to be returned. Reservation allocations are subject to change in the event of re-planning as described byReservationDefinition.- Returns:
- response that contains information about reservations that are being searched for.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if the request is invalidIOException- if the request failed otherwise
-
getNodeToLabels
public Map<org.apache.hadoop.yarn.api.records.NodeId,Set<String>> getNodeToLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientThe interface used by client to get node to labels mappings in existing cluster
- Specified by:
getNodeToLabelsin classYarnClient- Returns:
- node to labels mappings
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getLabelsToNodes
public Map<String,Set<org.apache.hadoop.yarn.api.records.NodeId>> getLabelsToNodes() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientThe interface used by client to get labels to nodes mapping in existing cluster
- Specified by:
getLabelsToNodesin classYarnClient- Returns:
- node to labels mappings
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getLabelsToNodes
public Map<String,Set<org.apache.hadoop.yarn.api.records.NodeId>> getLabelsToNodes(Set<String> labels) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by client to get labels to nodes mapping for specified labels in existing cluster
- Specified by:
getLabelsToNodesin classYarnClient- Parameters:
labels- labels for which labels to nodes mapping has to be retrieved- Returns:
- labels to nodes mappings for specific labels
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getClusterNodeLabels
public List<org.apache.hadoop.yarn.api.records.NodeLabel> getClusterNodeLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientThe interface used by client to get node labels in the cluster
- Specified by:
getClusterNodeLabelsin classYarnClient- Returns:
- cluster node labels collection
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- when there is a failure inApplicationClientProtocolIOException- when there is a failure inApplicationClientProtocol
-
updateApplicationPriority
public org.apache.hadoop.yarn.api.records.Priority updateApplicationPriority(org.apache.hadoop.yarn.api.records.ApplicationId applicationId, org.apache.hadoop.yarn.api.records.Priority priority) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by client to set priority of an application
- Specified by:
updateApplicationPriorityin classYarnClient- Returns:
- updated priority of an application.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
signalToContainer
public void signalToContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.SignalContainerCommand command) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientSignal a container identified by given ID.
- Specified by:
signalToContainerin classYarnClient- Parameters:
containerId-ContainerIdof the container that needs to be signaledcommand- the signal container command- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
updateApplicationTimeouts
public org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse updateApplicationTimeouts(org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest request) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException - Overrides:
updateApplicationTimeoutsin classYarnClient- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getResourceProfiles
public Map<String,org.apache.hadoop.yarn.api.records.Resource> getResourceProfiles() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet the resource profiles available in the RM.
- Specified by:
getResourceProfilesin classYarnClient- Returns:
- a Map of the resource profile names to their capabilities
- Throws:
org.apache.hadoop.yarn.exceptions.YARNFeatureNotEnabledException- if resource-profile is disabledorg.apache.hadoop.yarn.exceptions.YarnException- if any error happens inside YARNIOException- in case of other errors
-
getResourceProfile
public org.apache.hadoop.yarn.api.records.Resource getResourceProfile(String profile) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientGet the details of a specific resource profile from the RM.
- Specified by:
getResourceProfilein classYarnClient- Parameters:
profile- the profile name- Returns:
- resource profile name with its capabilities
- Throws:
org.apache.hadoop.yarn.exceptions.YARNFeatureNotEnabledException- if resource-profile is disabledorg.apache.hadoop.yarn.exceptions.YarnException- if any error happens inside YARNIOException- in case of other others
-
getResourceTypeInfo
public List<org.apache.hadoop.yarn.api.records.ResourceTypeInfo> getResourceTypeInfo() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientGet available resource types supported by RM.
- Specified by:
getResourceTypeInfoin classYarnClient- Returns:
- list of supported resource types with detailed information
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- if any issue happens inside YARNIOException- in case of other others
-
getClusterAttributes
public Set<org.apache.hadoop.yarn.api.records.NodeAttributeInfo> getClusterAttributes() throws org.apache.hadoop.yarn.exceptions.YarnException, IOExceptionDescription copied from class:YarnClientThe interface used by client to get node attributes in the cluster.
- Specified by:
getClusterAttributesin classYarnClient- Returns:
- cluster node attributes collection
- Throws:
org.apache.hadoop.yarn.exceptions.YarnException- when there is a failure inApplicationClientProtocolIOException- when there is a failure inApplicationClientProtocol
-
getAttributesToNodes
public Map<org.apache.hadoop.yarn.api.records.NodeAttributeKey,List<org.apache.hadoop.yarn.api.records.NodeToAttributeValue>> getAttributesToNodes(Set<org.apache.hadoop.yarn.api.records.NodeAttributeKey> attributes) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by client to get mapping of AttributeKey to associated NodeToAttributeValue list for specified node attributeKeys in the cluster.
- Specified by:
getAttributesToNodesin classYarnClient- Parameters:
attributes- AttributeKeys for which associated NodeToAttributeValue mapping value has to be retrieved. If empty or null is set then will return mapping for all attributeKeys in the cluster- Returns:
- mapping of AttributeKey to List of associated NodeToAttributeValue's.
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
getNodeToAttributes
public Map<String,Set<org.apache.hadoop.yarn.api.records.NodeAttribute>> getNodeToAttributes(Set<String> hostNames) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException Description copied from class:YarnClientThe interface used by client to get all node to attribute mapping in existing cluster.
- Specified by:
getNodeToAttributesin classYarnClient- Parameters:
hostNames- HostNames for which host to attributes mapping has to be retrived.If empty or null is set then will return all nodes to attributes mapping in cluster.- Returns:
- Node to attribute mappings
- Throws:
org.apache.hadoop.yarn.exceptions.YarnExceptionIOException
-
shellToContainer
public void shellToContainer(org.apache.hadoop.yarn.api.records.ContainerId containerId, org.apache.hadoop.yarn.api.records.ShellContainerCommand command) throws IOException Description copied from class:YarnClientThe interface used by client to get a shell to a container.
- Specified by:
shellToContainerin classYarnClient- Parameters:
containerId- Container IDcommand- Shell type- Throws:
IOException- if connection fails.
-