Spring for Apache Hadoop

org.springframework.yarn.client
Class ClientRmTemplate

java.lang.Object
  extended by org.springframework.yarn.rpc.YarnRpcAccessor<org.apache.hadoop.yarn.api.ClientRMProtocol>
      extended by org.springframework.yarn.client.ClientRmTemplate
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, ClientRmOperations

public class ClientRmTemplate
extends YarnRpcAccessor<org.apache.hadoop.yarn.api.ClientRMProtocol>
implements ClientRmOperations

Template implementation for ClientRmOperations wrapping communication using ClientRMProtocol. Methods for this template wraps possible exceptions into Spring Dao exception hierarchy.

Author:
Janne Valkealahti

Constructor Summary
ClientRmTemplate(org.apache.hadoop.conf.Configuration config)
          Constructs a ClientRmTemplate with a given yarn configuration.
 
Method Summary
 org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
          Gets a report of the application.
 org.apache.hadoop.yarn.api.records.DelegationToken getDelegationToken(java.lang.String renewer)
          Gets the resource manager delegation token.
 org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse getNewApplication()
          Requests a new application from a resource manager.
protected  java.net.InetSocketAddress getRpcAddress(org.apache.hadoop.conf.Configuration config)
          Gets the InetSocketAddress where this accessor should connect.
 org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
          Requests ResourceManager to abort submitted application.
 java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications()
          Gets a list of ApplicationReports from a resource manager.
 org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse submitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubContext)
          Submits a new application into resource manager.
 
Methods inherited from class org.springframework.yarn.rpc.YarnRpcAccessor
afterPropertiesSet, createProxy, destroy, execute, getConfiguration, getProxy, getUser
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientRmTemplate

public ClientRmTemplate(org.apache.hadoop.conf.Configuration config)
Constructs a ClientRmTemplate with a given yarn configuration.

Parameters:
config - the yarn configuration
Method Detail

listApplications

public java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications()
Description copied from interface: ClientRmOperations
Gets a list of ApplicationReports from a resource manager.

Specified by:
listApplications in interface ClientRmOperations
Returns:
a list of ApplicationReports

getNewApplication

public org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse getNewApplication()
Description copied from interface: ClientRmOperations
Requests a new application from a resource manager. Main purpose is to get a new ApplicationId but response also contains information about resource capabilities.

Specified by:
getNewApplication in interface ClientRmOperations
Returns:
the new GetNewApplicationResponse

submitApplication

public org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse submitApplication(org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext appSubContext)
Description copied from interface: ClientRmOperations
Submits a new application into resource manager. Returned response is an empty placeholder, thus application submission is considered to be successful if no exceptions are thrown.

Specified by:
submitApplication in interface ClientRmOperations
Parameters:
appSubContext - the Application Submission Context
Returns:
the new SubmitApplicationResponse

killApplication

public org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Description copied from interface: ClientRmOperations
Requests ResourceManager to abort submitted application.

Specified by:
killApplication in interface ClientRmOperations
Parameters:
applicationId - the application id
Returns:
the KillApplicationResponse

getDelegationToken

public org.apache.hadoop.yarn.api.records.DelegationToken getDelegationToken(java.lang.String renewer)
Description copied from interface: ClientRmOperations
Gets the resource manager delegation token.

Specified by:
getDelegationToken in interface ClientRmOperations
Parameters:
renewer - the renewer as kerberos principal
Returns:
the delegation token

getApplicationReport

public org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Description copied from interface: ClientRmOperations
Gets a report of the application.

Specified by:
getApplicationReport in interface ClientRmOperations
Parameters:
applicationId - the application id
Returns:
the ApplicationReport

getRpcAddress

protected java.net.InetSocketAddress getRpcAddress(org.apache.hadoop.conf.Configuration config)
Description copied from class: YarnRpcAccessor
Gets the InetSocketAddress where this accessor should connect.

Specified by:
getRpcAddress in class YarnRpcAccessor<org.apache.hadoop.yarn.api.ClientRMProtocol>
Parameters:
config - the yarn configuration
Returns:
address of rpc endpoint

Spring for Apache Hadoop