-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
DISCUSSION: Is there a way for a Transaction to indicate success/failure from __exit__ #496
Comments
The transaction package has a concept of a "doomed" transaction: one which is in a hosed state, from which it can never be committed. Having our code fail inside
FWIW, the Zope transaction's "two-phase commit" tries to deal with the problems of the first, by breaking up the "commit" into slices, for distribution across multiple resource managers (e.g., a database and a mail-sender). For each of the following methods, the transaction calls each resource manager in turn):
|
For the most part the backend handles this. It seems a concept of "doomed" would be nice since it would make it so that. txn = Transaction()
with txn:
entity.save()
...
# This fails since txn has already been used, hence is doomed.
with txn:
new_entity.save() I was thinking something simple along the lines of >>> txn.in_progress
False
>>> txn.succeeded
True
>>> txn.finished
True There seem to be less than 8 states (implied by 3 bools) but more than 4, so maybe there is a better way to get the information to answer the questions:
|
You also need some way to get auto allocated keys back from the transaction right? Could this be incorporated into the method which indicates failure or success? |
Fixes googleapis#496. NOTE: Some of these changes may belong on Batch, but the concept of "tombstone"-ing is unique to a Transaction (i.e. once started, can only be committed once and the transaction ID can never be used again).
Fixes googleapis#496. NOTE: Some of these changes may belong on Batch, but the concept of "tombstone"-ing is unique to a Transaction (i.e. once started, can only be committed once and the transaction ID can never be used again).
…p/templates/python_library/.kokoro (#496) Source-Link: https://github.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf
…p/templates/python_library/.kokoro (#496) Source-Link: https://github.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
) Source-Link: googleapis/synthtool@7804ade Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:eede5672562a32821444a8e803fb984a6f61f2237ea3de229d2de24453f4ae7d
Source-Link: https://github.com/googleapis/synthtool/commit/92006bb3cdc84677aa93c7f5235424ec2b157146 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6
…496) * feat: Add client library support for AssetService v1 SavedQuery APIs Committer: jeffreyai@ PiperOrigin-RevId: 475366952 Source-Link: googleapis/googleapis@7428dad Source-Link: googleapis/googleapis-gen@5629e2a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTYyOWUyYWI3Mjg0NDNhMWE2YWJiMDNmMzRmOTI1ZDVjZDRlMGM0NyJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
* chore: exclude requirements.txt file from renovate-bot Source-Link: googleapis/synthtool@f58d313 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:7a40313731a7cb1454eef6b33d3446ebb121836738dc3ab3d2d3ded5268c35b6 * update constraints files * fix(deps): require protobuf 3.20.2 Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com> Co-authored-by: Anthonios Partheniou <[email protected]>
* fix: Add async context manager return types chore: Mock return_value should not populate oneof message fields chore: Support snippet generation for services that only support REST transport chore: Update gapic-generator-python to v1.11.0 PiperOrigin-RevId: 545430278 Source-Link: googleapis/googleapis@601b532 Source-Link: googleapis/googleapis-gen@b3f18d0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjNmMThkMGY2NTYwYTg1NTAyMmZkMDU4ODY1ZTc2MjA0NzlkN2FmOSJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
) Source-Link: googleapis/synthtool@d6103f4 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:39f0f3f2be02ef036e297e376fe3b6256775576da8a6ccb1d5eeb80f4c8bf8fb Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
…p/templates/python_library/.kokoro (#496) Source-Link: https://github.com/googleapis/synthtool/commit/bb171351c3946d3c3c32e60f5f18cee8c464ec51 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:f62c53736eccb0c4934a3ea9316e0d57696bb49c1a7c86c726e9bb8a2f87dadf
From #336.
Currently, there is no way to determine if this occurs. It's unclear what a way forward would look like but in
ndb
transactions have retries and can createFuture
objects which know about the success or failure.The text was updated successfully, but these errors were encountered: