@@ -1418,9 +1418,10 @@ def cancel_job(
14181418 :param project_id: Google Cloud Project where the job is running
14191419 :param location: location the job is running
14201420 """
1421+ project_id = project_id or self .project_id
14211422 location = location or self .location
14221423
1423- if self .poll_job_complete (job_id = job_id ):
1424+ if self .poll_job_complete (job_id = job_id , project_id = project_id , location = location ):
14241425 self .log .info ("No running BigQuery jobs to cancel." )
14251426 return
14261427
@@ -1434,17 +1435,18 @@ def cancel_job(
14341435 job_complete = False
14351436 while polling_attempts < max_polling_attempts and not job_complete :
14361437 polling_attempts += 1
1437- job_complete = self .poll_job_complete (job_id )
1438+ job_complete = self .poll_job_complete (job_id = job_id , project_id = project_id , location = location )
14381439 if job_complete :
14391440 self .log .info ("Job successfully canceled: %s, %s" , project_id , job_id )
14401441 elif polling_attempts == max_polling_attempts :
14411442 self .log .info (
1442- "Stopping polling due to timeout. Job with id %s "
1443+ "Stopping polling due to timeout. Job %s, %s "
14431444 "has not completed cancel and may or may not finish." ,
1445+ project_id ,
14441446 job_id ,
14451447 )
14461448 else :
1447- self .log .info ("Waiting for canceled job with id %s to finish." , job_id )
1449+ self .log .info ("Waiting for canceled job %s, %s to finish." , project_id , job_id )
14481450 time .sleep (5 )
14491451
14501452 @GoogleBaseHook .fallback_to_default_project_id
0 commit comments