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

feat: expose retryable error codes to users #879

Merged

Conversation

daniel-sanche
Copy link
Contributor

@daniel-sanche daniel-sanche commented Oct 20, 2023

This PR adds the option to set retryable error codes at the rpc level, or at the table level

Users can donfigure retryable errors using grpc.StatusCode objects, int codes corresponding to a grpc status, or an Exception type

Fixes: #787

Blocked on #880; if we decide to change how table defaults are configured, that will have implications for this change as well

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigtable Issues related to the googleapis/python-bigtable API. labels Oct 20, 2023
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels Oct 27, 2023
@daniel-sanche daniel-sanche changed the title [Draft] feat: expose retryable error codes to users feat: expose retryable error codes to users Oct 27, 2023
@daniel-sanche daniel-sanche marked this pull request as ready for review October 27, 2023 17:36
@daniel-sanche daniel-sanche requested review from a team as code owners October 27, 2023 17:36
default_operation_timeout=default_operation_timeout,
default_attempt_timeout=default_attempt_timeout,
)
return TableAsync(self, instance_id, table_id, *args, **kwargs)
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment to TableAsync ctor that reminds people to update this doc when adding args?

default_mutate_rows_retryable_errors: Sequence[
grpc.StatusCode | int | type[Exception]
] = (DeadlineExceeded, ServiceUnavailable),
default_retryable_errors: Sequence[grpc.StatusCode | int | type[Exception]] = (
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest to pick one way to express error types and stick with it. I dont think there much to gain from this flexibility

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Are you ok with sticking with type[Exception]? That's what api-core uses in retries, so it would be simplest. But I thought you mentioned that it should accept StatusCodes at one point

@@ -566,13 +609,16 @@ async def read_rows(
*,
operation_timeout: float | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
attempt_timeout: float | None | TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
retryable_errors: Sequence[grpc.StatusCode | int | type[Exception]]
| TABLE_DEFAULT = TABLE_DEFAULT.READ_ROWS,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should TABLE_DEFAULT enum be prefixed with an underscore? My understanding is that its used as a marker value to signal that the user passed something in. I dont think it makes sense for endusers to be able to set it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can see arguments either way. TABLE_DEFAULT already exists in the codebase for handling timeouts though, so if we want to change it, maybe it should be a separate PR?

Copy link
Contributor

@igorbernstein2 igorbernstein2 left a comment

Choose a reason for hiding this comment

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

lgtm after comments are addressed

@daniel-sanche daniel-sanche merged commit 285cdd3 into googleapis:experimental_v3 Dec 1, 2023
6 of 10 checks passed
daniel-sanche added a commit that referenced this pull request Feb 5, 2024
* feat: add new v3.0.0 API skeleton (#745)

* feat: improve rows filters (#751)

* feat: read rows query model class (#752)

* feat: implement row and cell model classes (#753)

* feat: add pooled grpc transport (#748)

* feat: implement read_rows (#762)

* feat: implement mutate rows (#769)

* feat: literal value filter (#767)

* feat: row_exists and read_row (#778)

* feat: read_modify_write and check_and_mutate_row (#780)

* feat: sharded read rows (#766)

* feat: ping and warm with metadata (#810)

* feat: mutate rows batching (#770)

* chore: restructure module paths (#816)

* feat: improve timeout structure (#819)

* fix: api errors apply to all bulk mutations

* chore: reduce public api surface (#820)

* feat: improve error group tracebacks on < py11 (#825)

* feat: optimize read_rows (#852)

* chore: add user agent suffix (#842)

* feat: optimize retries (#854)

* feat: add test proxy (#836)

* chore(tests): add conformance tests to CI for v3 (#870)

* chore(tests): turn off fast fail for conformance tets (#882)

* feat: add TABLE_DEFAULTS enum for table method arguments (#880)

* fix: pass None for retry in gapic calls (#881)

* feat: replace internal dictionaries with protos in gapic calls (#875)

* chore: optimize gapic calls (#863)

* feat: expose retryable error codes to users (#879)

* chore: update api_core submodule (#897)

* chore: merge main into experimental_v3 (#900)

* chore: pin conformance tests to v0.0.2 (#903)

* fix: bulk mutation eventual success (#909)

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigtable Issues related to the googleapis/python-bigtable API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants