Add ability to specify max_size for a batch function. This controls the maximum number of batches given at a time.