-
Notifications
You must be signed in to change notification settings - Fork 14.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
set project_id and location when canceling BigQuery job #27521
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch 👍
Should we have a test for this? |
@@ -203,7 +203,10 @@ def test_cancel_queries(self, mock_client, mock_poll_job_complete): | |||
self.hook.running_job_id = running_job_id | |||
self.hook.cancel_query() | |||
|
|||
calls = [mock.call(job_id=running_job_id), mock.call(running_job_id)] | |||
calls = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@uranusjr Thx for your comment. The two test cases test cancel_query
which calls cancel_job
. They also check the calls invoking poll_job_complete
. So I think it is good enough. During test, I need to set an environment variable AIRFLOW_CONN_GOOGLE_CLOUD_DEFAULT=google-cloud-platform://
because the GoogleBaseHook
calls get_connection
in its constructor. I think we should move that function call within a member function. But it is out of the scope of this PR.
One concern is that cancel_query
is being deprecated. When we fully deprecate it, we shall convert some of the test cases to cover cancel_job
.
This PR fixes an issue when canceling BigQuery jobs. The issue arises when the service account is in a Google Cloud project A but the job runs in another project B. The default project and location won't work anymore.