org.apache.hadoop.yarn.client
Class YarnClientImpl

java.lang.Object
  extended by org.apache.hadoop.yarn.service.AbstractService
      extended by org.apache.hadoop.yarn.client.YarnClientImpl
All Implemented Interfaces:
YarnClient, org.apache.hadoop.yarn.service.Service
Direct Known Subclasses:
Client

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class YarnClientImpl
extends org.apache.hadoop.yarn.service.AbstractService
implements YarnClient


Field Summary
protected  InetSocketAddress rmAddress
           
protected  ClientRMProtocol rmClient
           
 
Constructor Summary
YarnClientImpl()
           
 
Method Summary
 List<QueueInfo> getAllQueues()
           Get information (QueueInfo) about all queues, recursively if there is a hierarchy
 List<ApplicationReport> getApplicationList()
           Get a report (ApplicationReport) of all Applications in the cluster.
 ApplicationReport getApplicationReport(ApplicationId appId)
           Get a report of the given Application.
 List<QueueInfo> getChildQueueInfos(String parent)
           Get information (QueueInfo) about all the immediate children queues of the given queue
 GetNewApplicationResponse getNewApplication()
           Obtain a new ApplicationId for submitting new applications.
 List<NodeReport> getNodeReports()
           Get a report of all 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.
 DelegationToken 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 init(Configuration conf)
          Initialize the service.
 void killApplication(ApplicationId applicationId)
           Kill an application identified by given ID.
 void start()
          Start the service.
 void stop()
          Stop the service.
 ApplicationId submitApplication(ApplicationSubmissionContext appContext)
           Submit a new application to YARN.
 
Methods inherited from class org.apache.hadoop.yarn.service.AbstractService
getConfig, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.hadoop.yarn.service.Service
getConfig, getName, getServiceState, getStartTime, register, unregister
 

Field Detail

rmClient

protected ClientRMProtocol rmClient

rmAddress

protected InetSocketAddress rmAddress
Constructor Detail

YarnClientImpl

public YarnClientImpl()
Method Detail

init

public void init(Configuration conf)
Description copied from class: org.apache.hadoop.yarn.service.AbstractService
Initialize the service. The transition must be from Service.STATE.NOTINITED to Service.STATE.INITED unless the operation failed and an exception was raised.

Specified by:
init in interface org.apache.hadoop.yarn.service.Service
Overrides:
init in class org.apache.hadoop.yarn.service.AbstractService
Parameters:
conf - the configuration of the service

start

public void start()
Description copied from class: org.apache.hadoop.yarn.service.AbstractService
Start the service. The transition should be from Service.STATE.INITED to Service.STATE.STARTED unless the operation failed and an exception was raised.

Specified by:
start in interface org.apache.hadoop.yarn.service.Service
Overrides:
start in class org.apache.hadoop.yarn.service.AbstractService

stop

public void stop()
Description copied from class: org.apache.hadoop.yarn.service.AbstractService
Stop the service. This operation must be designed to complete regardless of the initial state of the service, including the state of all its internal fields.

Specified by:
stop in interface org.apache.hadoop.yarn.service.Service
Overrides:
stop in class org.apache.hadoop.yarn.service.AbstractService

getNewApplication

public GetNewApplicationResponse getNewApplication()
                                            throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Obtain a new ApplicationId for submitting new applications.

Returns a response which contains ApplicationId that can be used to submit a new application. See YarnClient.submitApplication(ApplicationSubmissionContext).

See GetNewApplicationResponse for other information that is returned.

Specified by:
getNewApplication in interface YarnClient
Returns:
response containing the new ApplicationId to be used to submit an application
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

submitApplication

public ApplicationId submitApplication(ApplicationSubmissionContext appContext)
                                throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Submit a new application to YARN.

Specified by:
submitApplication in interface YarnClient
Parameters:
appContext - ApplicationSubmissionContext containing all the details needed to submit a new application
Returns:
ApplicationId of the accepted application
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException
See Also:
YarnClient.getNewApplication()

killApplication

public void killApplication(ApplicationId applicationId)
                     throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Kill an application identified by given ID.

Specified by:
killApplication in interface YarnClient
Parameters:
applicationId - ApplicationId of the application that needs to be killed
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException - in case of errors or if YARN rejects the request due to access-control restrictions.
See Also:
YarnClient.getQueueAclsInfo()

getApplicationReport

public ApplicationReport getApplicationReport(ApplicationId appId)
                                       throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: 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:

Specified by:
getApplicationReport in interface YarnClient
Parameters:
appId - ApplicationId of the application that needs a report
Returns:
application report
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getApplicationList

public List<ApplicationReport> getApplicationList()
                                           throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: 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).

Specified by:
getApplicationList in interface YarnClient
Returns:
a list of reports of all running applications
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getYarnClusterMetrics

public YarnClusterMetrics getYarnClusterMetrics()
                                         throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get metrics (YarnClusterMetrics) about the cluster.

Specified by:
getYarnClusterMetrics in interface YarnClient
Returns:
cluster metrics
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getNodeReports

public List<NodeReport> getNodeReports()
                                throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get a report of all nodes (NodeReport) in the cluster.

Specified by:
getNodeReports in interface YarnClient
Returns:
A list of report of all nodes
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getRMDelegationToken

public DelegationToken getRMDelegationToken(Text renewer)
                                     throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get a delegation token so as to be able to talk to YARN using those tokens.

Specified by:
getRMDelegationToken in interface YarnClient
Parameters:
renewer - Address of the renewer who can renew these tokens when needed by securely talking to YARN.
Returns:
a delegation token (DelegationToken) that can be used to talk to YARN
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getQueueInfo

public QueueInfo getQueueInfo(String queueName)
                       throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get information (QueueInfo) about a given queue.

Specified by:
getQueueInfo in interface YarnClient
Parameters:
queueName - Name of the queue whose information is needed
Returns:
queue information
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException - in case of errors or if YARN rejects the request due to access-control restrictions.

getQueueAclsInfo

public List<QueueUserACLInfo> getQueueAclsInfo()
                                        throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get information about acls for current user on all the existing queues.

Specified by:
getQueueAclsInfo in interface YarnClient
Returns:
a list of queue acls (QueueUserACLInfo) for current user
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getAllQueues

public List<QueueInfo> getAllQueues()
                             throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get information (QueueInfo) about all queues, recursively if there is a hierarchy

Specified by:
getAllQueues in interface YarnClient
Returns:
a list of queue-information for all queues
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getRootQueueInfos

public List<QueueInfo> getRootQueueInfos()
                                  throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get information (QueueInfo) about top level queues.

Specified by:
getRootQueueInfos in interface YarnClient
Returns:
a list of queue-information for all the top-level queues
Throws:
org.apache.hadoop.yarn.exceptions.YarnRemoteException

getChildQueueInfos

public List<QueueInfo> getChildQueueInfos(String parent)
                                   throws org.apache.hadoop.yarn.exceptions.YarnRemoteException
Description copied from interface: YarnClient

Get information (QueueInfo) about all the immediate children queues of the given queue

Specified by:
getChildQueueInfos in interface YarnClient
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.YarnRemoteException


Copyright © 2012 Apache Software Foundation. All Rights Reserved.