Skip to content

[Python] Fail bundles on state write errors - #39992

Draft
bvolpato wants to merge 2 commits into
apache:masterfrom
bvolpato:bvolpato/python-state-write-errors
Draft

[Python] Fail bundles on state write errors#39992
bvolpato wants to merge 2 commits into
apache:masterfrom
bvolpato:bvolpato/python-state-write-errors

Conversation

@bvolpato

@bvolpato bvolpato commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

A runner-reported append or clear failure can currently complete a Python bundle successfully because runtime state commits ignore StateResponse.error. A clear followed by an append also loses the clear response.

Check every pending write response before completing bag, set, and ordered-list state commits, and preserve both futures for clear-then-append. Regression tests cover failed appends and clears, multiple append chunks, set compaction, and successful commits. The new tests fail against the upstream implementation.

Testing

From sdks/python, with the SDK and test dependencies installed:

python -m pytest apache_beam/runners/worker/bundle_processor_test.py apache_beam/runners/worker/sdk_worker_test.py -q

Python 3.12: 45 passed, plus 15 subtests passed. The new regression cases produced 15 failures against the unfixed implementation. YAPF 0.43.0, Ruff 0.15.22, and git diff --check pass for the changed files.

Downsides

Previously hidden backend failures now fail the bundle and invoke the runner's existing failure/retry handling. The successful path adds no state RPCs. Retry uses the existing runner contract that failed state handlers must not reuse their cache token.


  • Describe the bug and include a reproducible regression test; no separate Python issue is linked.
  • Update CHANGES.md with the behavior change.
  • Apache Individual Contributor License Agreement, if required for this contribution.

See the Contributor Guide and CI documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant