Spring for Apache Hadoop

org.springframework.yarn.batch.partition
Class StaticPartitionHandler

java.lang.Object
  extended by org.springframework.yarn.batch.partition.AbstractPartitionHandler
      extended by org.springframework.yarn.batch.partition.StaticPartitionHandler
All Implemented Interfaces:
org.springframework.batch.core.partition.PartitionHandler

public class StaticPartitionHandler
extends AbstractPartitionHandler

Implementation of Spring Batch PartitionHandler which does partitioning based on static grid size.

Author:
Janne Valkealahti

Constructor Summary
StaticPartitionHandler()
          Instantiates a new static partition handler.
StaticPartitionHandler(BatchYarnAppmaster batchAppmaster)
          Instantiates a new static partition handler.
StaticPartitionHandler(BatchYarnAppmaster batchAppmaster, int gridSize)
          Instantiates a new static partition handler.
 
Method Summary
protected  java.util.Set<org.springframework.batch.core.StepExecution> createSplits(org.springframework.batch.core.partition.StepExecutionSplitter stepSplitter, org.springframework.batch.core.StepExecution stepExecution)
          Creates the splits.
 void setGridSize(int gridSize)
          Passed to the StepExecutionSplitter in the AbstractPartitionHandler.handle(StepExecutionSplitter, StepExecution) method, instructing it how many StepExecution instances are required, ideally.
 
Methods inherited from class org.springframework.yarn.batch.partition.AbstractPartitionHandler
createRequestData, getKeySplitLocations, getStepName, handle, setBatchAppmaster, setKeySplitLocations, setStepName, setYarnAppmaster, waitCompleteState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaticPartitionHandler

public StaticPartitionHandler()
Instantiates a new static partition handler.


StaticPartitionHandler

public StaticPartitionHandler(BatchYarnAppmaster batchAppmaster)
Instantiates a new static partition handler.

Parameters:
batchAppmaster - the batch appmaster

StaticPartitionHandler

public StaticPartitionHandler(BatchYarnAppmaster batchAppmaster,
                              int gridSize)
Instantiates a new static partition handler.

Parameters:
batchAppmaster - the batch appmaster
gridSize - the grid size
Method Detail

createSplits

protected java.util.Set<org.springframework.batch.core.StepExecution> createSplits(org.springframework.batch.core.partition.StepExecutionSplitter stepSplitter,
                                                                                   org.springframework.batch.core.StepExecution stepExecution)
                                                                            throws java.lang.Exception
Description copied from class: AbstractPartitionHandler
Creates the splits. Implementor needs to override this method to create an actual step splits.

Specified by:
createSplits in class AbstractPartitionHandler
Parameters:
stepSplitter - the step splitter
stepExecution - the step execution
Returns:
the step executions
Throws:
java.lang.Exception - the exception

setGridSize

public void setGridSize(int gridSize)
Passed to the StepExecutionSplitter in the AbstractPartitionHandler.handle(StepExecutionSplitter, StepExecution) method, instructing it how many StepExecution instances are required, ideally. The StepExecutionSplitter is allowed to ignore the grid size in the case of a restart, since the input data partitions must be preserved.

Parameters:
gridSize - the number of step executions that will be created

Spring for Apache Hadoop