Spring for Apache Hadoop

org.springframework.yarn.am
Class StaticEventingAppmaster

java.lang.Object
  extended by org.springframework.yarn.support.LifecycleObjectSupport
      extended by org.springframework.yarn.am.AbstractAppmaster
          extended by org.springframework.yarn.am.AbstractServicesAppmaster
              extended by org.springframework.yarn.am.AbstractEventingAppmaster
                  extended by org.springframework.yarn.am.StaticEventingAppmaster
All Implemented Interfaces:
java.util.EventListener, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationListener<AbstractYarnEvent>, org.springframework.context.Lifecycle, org.springframework.context.Phased, org.springframework.context.SmartLifecycle, YarnAppmaster

public class StaticEventingAppmaster
extends AbstractEventingAppmaster
implements YarnAppmaster

A simple application master implementation which will allocate and launch a number of containers, monitor container statuses and finally exit the application by sending corresponding message back to resource manager. This implementation also is able to handle failed containers.

Author:
Janne Valkealahti

Constructor Summary
StaticEventingAppmaster()
           
 
Method Summary
protected  boolean isComplete()
          Returns state telling if application is considered as complete.
protected  void onContainerAllocated(org.apache.hadoop.yarn.api.records.Container container)
          Invoked when ContainerAllocationEvent is received as an application event.
protected  void onContainerCompleted(org.apache.hadoop.yarn.api.records.ContainerStatus status)
          Invoked when ContainerCompletedEvent is received as an application event.
protected  boolean onContainerFailed(org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus)
          Called if completed container has failed.
protected  void onContainerLaunched(org.apache.hadoop.yarn.api.records.Container container)
          Invoked when ContainerLaunchedEvent is received as an application event.
 void submitApplication()
          Submit and run application.
 
Methods inherited from class org.springframework.yarn.am.AbstractEventingAppmaster
onApplicationEvent, onContainerLaunchRequestFailed
 
Methods inherited from class org.springframework.yarn.am.AbstractServicesAppmaster
getAllocator, getLauncher, getMonitor, setAllocator, setLauncher, setMonitor
 
Methods inherited from class org.springframework.yarn.am.AbstractAppmaster
addAppmasterStateListener, doStop, finishAppmaster, getApplicationAttemptId, getAppmasterClientService, getAppmasterService, getAppmasterTrackService, getCommands, getConfiguration, getContainerAssign, getEnvironment, getParameters, getResourceLocalizer, getTemplate, notifyCompleted, onInit, registerAppmaster, setCommands, setCommands, setConfiguration, setContainerAssign, setEnvironment, setFinalApplicationStatus, setParameters, setResourceLocalizer, setTemplate
 
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
 
Methods inherited from interface org.springframework.yarn.am.YarnAppmaster
addAppmasterStateListener, setEnvironment, setParameters
 

Constructor Detail

StaticEventingAppmaster

public StaticEventingAppmaster()
Method Detail

submitApplication

public void submitApplication()
Description copied from interface: YarnAppmaster
Submit and run application.

Specified by:
submitApplication in interface YarnAppmaster

onContainerAllocated

protected void onContainerAllocated(org.apache.hadoop.yarn.api.records.Container container)
Description copied from class: AbstractEventingAppmaster
Invoked when ContainerAllocationEvent is received as an application event. Wrapped Container is passed to a method.

Overrides:
onContainerAllocated in class AbstractEventingAppmaster
Parameters:
container - the container

onContainerLaunched

protected void onContainerLaunched(org.apache.hadoop.yarn.api.records.Container container)
Description copied from class: AbstractEventingAppmaster
Invoked when ContainerLaunchedEvent is received as an application event. Wrapped Container is passed to a method.

Overrides:
onContainerLaunched in class AbstractEventingAppmaster
Parameters:
container - the container

onContainerCompleted

protected void onContainerCompleted(org.apache.hadoop.yarn.api.records.ContainerStatus status)
Description copied from class: AbstractEventingAppmaster
Invoked when ContainerCompletedEvent is received as an application event. Wrapped ContainerStatus is passed to a method.

Overrides:
onContainerCompleted in class AbstractEventingAppmaster
Parameters:
status - the container status

onContainerFailed

protected boolean onContainerFailed(org.apache.hadoop.yarn.api.records.ContainerStatus containerStatus)
Called if completed container has failed. User may override this method to process failed container, i.e. making a request to re-allocate new container instead of failing the application.

Default implementation doesn't do anything and just returns that failed container wasn't handled.

Parameters:
containerStatus - the container status
Returns:
true, if container was handled.

isComplete

protected boolean isComplete()
Returns state telling if application is considered as complete. Default implementation is comparing if current target container count has been satisfied by a count from a method ContainerMonitor.completedCount().

Returns:
true if application is complete

Spring for Apache Hadoop