title: Spring batch partitioning: set grid-size at runtime
body: <p>Should the grid-size of the partition be the same as the size of Map returned by Partitioner.partition() method? </p>
  
  <p>In my spring batch partitioning scenario, there are 2 steps. The first step identifies the total number of records to be processed and the second step (which is a partitioned step based on TaskExecutorPartitionHandler) processes the records in batches of 1000.</p>
  
  <p>If there are 20500 records, the size of Map returned by Partitioner.partition() method is 21 and 21 concurrent step executions will be needed. Does that mean the grid-size of the partition should be 21 in this case?  </p>
  
  <p>What if the total number of records to be processed changes daily? How can the grid-size of the partition be allocated at run time after the completion of the first step?</p>