def poll_job(bigquery, job):
 print 'Waiting for job to finish...'
 request = bigquery.jobs().get(projectId=job['jobReference']['projectId'], jobId=job['jobReference']['jobId'])
 while True:
  result = request.execute(num_retries=2)
  if (result['status']['state'] == 'DONE'):
   if ('errorResult' in result['status']):
    raise RuntimeError(result['status']['errorResult'])
   print 'Job complete.'
   return
  time.sleep(1)

def poll_job ( bigquery , job ) : print 'Waiting for job to finish...' request = bigquery . jobs ( ) . get ( projectId = job [ 'jobReference' ] [ 'projectId' ] , jobId = job [ 'jobReference' ] [ 'jobId' ] ) while True : result = request . execute ( num_retries = 2 ) if ( result [ 'status' ] [ 'state' ] == 'DONE' ) : if ( 'errorResult' in result [ 'status' ] ) : raise RuntimeError ( result [ 'status' ] [ 'errorResult' ] ) print 'Job complete.' return time . sleep ( 1 )
waits for a job to complete .