fix(testing): scale local durable timers#501
Conversation
|
I'm not against this change since you're already done the work but barring more comments, I think it would be better to just port the "skip time" functionality from the other testing libraries |
Time scaling is already used in waits. I just extended it to step retries and other operations that have delays. It is different from Java i think because the way python test cases interact with the execution is different. In Java local test runner, the runner stops execution after each invocation and waits for user interaction while pythons runner runs execution concurrently when user interacts with the execution. |
|
There's a pre-existing issue here (not your fault!) where Wait timers leak scaled time into the observable history, when arguably the event history should contain the un-scaled time. The Callback timeout / heartbeat you're adding here don't have this issue. I have a big refactor coming that re-arranges how the test Executor works and that makes it compatible with all the existing JS example tests (featuring concurrency). I've split it into 2 PRs for easier reviewing, but each is still pretty big 😓. I still have to rebase these coming PRs on the recent changes in this repo, which is not going to be a lot of fun. If you'd like, I can pick up this PR here and incorporate it after I got those 2 PRs in? It would make my re-basing life simpler, and I will happily pick up the great work you did here and do the merging legwork afterwards? |
create a draft PR for your changes and I'll be happy to help you merge |
48b3674 to
6f1fb2d
Compare
|
Fixed the history event for wait operation in a new commit: 6f1fb2d |
6f1fb2d to
fa3a480
Compare
Summary
DURABLE_EXECUTION_TIME_SCALEhelper for local durable test timers.WaitStartedDetails.ScheduledEndTimestampremains unscaled.0.05scale so modeled durable delays do not spend unnecessary wall-clock time in CI.time_scale="1.0"because they intentionally test real heartbeat timing.Context
These commits were split out from PR #498. They are not part of the root-cause fix for the scheduler hang or the Python 3.13/3.14 callback race; those remain in PR #498.
This PR keeps the timer scaling change separate so it can be reviewed as a test-duration improvement for local durable timers.
Changes
aws_durable_execution_sdk_python_testing.time_scale.DURABLE_EXECUTION_TIME_SCALEinline.max(scaled_delay, min(original_delay, 5s))for long callback timers.Verification
hatch fmt --checkhatch run types:checkgit diff --checkhatch run test:all packages/aws-durable-execution-sdk-python-testing/tests/checkpoint/processors/wait_test.py packages/aws-durable-execution-sdk-python-testing/tests/checkpoint/processors/step_test.py packages/aws-durable-execution-sdk-python-testing/tests/executor_test.py -q- 138 passedhatch run test:all packages/aws-durable-execution-sdk-python-examples/test/callback/test_callback_heartbeat.py packages/aws-durable-execution-sdk-python-examples/test/wait_for_callback/test_wait_for_callback_heartbeat.py -q- 2 passed