@classmethod
  def split_input(cls, mapper_spec):
    shard_count = mapper_spec.shard_count
    query_spec = cls._get_query_spec(mapper_spec)

    k_ranges = [key_ranges.KeyRangesFactory.create_from_list(
        [key_range.KeyRange()]) for _ in range(shard_count)]
    iters = [db_iters.RangeIteratorFactory.create_key_ranges_iterator(
        r, query_spec, cls._KEY_RANGE_ITER_CLS) for r in k_ranges]

    results = []
    for i in iters:
      results.append(cls(i, cls.next_instance_id))
      cls.next_instance_id += 1
    return results
Split into the exact number of shards asked for.
dataset/ETHPy150Open GoogleCloudPlatform/appengine-mapreduce/python/test/mapreduce/handlers_test.py/InputReader.split_input