Repository navigation
fix: send an oversized first operation in a batch #872
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8f2729e
test: cover an oversized operation in the overflow queue
hln33 079fa50
fix: send an oversized first operation in a batch
hln33 5c77fe1
test: run an 800 KB step result end to end
hln33 1de0394
test: trim the large step result docstring
hln33 0285013
test: annotate the new overflow tests with -> None
hln33 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
packages/aws-durable-execution-sdk-python/tests/e2e/large_step_result_int_test.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| """A step result above the checkpoint batch size limit completes (issue #871). | ||
|
|
||
| The step result is 800 KB. That is above ``max_batch_size_bytes`` (750 KB) and | ||
| below the service's 1 MB per-operation limit. With the default | ||
| ``AT_LEAST_ONCE_PER_RETRY`` semantics the START checkpoint is async, so the | ||
| batcher still holds it when the sync SUCCEED arrives, and SUCCEED takes the | ||
| overflow path. Before the fix the SUCCEED operation was never sent and the | ||
| handler thread blocked forever, so ``run()`` raised ``TimeoutError``. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
|
|
||
| from aws_durable_execution_sdk_python import DurableContext, durable_execution | ||
| from aws_durable_execution_sdk_python.execution import InvocationStatus | ||
| from aws_durable_execution_sdk_python_testing.runner import ( | ||
| DurableFunctionTestResult, | ||
| DurableFunctionTestRunner, | ||
| ) | ||
|
|
||
| RESULT_SIZE_BYTES = 800 * 1024 | ||
|
|
||
|
|
||
| @durable_execution | ||
| def _large_step_handler(_event: dict[str, str], context: DurableContext) -> str: | ||
| return context.step(lambda _sc: "y" * RESULT_SIZE_BYTES, name="big_step") | ||
|
|
||
|
|
||
| def test_step_result_above_batch_size_limit_completes() -> None: | ||
| with DurableFunctionTestRunner(handler=_large_step_handler) as runner: | ||
| result: DurableFunctionTestResult = runner.run(input="{}", execution_timeout=30) | ||
|
|
||
| assert result.status is InvocationStatus.SUCCEEDED | ||
| assert result.result is not None | ||
| assert len(json.loads(result.result)) == RESULT_SIZE_BYTES | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.