Skip to content

[refactor]: use an executor class instead of closure#375

Merged
zhongkechen merged 2 commits intomainfrom
executor
May 5, 2026
Merged

[refactor]: use an executor class instead of closure#375
zhongkechen merged 2 commits intomainfrom
executor

Conversation

@zhongkechen
Copy link
Copy Markdown
Contributor

@zhongkechen zhongkechen commented May 4, 2026

Issue #, if available:

Useful for #370

Description of changes:

Added DurableExecutionExecutor class to wrap the required fields that were previously shared via closure.

  • This would make it easier to add more fields later like plugins.
  • This would make it easier to split the big method into smaller pieces

plugins and more fields will be added to this new class to be shared across methods.

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

@zhongkechen zhongkechen force-pushed the executor branch 2 times, most recently from 6c6dcb7 to 04814a9 Compare May 4, 2026 21:25
@zhongkechen zhongkechen marked this pull request as draft May 4, 2026 21:28
@zhongkechen zhongkechen force-pushed the executor branch 11 times, most recently from 584c93c to 725d8af Compare May 5, 2026 00:28
@zhongkechen zhongkechen marked this pull request as ready for review May 5, 2026 00:50
@zhongkechen zhongkechen requested a review from a team May 5, 2026 17:11
@zhongkechen zhongkechen self-assigned this May 5, 2026
Comment thread src/aws_durable_execution_sdk_python/execution.py
@zhongkechen zhongkechen merged commit 5f4b23e into main May 5, 2026
66 of 67 checks passed
@zhongkechen zhongkechen deleted the executor branch May 5, 2026 17:40
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
exception=ExecutionError(msg), retryable=True
)
# add a redundant raise to make type checker happy
raise ExecutionError(msg)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nervous about this. if _handle_execution_output behaves surprisingly, this ends up becoming a problem.

Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py
Comment thread src/aws_durable_execution_sdk_python/execution.py

def handle_checkpoint_error(error: CheckpointError) -> DurableExecutionInvocationOutput:
if error.is_retryable():
raise error from None # Terminate Lambda immediately and have it be retried
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this from None is also a behaviour change.

This one was intentional?

Copy link
Copy Markdown
Contributor Author

@zhongkechen zhongkechen May 6, 2026

Choose a reason for hiding this comment

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

This might be a real concern. From None or bare raise should be used, otherwise the exception will be chained with redundant info.

else:
try:
logger.debug(
"durableExecutionArn: %s", event.get("DurableExecutionArn")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this would log before attempting to parse, so if something goes wrong at least maybe the Arn is in the output. Now it only logs on success?

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.

3 participants