Spring for Apache Hadoop

org.springframework.yarn.client
Class AbstractYarnClient

java.lang.Object
  extended by org.springframework.yarn.client.AbstractYarnClient
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, YarnClient
Direct Known Subclasses:
CommandYarnClient

public abstract class AbstractYarnClient
extends java.lang.Object
implements YarnClient, org.springframework.beans.factory.InitializingBean

Base implementation providing functionality for YarnClient.

Author:
Janne Valkealahti

Constructor Summary
AbstractYarnClient(ClientRmOperations clientRmOperations)
          Constructs client with a given template.
 
Method Summary
 void afterPropertiesSet()
           
 org.apache.hadoop.yarn.api.records.ApplicationReport getApplicationReport(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
          Gets a report of the application.
 ClientRmOperations getClientRmOperations()
          Gets the client rm operations.
 org.apache.hadoop.conf.Configuration getConfiguration()
          Get the Configuration of this client.
 java.util.Map<java.lang.String,java.lang.String> getEnvironment()
          Gets the environment variables.
protected  org.apache.hadoop.yarn.api.records.ContainerLaunchContext getMasterContainerLaunchContext()
          Gets the master container launch context.
protected  org.apache.hadoop.fs.Path getStagingPath()
          Gets the staging path.
protected  org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
          Gets the submission context for application master.
 void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
          Requests a resource manager to kill the application.
 java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications()
          Gets a list of known applications.
 void setApplicationDirName(java.lang.String applicationDirName)
          Sets the application dir name.
 void setAppName(java.lang.String appName)
          Sets the name for submitted application.
 void setClientRmOperations(ClientRmOperations clientRmOperations)
          Sets the ClientRmOperations implementation for accessing resource manager.
 void setCommands(java.util.List<java.lang.String> commands)
          Sets the commands starting appmaster.
 void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
          Sets the Yarn configuration.
 void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
          Sets the environment for appmaster.
 void setMemory(int memory)
          Sets the memory.
 void setPriority(int priority)
          Sets the priority.
 void setQueue(java.lang.String queue)
          Sets the queue.
 void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
          Sets the resource localizer for appmaster container.
 void setStagingDirPath(java.lang.String stagingDirPath)
          Sets the staging dir path.
 void setUser(java.lang.String user)
          Sets the user.
 void setVirtualcores(int virtualcores)
          Sets the virtualcores.
 org.apache.hadoop.yarn.api.records.ApplicationId submitApplication()
          Submits the application known to YarnClient instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractYarnClient

public AbstractYarnClient(ClientRmOperations clientRmOperations)
Constructs client with a given template.

Parameters:
clientRmOperations - the client to resource manager template
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws java.lang.Exception
Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
Throws:
java.lang.Exception

submitApplication

public org.apache.hadoop.yarn.api.records.ApplicationId submitApplication()
Description copied from interface: YarnClient
Submits the application known to YarnClient instance.

Specified by:
submitApplication in interface YarnClient
Returns:
the ApplicationId for submitted application

killApplication

public void killApplication(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Description copied from interface: YarnClient
Requests a resource manager to kill the application.

Specified by:
killApplication in interface YarnClient
Parameters:
applicationId - the ApplicationId

listApplications

public java.util.List<org.apache.hadoop.yarn.api.records.ApplicationReport> listApplications()
Description copied from interface: YarnClient
Gets a list of known applications.

Specified by:
listApplications in interface YarnClient
Returns:
List of ApplicationReports

getApplicationReport

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

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

setClientRmOperations

public void setClientRmOperations(ClientRmOperations clientRmOperations)
Sets the ClientRmOperations implementation for accessing resource manager.

Parameters:
clientRmOperations - The client to resource manager implementation

getClientRmOperations

public ClientRmOperations getClientRmOperations()
Gets the client rm operations.

Returns:
the client rm operations

getEnvironment

public java.util.Map<java.lang.String,java.lang.String> getEnvironment()
Gets the environment variables.

Returns:
the map of environment variables

setEnvironment

public void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
Sets the environment for appmaster.

Parameters:
environment - the environment

setCommands

public void setCommands(java.util.List<java.lang.String> commands)
Sets the commands starting appmaster.

Parameters:
commands - the commands starting appmaster

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Get the Configuration of this client. Internally this method is called to get the configuration which allows sub-classes to override and add additional settings.

Returns:
the Configuration

setConfiguration

public void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
Sets the Yarn configuration.

Parameters:
configuration - the Yarn configuration

setResourceLocalizer

public void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
Sets the resource localizer for appmaster container.

Parameters:
resourceLocalizer - the new resource localizer

setAppName

public void setAppName(java.lang.String appName)
Sets the name for submitted application.

Parameters:
appName - the new application name

setPriority

public void setPriority(int priority)
Sets the priority.

Parameters:
priority - the new priority

setVirtualcores

public void setVirtualcores(int virtualcores)
Sets the virtualcores.

Parameters:
virtualcores - the new virtualcores

setMemory

public void setMemory(int memory)
Sets the memory.

Parameters:
memory - the new memory

setQueue

public void setQueue(java.lang.String queue)
Sets the queue.

Parameters:
queue - the new queue

setUser

public void setUser(java.lang.String user)
Sets the user.

Parameters:
user - the new user

setStagingDirPath

public void setStagingDirPath(java.lang.String stagingDirPath)
Sets the staging dir path.

Parameters:
stagingDirPath - the new staging dir path

setApplicationDirName

public void setApplicationDirName(java.lang.String applicationDirName)
Sets the application dir name.

Parameters:
applicationDirName - the new application dir name

getStagingPath

protected org.apache.hadoop.fs.Path getStagingPath()
Gets the staging path.

Returns:
the staging path

getSubmissionContext

protected org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext getSubmissionContext(org.apache.hadoop.yarn.api.records.ApplicationId applicationId)
Gets the submission context for application master.

Returns:
the submission context

getMasterContainerLaunchContext

protected org.apache.hadoop.yarn.api.records.ContainerLaunchContext getMasterContainerLaunchContext()
Gets the master container launch context.

Returns:
the master container launch context

Spring for Apache Hadoop