Skip to content
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

Cancel BigQuery Queries #4701

Merged
merged 2 commits into from
Mar 4, 2020
Merged

Cancel BigQuery Queries #4701

merged 2 commits into from
Mar 4, 2020

Conversation

rauchy
Copy link
Contributor

@rauchy rauchy commented Mar 1, 2020

What type of PR is this? (check all applicable)

  • Bug Fix

Description

When a user requests to cancel a BigQuery query, or when the Redash time limit is reached, the underlying job in BigQuery continues to run until completion. This PR cancels the underlying BigQuery job in these situations.

Related Tickets & Documents

#4681

if self.current_job_id:
response_kind = None
while response_kind != "bigquery#jobCancelResponse":
response_kind = jobs.cancel(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to repeatedly execute the cancel request to get its status? No way to just get status after the first request?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bothered me as well. Turns out the client is executing previous requests when calling execute() in the cancellation block (the result kind is a getQueryResultResponse for a call to /cancel 🤨), so I'm guessing it's either some sort of optimization or a bug. Tried drilling into their source code to see if this is intentional, and if there's a flush method of some sort. Eventually gave up and realized it'll be easier to instantiate a new client. See 893c427.

@arikfr arikfr added this to the v9 milestone Mar 4, 2020
@rauchy rauchy merged commit ee6dcab into master Mar 4, 2020
@rauchy rauchy deleted the cancel-bigquery-queries branch March 4, 2020 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants