Skip to content
This repository was archived by the owner on Jun 10, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ from durable_executions_python_language_sdk.context import (
durable_step,
durable_with_child_context,
)
from durable_executions_python_language_sdk.execution import durable_handler
from durable_executions_python_language_sdk.execution import durable_execution

@durable_step
def one(a: int, b: int) -> str:
Expand All @@ -61,7 +61,7 @@ def two(ctx: DurableContext, a: int, b: int) -> str:
def three(a: int, b: int) -> str:
return f"{a} {b}"

@durable_handler
@durable_execution
def function_under_test(event: Any, context: DurableContext) -> list[str]:
results: list[str] = []

Expand Down
4 changes: 2 additions & 2 deletions examples/src/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from aws_durable_execution_sdk_python.config import CallbackConfig
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


if TYPE_CHECKING:
from aws_durable_execution_sdk_python.types import Callback


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
callback_config = CallbackConfig(timeout_seconds=120, heartbeat_timeout_seconds=60)

Expand Down
4 changes: 2 additions & 2 deletions examples/src/callback_with_timeout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from aws_durable_execution_sdk_python.config import CallbackConfig
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


if TYPE_CHECKING:
from aws_durable_execution_sdk_python.types import Callback


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Callback with custom timeout configuration
config = CallbackConfig(timeout_seconds=60, heartbeat_timeout_seconds=30)
Expand Down
4 changes: 2 additions & 2 deletions examples/src/hello_world.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, _context: DurableContext) -> str:
"""Simple hello world durable function."""
return "Hello World!"
4 changes: 2 additions & 2 deletions examples/src/map_operations.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


def square(x: int) -> int:
return x * x


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Process a list of items using map-like operations
items = [1, 2, 3, 4, 5]
Expand Down
4 changes: 2 additions & 2 deletions examples/src/parallel.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Execute multiple operations in parallel
task1 = context.step(lambda _: "Task 1 complete", name="task1")
Expand Down
4 changes: 2 additions & 2 deletions examples/src/parallel_first_successful.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from aws_durable_execution_sdk_python.config import CompletionConfig, ParallelConfig
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Parallel execution with first_successful completion strategy
config = ParallelConfig(completion_config=CompletionConfig.first_successful())
Expand Down
4 changes: 2 additions & 2 deletions examples/src/run_in_child_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
DurableContext,
durable_with_child_context,
)
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


def multiply_by_two(value: int) -> int:
Expand All @@ -16,7 +16,7 @@ def child_operation(ctx: DurableContext, value: int) -> int:
return ctx.step(lambda _: multiply_by_two(value), name="multiply")


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
result = context.run_in_child_context(child_operation(5))
return f"Child context result: {result}"
4 changes: 2 additions & 2 deletions examples/src/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
StepContext,
durable_step,
)
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_step
def add_numbers(_step_context: StepContext, a: int, b: int) -> int:
return a + b


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> int:
result: int = context.step(add_numbers(5, 3))
return result
4 changes: 2 additions & 2 deletions examples/src/step_no_name.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Step without explicit name - should use function name
result = context.step(lambda _: "Step without name")
Expand Down
4 changes: 2 additions & 2 deletions examples/src/step_semantics_at_most_once.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

from aws_durable_execution_sdk_python.config import StepConfig, StepSemantics
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Step with AT_MOST_ONCE_PER_RETRY semantics
config = StepConfig(step_semantics=StepSemantics.AT_MOST_ONCE_PER_RETRY)
Expand Down
4 changes: 2 additions & 2 deletions examples/src/step_with_exponential_backoff.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

