@InterfaceAudience.Private @InterfaceStability.Unstable public class YarnClientImpl extends YarnClient
Service.STATE
Modifier and Type | Field and Description |
---|---|
protected InetSocketAddress |
rmAddress |
protected ApplicationClientProtocol |
rmClient |
protected long |
statePollIntervalMillis |
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<QueueInfo> |
getAllQueues()
Get information (
QueueInfo ) about all queues, recursively if there
is a hierarchy |
Token<AMRMTokenIdentifier> |
getAMRMToken(ApplicationId appId)
Get the AMRM token of the application.
|
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 |
List<NodeReport> |
getNodeReports(NodeState... states)
Get a report of nodes (
NodeReport ) in the 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. |
void |
killApplication(ApplicationId applicationId)
Kill an application identified by given ID.
|
protected void |
serviceInit(Configuration conf)
All initialization code needed by a service.
|
protected void |
serviceStart()
Actions called during the INITED to STARTED transition.
|
protected void |
serviceStop()
Actions called during the transition to the STOPPED state.
|
void |
setRMClient(ApplicationClientProtocol rmClient) |
ApplicationId |
submitApplication(ApplicationSubmissionContext appContext)
Submit a new application to
YARN. It is a blocking call, such
that it will not return ApplicationId until the submitted
application has been submitted 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 ApplicationClientProtocol rmClient
protected InetSocketAddress rmAddress
protected long statePollIntervalMillis
protected void serviceInit(Configuration conf) throws Exception
AbstractService
AbstractService.init(Configuration)
prevents re-entrancy.
The base implementation checks to see if the subclass has created
a new configuration instance, and if so, updates the base class valueserviceInit
in class AbstractService
conf
- configurationException
- on a failure -these will be caught,
possibly wrapped, and wil; trigger a service stopprotected void serviceStart() throws Exception
AbstractService
AbstractService.start()
prevents re-entrancy.serviceStart
in class AbstractService
Exception
- if needed -these will be caught,
wrapped, and trigger a service stopprotected void serviceStop() throws Exception
AbstractService
AbstractService.stop()
prevents re-entrancy.
Implementations MUST write this to be robust against failures, including
checks for null references -and for the first failure to not stop other
attempts to shut down parts of the service.serviceStop
in class AbstractService
Exception
- if needed -these will be caught and logged.public 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 YarnClient
YarnClientApplication
built for a new applicationYarnException
IOException
public ApplicationId submitApplication(ApplicationSubmissionContext appContext) throws YarnException, IOException
YarnClient
Submit a new application to YARN.
It is a blocking call, such
that it will not return ApplicationId
until the submitted
application has been submitted and accepted by the ResourceManager.
submitApplication
in class YarnClient
appContext
- ApplicationSubmissionContext
containing all the details
needed to submit a new applicationApplicationId
of the accepted applicationYarnException
IOException
YarnClient.createApplication()
public void killApplication(ApplicationId applicationId) throws YarnException, IOException
YarnClient
Kill an application identified by given ID.
killApplication
in class YarnClient
applicationId
- ApplicationId
of the application that needs to be killedYarnException
- in case of errors or if YARN rejects the request due to
access-control restrictions.IOException
YarnClient.getQueueAclsInfo()
public ApplicationReport getApplicationReport(ApplicationId appId) throws 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 reportYarnException
IOException
public Token<AMRMTokenIdentifier> getAMRMToken(ApplicationId appId) throws 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 tokenYarnException
IOException
public List<ApplicationReport> getApplications() throws 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
YarnException
IOException
public List<ApplicationReport> getApplications(Set<String> applicationTypes) throws 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
YarnException
IOException
public List<ApplicationReport> getApplications(EnumSet<YarnApplicationState> applicationStates) throws 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
YarnException
IOException
public List<ApplicationReport> getApplications(Set<String> applicationTypes, EnumSet<YarnApplicationState> applicationStates) throws 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
YarnException
IOException
public YarnClusterMetrics getYarnClusterMetrics() throws YarnException, IOException
YarnClient
Get metrics (YarnClusterMetrics
) about the cluster.
getYarnClusterMetrics
in class YarnClient
YarnException
IOException
public List<NodeReport> getNodeReports(NodeState... states) throws 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.YarnException
IOException
public Token getRMDelegationToken(Text renewer) throws 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 YARNYarnException
IOException
public QueueInfo getQueueInfo(String queueName) throws YarnException, IOException
YarnClient
Get information (QueueInfo
) about a given queue.
getQueueInfo
in class YarnClient
queueName
- Name of the queue whose information is neededYarnException
- in case of errors or if YARN rejects the request due to
access-control restrictions.IOException
public List<QueueUserACLInfo> getQueueAclsInfo() throws YarnException, IOException
YarnClient
Get information about acls for current user on all the existing queues.
getQueueAclsInfo
in class YarnClient
QueueUserACLInfo
) for
current userYarnException
IOException
public List<QueueInfo> getAllQueues() throws YarnException, IOException
YarnClient
Get information (QueueInfo
) about all queues, recursively if there
is a hierarchy
getAllQueues
in class YarnClient
YarnException
IOException
public List<QueueInfo> getRootQueueInfos() throws YarnException, IOException
YarnClient
Get information (QueueInfo
) about top level queues.
getRootQueueInfos
in class YarnClient
YarnException
IOException
public 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 YarnClient
parent
- Name of the queue whose child-queues' information is neededYarnException
IOException
@InterfaceAudience.Private public void setRMClient(ApplicationClientProtocol rmClient)
Copyright © 2013 Apache Software Foundation. All rights reserved.