def METHOD_NAME(end_hour):
  """Build crash stats for the end hour."""
  logging.info('Started building crash stats for %s.',
               crash_stats.get_datetime(end_hour))
  job_id = JOB_ID_TEMPLATE.format(unique_number=int(time.time()))
  client = big_query.Client()
  make_request(client, job_id, end_hour)
  start_time = time.time()
  while (time.time() - start_time) < TIMEOUT:
    time.sleep(10)
    result = client.get_job(job_id)
    logging.info('Checking %s', json.dumps(result))
    if result['status']['state'] == 'DONE':
      if result['status'].get('errors'):
        raise Exception(json.dumps(result))  # pylint: disable=broad-exception-raised
      return
  raise Exception('Building crash stats exceeded %d seconds.' % TIMEOUT)  # pylint: disable=broad-exception-raised