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:
EventListener, Aware, BeanFactoryAware, InitializingBean, ApplicationListener<org.springframework.yarn.event.AbstractYarnEvent>, Lifecycle, Phased, SmartLifecycle, org.springframework.yarn.am.ContainerLauncherInterceptor, org.springframework.yarn.am.YarnAppmaster, BatchYarnAppmaster
Direct Known Subclasses:
BatchAppmaster

public abstract class AbstractBatchAppmaster
extends org.springframework.yarn.am.AbstractEventingAppmaster
implements BatchYarnAppmaster, org.springframework.yarn.am.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(StepExecution masterStepExecution, String remoteStepName, Set<StepExecution> stepExecutions, Map<StepExecution,org.springframework.yarn.am.container.ContainerRequestHint> resourceRequests)
          Adds the step splits.
 JobLauncher getJobLauncher()
          Gets the job launcher.
 String getJobName()
          Gets the job name.
 JobParametersConverter getJobParametersConverter()
          Gets the job parameters converter.
 List<StepExecution> getStepExecutions()
          Gets the step executions.
protected  void onContainerAllocated(Container container)
           
protected  void onContainerCompleted(ContainerStatus status)
           
protected  void onContainerLaunched(Container container)
           
protected  void onInit()
           
 ContainerLaunchContext preLaunch(Container container, ContainerLaunchContext context)
           
 void runJob(Job job)
          Runs the given job.
 void setJobLauncher(JobLauncher jobLauncher)
          Sets the job launcher.
 void setJobName(String jobName)
          Sets the job name.
 void setJobParametersConverter(JobParametersConverter jobParametersConverter)
          Injection setter for JobParametersConverter.
 
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, 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, submitApplication
 

Constructor Detail

AbstractBatchAppmaster

public AbstractBatchAppmaster()
Method Detail

onInit

protected void onInit()
               throws Exception
Overrides:
onInit in class org.springframework.yarn.am.AbstractAppmaster
Throws:
Exception

onContainerAllocated

protected void onContainerAllocated(Container container)
Overrides:
onContainerAllocated in class org.springframework.yarn.am.AbstractEventingAppmaster

onContainerLaunched

protected void onContainerLaunched(Container container)
Overrides:
onContainerLaunched in class org.springframework.yarn.am.AbstractEventingAppmaster

onContainerCompleted

protected void onContainerCompleted(ContainerStatus status)
Overrides:
onContainerCompleted in class org.springframework.yarn.am.AbstractEventingAppmaster

preLaunch

public ContainerLaunchContext preLaunch(Container container,
                                        ContainerLaunchContext context)
Specified by:
preLaunch in interface org.springframework.yarn.am.ContainerLauncherInterceptor

runJob

public void runJob(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.

Specified by:
addPartitionedStepExecutionStateListener in interface BatchYarnAppmaster
Parameters:
listener - the listener

getJobLauncher

public JobLauncher getJobLauncher()
Gets the job launcher.

Returns:
the job launcher

setJobLauncher

public void setJobLauncher(JobLauncher jobLauncher)
Sets the job launcher.

Parameters:
jobLauncher - the new job launcher

getJobName

public String getJobName()
Gets the job name.

Returns:
the job name

setJobName

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

Parameters:
jobName - the new job name

getStepExecutions

public List<StepExecution> getStepExecutions()
Gets the step executions.

Specified by:
getStepExecutions in interface BatchYarnAppmaster
Returns:
the step executions

addStepSplits

public void addStepSplits(StepExecution masterStepExecution,
                          String remoteStepName,
                          Set<StepExecution> stepExecutions,
                          Map<StepExecution,org.springframework.yarn.am.container.ContainerRequestHint> resourceRequests)
Adds the step splits.

Specified by:
addStepSplits in interface BatchYarnAppmaster
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 JobParametersConverter getJobParametersConverter()
Gets the job parameters converter.

Returns:
the job parameters converter

setJobParametersConverter

public void setJobParametersConverter(JobParametersConverter jobParametersConverter)
Injection setter for JobParametersConverter.

Parameters:
jobParametersConverter -