@InterfaceAudience.Private @InterfaceStability.Unstable public class YarnClientImpl extends YarnClient
Modifier and Type | Field and Description |
---|---|
protected AHSClient |
historyClient |
protected org.apache.hadoop.yarn.api.ApplicationClientProtocol |
rmClient |
protected long |
submitPollIntervalMillis |
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. |
List<org.apache.hadoop.yarn.api.records.QueueInfo> |
getAllQueues()
Get information (
QueueInfo ) about all queues, recursively if there
is a hierarchy |
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.
|
org.apache.hadoop.yarn.api.records.ApplicationAttemptReport |
getApplicationAttemptReport(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.ApplicationReport |
getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId appId)
Get a report of the given Application.
|
List<org.apache.hadoop.yarn.api.records.ApplicationReport> |
getApplications()
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.QueueInfo> |
getChildQueueInfos(String parent)
Get information (
QueueInfo ) about all the immediate children queues
of the given queue |
List<org.apache.hadoop.yarn.api.records.NodeToLabelsList> |
getClusterNodeLabels()
Get labels for nodes in the cluster
|
org.apache.hadoop.yarn.api.records.ContainerReport |
getContainerReport(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.
|
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. |
List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> |
getQueueAclsInfo()
Get information about acls for current user on all the
existing queues.
|
org.apache.hadoop.yarn.api.records.QueueInfo |
getQueueInfo(String queueName)
Get information (
QueueInfo ) about a given queue. |
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.
|
List<org.apache.hadoop.yarn.api.records.QueueInfo> |
getRootQueueInfos()
Get information (
QueueInfo ) about top level queues. |
org.apache.hadoop.yarn.api.records.YarnClusterMetrics |
getYarnClusterMetrics()
Get metrics (
YarnClusterMetrics ) about the cluster. |
void |
killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Kill an application identified by given ID.
|
void |
moveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId,
String queue)
Attempts to move the given application to the given queue.
|
boolean |
refreshClusterNodeLabels()
Refresh labels for nodes in the cluster
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf) |
protected void |
serviceStart() |
protected void |
serviceStop() |
void |
setRMClient(org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient) |
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. |
createYarnClient
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
protected org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient
protected long submitPollIntervalMillis
protected AHSClient historyClient
protected void serviceInit(org.apache.hadoop.conf.Configuration conf) throws Exception
serviceInit
in class org.apache.hadoop.service.AbstractService
Exception
protected void serviceStart() throws Exception
serviceStart
in class org.apache.hadoop.service.AbstractService
Exception
protected void serviceStop() throws Exception
serviceStop
in class org.apache.hadoop.service.AbstractService
Exception
public YarnClientApplication createApplication() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Obtain a YarnClientApplication
for a new application,
which in turn contains the ApplicationSubmissionContext
and
GetNewApplicationResponse
objects.
createApplication
in class YarnClient
YarnClientApplication
built for a new applicationorg.apache.hadoop.yarn.exceptions.YarnException
IOException
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
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 YarnClient
appContext
- ApplicationSubmissionContext
containing all the details
needed to submit a new applicationApplicationId
of the accepted applicationorg.apache.hadoop.yarn.exceptions.YarnException
IOException
YarnClient.createApplication()
public void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Kill an application identified by given ID.
killApplication
in class YarnClient
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.IOException
YarnClient.getQueueAclsInfo()
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
YarnClient
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:
getApplicationReport
in class YarnClient
appId
- ApplicationId
of the application that needs a reportorg.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
UserGroupInformation
of the
current user.
The AMRM token will be returned only if all the following conditions are
met:
getAMRMToken
in class YarnClient
appId
- ApplicationId
of the application to get the AMRM tokenorg.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
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
YarnClient.getApplicationReport(ApplicationId)
.
getApplications
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.ApplicationReport> getApplications(Set<String> applicationTypes) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
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
YarnClient.getApplicationReport(ApplicationId)
.
getApplications
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
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
YarnClient.getApplicationReport(ApplicationId)
.
getApplications
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
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
YarnClient.getApplicationReport(ApplicationId)
.
getApplications
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public org.apache.hadoop.yarn.api.records.YarnClusterMetrics getYarnClusterMetrics() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get metrics (YarnClusterMetrics
) about the cluster.
getYarnClusterMetrics
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
Get a report of nodes (NodeReport
) in the cluster.
getNodeReports
in class YarnClient
states
- The NodeState
s to filter on. If no filter states are
given, nodes in all states will be returned.org.apache.hadoop.yarn.exceptions.YarnException
IOException
public org.apache.hadoop.yarn.api.records.Token getRMDelegationToken(org.apache.hadoop.io.Text renewer) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get a delegation token so as to be able to talk to YARN using those tokens.
getRMDelegationToken
in class YarnClient
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.YarnException
IOException
public org.apache.hadoop.yarn.api.records.QueueInfo getQueueInfo(String queueName) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get information (QueueInfo
) about a given queue.
getQueueInfo
in class YarnClient
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.IOException
public List<org.apache.hadoop.yarn.api.records.QueueUserACLInfo> getQueueAclsInfo() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get information about acls for current user on all the existing queues.
getQueueAclsInfo
in class YarnClient
QueueUserACLInfo
) for
current userorg.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getAllQueues() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get information (QueueInfo
) about all queues, recursively if there
is a hierarchy
getAllQueues
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getRootQueueInfos() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get information (QueueInfo
) about top level queues.
getRootQueueInfos
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.QueueInfo> getChildQueueInfos(String parent) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get information (QueueInfo
) about all the immediate children queues
of the given queue
getChildQueueInfos
in class YarnClient
parent
- Name of the queue whose child-queues' information is neededorg.apache.hadoop.yarn.exceptions.YarnException
IOException
@InterfaceAudience.Private public void setRMClient(org.apache.hadoop.yarn.api.ApplicationClientProtocol rmClient)
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
YarnClient
Get a report of the given ApplicationAttempt.
In secure mode, YARN
verifies access to the application, queue
etc. before accepting the request.
getApplicationAttemptReport
in class YarnClient
appAttemptId
- ApplicationAttemptId
of the application attempt that needs
a reportorg.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
Get a report of all (ApplicationAttempts) of Application in the cluster.
getApplicationAttempts
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
Get a report of the given Container.
In secure mode, YARN
verifies access to the application, queue
etc. before accepting the request.
getContainerReport
in class YarnClient
containerId
- ContainerId
of the container that needs a reportorg.apache.hadoop.yarn.exceptions.YarnException
IOException
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
YarnClient
Get a report of all (Containers) of ApplicationAttempt in the cluster.
getContainers
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public void moveApplicationAcrossQueues(org.apache.hadoop.yarn.api.records.ApplicationId appId, String queue) throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Attempts to move the given application to the given queue.
moveApplicationAcrossQueues
in class YarnClient
appId
- Application to move.queue
- Queue to place it in to.org.apache.hadoop.yarn.exceptions.YarnException
IOException
public List<org.apache.hadoop.yarn.api.records.NodeToLabelsList> getClusterNodeLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Get labels for nodes in the cluster
getClusterNodeLabels
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
public boolean refreshClusterNodeLabels() throws org.apache.hadoop.yarn.exceptions.YarnException, IOException
YarnClient
Refresh labels for nodes in the cluster
refreshClusterNodeLabels
in class YarnClient
org.apache.hadoop.yarn.exceptions.YarnException
IOException
Copyright © 2014 Apache Software Foundation. All Rights Reserved.