Spring for Apache Hadoop

org.springframework.yarn.am
Class AbstractAppmaster

java.lang.Object
  extended by org.springframework.yarn.support.LifecycleObjectSupport
      extended by org.springframework.yarn.am.AbstractAppmaster
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle
Direct Known Subclasses:
AbstractServicesAppmaster

public abstract class AbstractAppmaster
extends LifecycleObjectSupport

Base class providing functionality for common application master instances.

Author:
Janne Valkealahti

Constructor Summary
AbstractAppmaster()
           
 
Method Summary
 void addAppmasterStateListener(AppmasterStateListener listener)
          Adds the appmaster state listener.
protected  void doStop()
          Subclasses may implement this method with the stop behavior.
protected  org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse finishAppmaster()
          Finish appmaster by sending request to resource manager.
protected  org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()
          Gets the application attempt id.
protected  AppmasterService getAppmasterClientService()
          Gets a client facing AppmasterService set to this instance.
protected  AppmasterService getAppmasterService()
          Gets a AppmasterService set to this instance.
protected  AppmasterTrackService getAppmasterTrackService()
          Gets a AppmasterTrackService set to this instance.
 java.util.List<java.lang.String> getCommands()
          Gets the commands.
 org.apache.hadoop.conf.Configuration getConfiguration()
          Gets the Yarn configuration.
 ContainerAssign<java.lang.Object> getContainerAssign()
          Gets the container assign.
 java.util.Map<java.lang.String,java.lang.String> getEnvironment()
          Gets the environment variables.
 java.util.Properties getParameters()
          Gets the parameters.
 ResourceLocalizer getResourceLocalizer()
          Gets the resource localizer.
 AppmasterRmOperations getTemplate()
          Gets the AppmasterRmOperations template.
protected  void notifyCompleted()
          Notify completed state to appmaster state listeners.
protected  void onInit()
          Global application master instance specific ApplicationAttemptId is build during this init method.
protected  org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse registerAppmaster()
          Register appmaster.
 void setCommands(java.util.List<java.lang.String> commands)
          Sets the commands.
 void setCommands(java.lang.String[] commands)
          Sets the commands.
 void setConfiguration(org.apache.hadoop.conf.Configuration configuration)
          Sets the Yarn configuration.
 void setContainerAssign(ContainerAssign<java.lang.Object> containerAssign)
          Sets the container assign.
 void setEnvironment(java.util.Map<java.lang.String,java.lang.String> environment)
          Sets the environment variables.
protected  void setFinalApplicationStatus(org.apache.hadoop.yarn.api.records.FinalApplicationStatus finalApplicationStatus)
          Sets the final application status.
 void setParameters(java.util.Properties parameters)
          Sets the parameters.
 void setResourceLocalizer(ResourceLocalizer resourceLocalizer)
          Sets the resource localizer.
 void setTemplate(AppmasterRmOperations template)
          Sets the AppmasterRmOperations template.
 
Methods inherited from class org.springframework.yarn.support.LifecycleObjectSupport
afterPropertiesSet, doStart, getBeanFactory, getPhase, getTaskExecutor, getTaskScheduler, getYarnEventPublisher, isAutoStartup, isRunning, setAutoStartup, setBeanFactory, setPhase, setTaskExecutor, setTaskScheduler, setYarnEventPublisher, start, stop, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractAppmaster

public AbstractAppmaster()
Method Detail

onInit

protected void onInit()
               throws java.lang.Exception
Global application master instance specific ApplicationAttemptId is build during this init method.

Overrides:
onInit in class LifecycleObjectSupport
Throws:
java.lang.Exception
See Also:
LifecycleObjectSupport.onInit()

doStop

protected void doStop()
Description copied from class: LifecycleObjectSupport
Subclasses may implement this method with the stop behavior. This method will be invoked while holding the LifecycleObjectSupport.lifecycleLock.

Overrides:
doStop in class LifecycleObjectSupport

getTemplate

public AppmasterRmOperations getTemplate()
Gets the AppmasterRmOperations template.

Returns:
the AppmasterRmOperations template

setTemplate

public void setTemplate(AppmasterRmOperations template)
Sets the AppmasterRmOperations template.

Parameters:
template - the new AppmasterRmOperations template

getEnvironment

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

Returns:
the environment variables

setEnvironment

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

Parameters:
environment - the environment variables

getParameters

public java.util.Properties getParameters()
Gets the parameters.

Returns:
the parameters

setParameters

public void setParameters(java.util.Properties parameters)
Sets the parameters.

Parameters:
parameters - the new parameters

getConfiguration

public org.apache.hadoop.conf.Configuration getConfiguration()
Gets the Yarn configuration.

Returns:
the Yarn configuration

setConfiguration

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

Parameters:
configuration - the new Yarn configuration

getCommands

public java.util.List<java.lang.String> getCommands()
Gets the commands.

Returns:
the commands

setCommands

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

Parameters:
commands - the new commands

setCommands

public void setCommands(java.lang.String[] commands)
Sets the commands.

Parameters:
commands - the new commands

getApplicationAttemptId

protected org.apache.hadoop.yarn.api.records.ApplicationAttemptId getApplicationAttemptId()
Gets the application attempt id.

Returns:
the application attempt id

setResourceLocalizer

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

Parameters:
resourceLocalizer - the new resource localizer

getResourceLocalizer

public ResourceLocalizer getResourceLocalizer()
Gets the resource localizer.

Returns:
the resource localizer

addAppmasterStateListener

public void addAppmasterStateListener(AppmasterStateListener listener)
Adds the appmaster state listener.

Parameters:
listener - the listener

getContainerAssign

public ContainerAssign<java.lang.Object> getContainerAssign()
Gets the container assign.

Returns:
the container assign

setContainerAssign

public void setContainerAssign(ContainerAssign<java.lang.Object> containerAssign)
Sets the container assign.

Parameters:
containerAssign - the new container assign

setFinalApplicationStatus

protected void setFinalApplicationStatus(org.apache.hadoop.yarn.api.records.FinalApplicationStatus finalApplicationStatus)
Sets the final application status.

Parameters:
finalApplicationStatus - the new final application status

notifyCompleted

protected void notifyCompleted()
Notify completed state to appmaster state listeners.


getAppmasterService

protected AppmasterService getAppmasterService()
Gets a AppmasterService set to this instance.

Returns:
the instance of AppmasterService

getAppmasterClientService

protected AppmasterService getAppmasterClientService()
Gets a client facing AppmasterService set to this instance.

Returns:
the instance of AppmasterService

getAppmasterTrackService

protected AppmasterTrackService getAppmasterTrackService()
Gets a AppmasterTrackService set to this instance.

Returns:
the instance of AppmasterTrackService

registerAppmaster

protected org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse registerAppmaster()
Register appmaster.

Returns:
the register application master response

finishAppmaster

protected org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse finishAppmaster()
Finish appmaster by sending request to resource manager. Default application status is FinalApplicationStatus.SUCCEEDED which can be changed using method setFinalApplicationStatus(FinalApplicationStatus).

Returns:
the finish application master response

Spring for Apache Hadoop