Skip to content

Retry 400s during dataset teardown. - #2333

Merged
tseaver merged 2 commits into
googleapis:masterfrom
tseaver:2318-bigquery-dataset-still-in-use
Sep 16, 2016
Merged

Retry 400s during dataset teardown.#2333
tseaver merged 2 commits into
googleapis:masterfrom
tseaver:2318-bigquery-dataset-still-in-use

Conversation

@tseaver

Copy link
Copy Markdown
Contributor

Closes#2318.

@tseavertseaver added api: bigquery Issues related to the BigQuery API. flaky labels Sep 16, 2016
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Sep 16, 2016
Comment threadsystem_tests/bigquery.py Outdated
if isinstance(doomed, Bucket):
retry = RetryErrors(Conflict)
retry(doomed.delete)(force=True)
retry_409 = RetryErrors(Conflict)

This comment was marked as spam.

This comment was marked as spam.

Comment threadsystem_tests/bigquery.py Outdated
retry_409(doomed.delete)(force=True)
else:
doomed.delete()
retry_400(doomed.delete)()

This comment was marked as spam.

This comment was marked as spam.

@dhermes

Copy link
Copy Markdown
Contributor

@tseaver Were you able to reproduce this locally?

@tseaver

Copy link
Copy Markdown
ContributorAuthor

Were you able to reproduce this locally?

Not except by borking the delete of tables in the dataset.

@dhermes

dhermes commented Sep 16, 2016

Copy link
Copy Markdown
Contributor

Gotcher. Thanks for the tip. Can you add an error predicate, e.g.

deferr_pred(exc):
return (len(exc._errors) ==1andexc._errors[0]['reason'] =='resourceInUse')

Here is the output from catching that error:

>>>try:
... dataset.delete()
... exceptExceptionasexc:
... pass
...
>>>importjson>>>print(json.dumps(exc.__dict__, indent=2))
{
"message": "Dataset {PROJ}:create_table{TESTID} is still in use (DELETE https://www.googleapis.com/bigquery/v2/projects/{PROJ}/datasets/create_table{TESTID})",
"_errors": [
{
"domain": "global",
"message": "Dataset {PROJ}:create_table{TESTID} is still in use",
"reason": "resourceInUse"
}
]
}

@dhermesdhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@tseaver
tseaver merged commit 613361c into googleapis:masterSep 16, 2016
@tseaver
tseaver deleted the 2318-bigquery-dataset-still-in-use branch September 16, 2016 22:21
@dhermesdhermes mentioned this pull request Sep 19, 2016
parthea pushed a commit that referenced this pull request Mar 2, 2026
Thank you for opening a Pull Request! Before submitting your PR, there
are a few things you can do to make sure it goes smoothly:
- [ ] Make sure to open an issue as a
[bug/issue](https://github.com/googleapis/python-bigquery/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
Fixes #<issue_number_goes_here> 🦕
---------
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Mar 2, 2026
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.
Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:c8612d3fffb3f6a32353b2d1abd16b61e87811866f7ec9d65b59b02eb452a620
<details><summary>google-cloud-bigquery: 3.40.0</summary>
##
[3.40.0](googleapis/python-bigquery@v3.39.0...v3.40.0)
(2026-01-08)
### Features
* support load_table and list_rows with picosecond timestamp (#2351)
([46764a59](googleapis/python-bigquery@46764a59))
* support timestamp_precision in table schema (#2333)
([8d5785ae](googleapis/python-bigquery@8d5785ae))
</details>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: bigqueryIssues related to the BigQuery API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@tseaver@dhermes@daspecster@googlebot