Skip to content

Conversation

@yaythomas
Copy link
Member

Issue #, if available:

Description of changes:

  • Add OrphanedChildException (BaseException) to terminate orphaned children when parent completes early
  • Modify ThreadPoolExecutor to shutdown without waiting (wait=False) when completion criteria met
  • Raise exception when orphaned children attempt to checkpoint, preventing subsequent operations from executing
  • Update state.py to reject orphaned child checkpoints with exception instead of silent return
  • Add comprehensive tests for early exit behavior and orphaned child handling

When min_successful or error threshold is reached in parallel/map operations, the parent now returns immediately without waiting for remaining branches to complete. Orphaned branches are terminated on their next checkpoint attempt, preventing wasted work and ensuring correct semantics for completion criteria.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Add OrphanedChildException (BaseException) to terminate orphaned
  children when parent completes early
- Modify ThreadPoolExecutor to shutdown without waiting (wait=False)
  when completion criteria met
- Raise exception when orphaned children attempt to checkpoint,
  preventing subsequent operations from executing
- Update state.py to reject orphaned child checkpoints with exception
  instead of silent return
- Add comprehensive tests for early exit behavior and orphaned child
  handling

When min_successful or error threshold is reached in parallel/map operations,
the parent now returns immediately without waiting for remaining
branches to complete. Orphaned branches are terminated on their next
checkpoint attempt, preventing wasted work and ensuring correct
semantics for completion criteria.
@yaythomas yaythomas requested a review from wangyb-A as a code owner December 9, 2025 20:07
@yaythomas yaythomas merged commit c0dd405 into main Dec 9, 2025
15 checks passed
@yaythomas yaythomas deleted the orphaned-child-exception branch December 9, 2025 21:31
wangyb-A pushed a commit to aws/aws-durable-execution-sdk-python-testing that referenced this pull request Dec 9, 2025
- Update test case after we add early exit for concurrency
- aws/aws-durable-execution-sdk-python#242
wangyb-A pushed a commit to aws/aws-durable-execution-sdk-python-testing that referenced this pull request Dec 9, 2025
- Update test case after we add early exit for concurrency
- aws/aws-durable-execution-sdk-python#242
wangyb-A pushed a commit to aws/aws-durable-execution-sdk-python-testing that referenced this pull request Dec 9, 2025
- Update test case after we add early exit for concurrency
- aws/aws-durable-execution-sdk-python#242
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

How does this work with at most once semantics?

@ghost
Copy link

ghost commented Dec 9, 2025

Okay at most once is preserved because on termination we store any running threads as started, and on replay we won't run them again.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants