Spring for Apache Hadoop

org.springframework.yarn.batch.am
Class AbstractBatchAppmaster

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.batch.am.AbstractBatchAppmaster
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, ContainerLauncherInterceptor
Direct Known Subclasses:
BatchAppmaster

public abstract class AbstractBatchAppmaster
extends AbstractEventingAppmaster
implements ContainerLauncherInterceptor

Base application master for running batch jobs.

Author:
Janne Valkealahti

Constructor Summary
AbstractBatchAppmaster()
           
 
Method Summary
 void addPartitionedStepExecutionStateListener(PartitionedStepExecutionStateListener listener)
          Adds the partitioned step execution state listener.
 void addStepSplits(org.springframework.batch.core.StepExecution masterStepExecution, java.lang.String remoteStepName, java.util.Set<org.springframework.batch.core.StepExecution> stepExecutions, java.util.Map<org.springframework.batch.core.StepExecution,ContainerRequestHint> resourceRequests)
          Adds the step splits.
 org.springframework.batch.core.launch.JobLauncher getJobLauncher()
          Gets the job launcher.
 java.lang.String getJobName()
          Gets the job name.
 org.springframework.batch.core.converter.JobParametersConverter getJobParametersConverter()
          Gets the job parameters converter.
 java.util.List<org.springframework.batch.core.StepExecution> getStepExecutions()
          Gets the step executions.
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  void onContainerLaunched(org.apache.hadoop.yarn.api.records.Container container)
          Invoked when ContainerLaunchedEvent is received as an application event.
protected  void onInit()
          Global application master instance specific ApplicationAttemptId is build during this init method.
 org.apache.hadoop.yarn.api.records.ContainerLaunchContext preLaunch(org.apache.hadoop.yarn.api.records.ContainerLaunchContext context)
          Invoked before the ContainerLaunchContext is used to launch the container.
 void runJob(org.springframework.batch.core.Job job)
          Runs the given job.
 void setJobLauncher(org.springframework.batch.core.launch.JobLauncher jobLauncher)
          Sets the job launcher.
 void setJobName(java.lang.String jobName)
          Sets the job name.
 void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter jobParametersConverter)
          Injection setter for JobParametersConverter.
 
Methods inherited from class org.springframework.yarn.am.AbstractEventingAppmaster
onApplicationEvent
 
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, 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
 

Constructor Detail

AbstractBatchAppmaster

public AbstractBatchAppmaster()
Method Detail

onInit

protected void onInit()
               throws java.lang.Exception
Description copied from class: AbstractAppmaster
Global application master instance specific ApplicationAttemptId is build during this init method.

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

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

preLaunch

public org.apache.hadoop.yarn.api.records.ContainerLaunchContext preLaunch(org.apache.hadoop.yarn.api.records.ContainerLaunchContext context)
Description copied from interface: ContainerLauncherInterceptor
Invoked before the ContainerLaunchContext is used to launch the container.

Specified by:
preLaunch in interface ContainerLauncherInterceptor
Parameters:
context - the ContainerLaunchContext
Returns:
Unchanged or modified ContainerLaunchContext

runJob

public void runJob(org.springframework.batch.core.Job job)
Runs the given job.

Parameters:
job - the job to run

addPartitionedStepExecutionStateListener

public void addPartitionedStepExecutionStateListener(PartitionedStepExecutionStateListener listener)
Adds the partitioned step execution state listener.

Parameters:
listener - the listener

getJobLauncher

public org.springframework.batch.core.launch.JobLauncher getJobLauncher()
Gets the job launcher.

Returns:
the job launcher

setJobLauncher

public void setJobLauncher(org.springframework.batch.core.launch.JobLauncher jobLauncher)
Sets the job launcher.

Parameters:
jobLauncher - the new job launcher

getJobName

public java.lang.String getJobName()
Gets the job name.

Returns:
the job name

setJobName

public void setJobName(java.lang.String jobName)
Sets the job name.

Parameters:
jobName - the new job name

getStepExecutions

public java.util.List<org.springframework.batch.core.StepExecution> getStepExecutions()
Gets the step executions.

Returns:
the step executions

addStepSplits

public void addStepSplits(org.springframework.batch.core.StepExecution masterStepExecution,
                          java.lang.String remoteStepName,
                          java.util.Set<org.springframework.batch.core.StepExecution> stepExecutions,
                          java.util.Map<org.springframework.batch.core.StepExecution,ContainerRequestHint> resourceRequests)
Adds the step splits.

Parameters:
masterStepExecution - the partitioned steps parent step execution
remoteStepName - the remote step name
stepExecutions - the step executions splits
resourceRequests - the request data for step executions

getJobParametersConverter

public org.springframework.batch.core.converter.JobParametersConverter getJobParametersConverter()
Gets the job parameters converter.

Returns:
the job parameters converter

setJobParametersConverter

public void setJobParametersConverter(org.springframework.batch.core.converter.JobParametersConverter jobParametersConverter)
Injection setter for JobParametersConverter.

Parameters:
jobParametersConverter -

Spring for Apache Hadoop