import math


def gen_im_job_array(start_id, end_id, num_jobs):
  """Given list of ids, generate list of starting and ending job numbers.

  Args:
      start_id (TYPE): Description
      end_id (TYPE): Description
      num_jobs (TYPE): Description

  Returns:
      {start_ids: [], end_ids: []}: Description
  """
  num_ids = end_id - start_id + 1
  num_per_job = math.ceil(num_ids / num_jobs)
  
  start_ids = list(range(start_id, end_id, num_per_job))
  end_ids = [x+num_per_job-1 for x in start_ids]

  if end_ids[-1] > end_id:
    end_ids[-1] = end_id

  return {'start_ids': start_ids, 'end_ids': end_ids}