from aws_durable_execution_sdk_python.config import StepConfig
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution
from aws_durable_execution_sdk_python.retries import (
RetryStrategyConfig,
create_retry_strategy,
)


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Step with exponential backoff retry strategy
retry_config = RetryStrategyConfig(
Expand Down
4 changes: 2 additions & 2 deletions examples/src/step_with_name.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Step with explicit name
result = context.step(lambda _: "Step with explicit name", name="custom_step")
Expand Down
4 changes: 2 additions & 2 deletions examples/src/step_with_retry.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
DurableContext,
durable_step,
)
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution
from aws_durable_execution_sdk_python.retries import (
RetryStrategyConfig,
create_retry_strategy,
Expand All @@ -22,7 +22,7 @@ def unreliable_operation() -> str:
return "Operation succeeded"


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
retry_config = RetryStrategyConfig(
max_attempts=3,
Expand Down
4 changes: 2 additions & 2 deletions examples/src/wait.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
context.wait(seconds=5)
return "Wait completed"
4 changes: 2 additions & 2 deletions examples/src/wait_for_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from aws_durable_execution_sdk_python.config import WaitForCallbackConfig
from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


def external_system_call(_callback_id: str) -> None:
Expand All @@ -11,7 +11,7 @@ def external_system_call(_callback_id: str) -> None:
# passing the callback_id for the system to call back when done


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
config = WaitForCallbackConfig(timeout_seconds=120, heartbeat_timeout_seconds=60)

Expand Down
4 changes: 2 additions & 2 deletions examples/src/wait_with_name.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Any

from aws_durable_execution_sdk_python.context import DurableContext
from aws_durable_execution_sdk_python.execution import durable_handler
from aws_durable_execution_sdk_python.execution import durable_execution


@durable_handler
@durable_execution
def handler(_event: Any, context: DurableContext) -> str:
# Wait with explicit name
context.wait(seconds=2, name="custom_wait")
Expand Down
6 changes: 3 additions & 3 deletions src/aws_durable_execution_sdk_python_testing/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import boto3 # type: ignore
from aws_durable_execution_sdk_python.execution import (
InvocationStatus,
durable_handler,
durable_execution,
)
from aws_durable_execution_sdk_python.lambda_service import (
ErrorObject,
Expand Down Expand Up @@ -533,8 +533,8 @@ def __init__(
*args,
**kwargs,
):
# wrap the durable context around a durable handler as a convenience to run directly
@durable_handler
# wrap the durable context around a durable execution handler as a convenience to run directly
@durable_execution
def handler(event: Any, context: DurableContext): # noqa: ARG001
return context_function(*args, **kwargs)(context)

Expand Down
7 changes: 5 additions & 2 deletions tests/e2e/basic_success_path_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
durable_step,
durable_with_child_context,
)
from aws_durable_execution_sdk_python.execution import InvocationStatus, durable_handler
from aws_durable_execution_sdk_python.execution import (
InvocationStatus,
durable_execution,
)
from aws_durable_execution_sdk_python.types import StepContext

from aws_durable_execution_sdk_python_testing.runner import (
Expand Down Expand Up @@ -47,7 +50,7 @@ def three(step_context: StepContext, a: int, b: int) -> str:
# print("[DEBUG] three called")
return f"{a} {b}"

@durable_handler
@durable_execution
def function_under_test(event: Any, context: DurableContext) -> list[str]:
results: list[str] = []

Expand Down
32 changes: 16 additions & 16 deletions tests/runner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,9 +933,9 @@ def test_durable_function_test_result_create_with_parent_operations():
@patch("aws_durable_execution_sdk_python_testing.runner.InMemoryServiceClient")
@patch("aws_durable_execution_sdk_python_testing.runner.InProcessInvoker")
@patch("aws_durable_execution_sdk_python_testing.runner.Executor")
@patch("aws_durable_execution_sdk_python_testing.runner.durable_handler")
@patch("aws_durable_execution_sdk_python_testing.runner.durable_execution")
def test_durable_context_test_runner_init(
mock_durable_handler,
mock_durable_execution_handler,
mock_executor,
mock_invoker,
mock_client,
Expand All @@ -946,7 +946,7 @@ def test_durable_context_test_runner_init(
"""Test DurableContextTestRunner initialization."""
handler = Mock()
decorated_handler = Mock()
mock_durable_handler.return_value = decorated_handler
mock_durable_execution_handler.return_value = decorated_handler

DurableChildContextTestRunner(handler) # type: ignore

Expand All @@ -964,15 +964,15 @@ def test_durable_context_test_runner_init(
mock_executor.return_value
)

# Verify durable_handler was called (with internal lambda function)
mock_durable_handler.assert_called_once()
# Verify durable_execution was called (with internal lambda function)
mock_durable_execution_handler.assert_called_once()

# Verify the lambda function calls our handler
durable_handler_func = mock_durable_handler.call_args.args[0]
assert callable(durable_handler_func)
durable_execution_func = mock_durable_execution_handler.call_args.args[0]
assert callable(durable_execution_func)

# verify handler is called when durable function is invoked
durable_handler_func(Mock(), Mock())
durable_execution_func(Mock(), Mock())
handler.assert_called_once()


Expand All @@ -982,9 +982,9 @@ def test_durable_context_test_runner_init(
@patch("aws_durable_execution_sdk_python_testing.runner.InMemoryServiceClient")
@patch("aws_durable_execution_sdk_python_testing.runner.InProcessInvoker")
@patch("aws_durable_execution_sdk_python_testing.runner.Executor")
@patch("aws_durable_execution_sdk_python_testing.runner.durable_handler")
@patch("aws_durable_execution_sdk_python_testing.runner.durable_execution")
def test_durable_child_context_test_runner_init_with_args(
mock_durable_handler,
mock_durable_execution_handler,
mock_executor,
mock_invoker,
mock_client,
Expand All @@ -995,7 +995,7 @@ def test_durable_child_context_test_runner_init_with_args(
"""Test DurableChildContextTestRunner initialization with additional args."""
handler = Mock()
decorated_handler = Mock()
mock_durable_handler.return_value = decorated_handler
mock_durable_execution_handler.return_value = decorated_handler

str_input = "a random string input"
num_input = 10
Expand All @@ -1015,12 +1015,12 @@ def test_durable_child_context_test_runner_init_with_args(
mock_executor.return_value
)

# Verify durable_handler was called (with internal lambda function)
mock_durable_handler.assert_called_once()
# Verify durable_execution was called (with internal lambda function)
mock_durable_execution_handler.assert_called_once()
# Verify the lambda function calls our handler
durable_handler_func = mock_durable_handler.call_args.args[0]
assert callable(durable_handler_func)
durable_execution_func = mock_durable_execution_handler.call_args.args[0]
assert callable(durable_execution_func)

# verify that handler is called with expected args when durable function is invoked
durable_handler_func(Mock(), Mock())
durable_execution_func(Mock(), Mock())
handler.assert_called_once_with(str_input, num=num_input)
Loading