diff --git a/src/aws_durable_execution_sdk_python/lambda_service.py b/src/aws_durable_execution_sdk_python/lambda_service.py index 21a692d..8d06112 100644 --- a/src/aws_durable_execution_sdk_python/lambda_service.py +++ b/src/aws_durable_execution_sdk_python/lambda_service.py @@ -219,10 +219,14 @@ def to_dict(self) -> MutableMapping[str, Any]: @dataclass(frozen=True) class WaitOptions: - seconds: int = 0 + wait_seconds: int = 0 + + @classmethod + def from_dict(cls, data: MutableMapping[str, Any]) -> WaitOptions: + return cls(wait_seconds=data.get("WaitSeconds", 0)) def to_dict(self) -> MutableMapping[str, Any]: - return {"WaitSeconds": self.seconds} + return {"WaitSeconds": self.wait_seconds} @dataclass(frozen=True) diff --git a/src/aws_durable_execution_sdk_python/operation/wait.py b/src/aws_durable_execution_sdk_python/operation/wait.py index 84d891a..9890e33 100644 --- a/src/aws_durable_execution_sdk_python/operation/wait.py +++ b/src/aws_durable_execution_sdk_python/operation/wait.py @@ -43,7 +43,7 @@ def wait_handler( if not checkpointed_result.is_existent(): operation = OperationUpdate.create_wait_start( identifier=operation_identifier, - wait_options=WaitOptions(seconds=seconds), + wait_options=WaitOptions(wait_seconds=seconds), ) state.create_checkpoint(operation_update=operation) diff --git a/tests/e2e/execution_int_test.py b/tests/e2e/execution_int_test.py index 815d342..fdbcff3 100644 --- a/tests/e2e/execution_int_test.py +++ b/tests/e2e/execution_int_test.py @@ -305,7 +305,7 @@ def mock_checkpoint( assert second_checkpoint.operation_type is OperationType.WAIT assert second_checkpoint.action is OperationAction.START assert second_checkpoint.operation_id == "1-1" - assert second_checkpoint.wait_options.seconds == 1 + assert second_checkpoint.wait_options.wait_seconds == 1 mock_inside_child.assert_called_once_with(10, 20) @@ -390,4 +390,4 @@ def mock_checkpoint( assert checkpoint.operation_type is OperationType.WAIT assert checkpoint.action is OperationAction.START assert checkpoint.operation_id == "1" - assert checkpoint.wait_options.seconds == 1 + assert checkpoint.wait_options.wait_seconds == 1 diff --git a/tests/lambda_service_test.py b/tests/lambda_service_test.py index 8f4b1ce..3d8e009 100644 --- a/tests/lambda_service_test.py +++ b/tests/lambda_service_test.py @@ -315,7 +315,7 @@ def test_step_options_to_dict(): def test_wait_options_to_dict(): """Test WaitOptions.to_dict method.""" - options = WaitOptions(seconds=60) + options = WaitOptions(wait_seconds=60) result = options.to_dict() assert result == {"WaitSeconds": 60} @@ -394,7 +394,7 @@ def test_operation_update_to_dict_complete(): message="Test error", type="TestError", data=None, stack_trace=None ) step_options = StepOptions(next_attempt_delay_seconds=30) - wait_options = WaitOptions(seconds=60) + wait_options = WaitOptions(wait_seconds=60) callback_options = CallbackOptions( timeout_seconds=300, heartbeat_timeout_seconds=60 ) @@ -463,7 +463,7 @@ def test_operation_update_create_callback(): def test_operation_update_create_wait_start(): """Test OperationUpdate.create_wait_start factory method.""" - wait_options = WaitOptions(seconds=30) + wait_options = WaitOptions(wait_seconds=30) update = OperationUpdate.create_wait_start( OperationIdentifier("wait1", "parent1", "test_wait"), wait_options ) @@ -581,7 +581,7 @@ def test_operation_update_with_parent_id(): def test_operation_update_wait_and_invoke_types(): """Test OperationUpdate with WAIT and INVOKE operation types.""" # Test WAIT operation - wait_options = WaitOptions(seconds=30) + wait_options = WaitOptions(wait_seconds=30) wait_update = OperationUpdate( operation_id="wait_op", operation_type=OperationType.WAIT, @@ -1029,7 +1029,7 @@ def test_durable_service_client_protocol_stop(): def test_operation_update_create_wait(): """Test OperationUpdate factory method for WAIT operations.""" - wait_options = WaitOptions(seconds=30) + wait_options = WaitOptions(wait_seconds=30) update = OperationUpdate( operation_id="wait1", operation_type=OperationType.WAIT, @@ -1334,7 +1334,7 @@ def test_operation_update_complete_with_new_fields(): ) context_options = ContextOptions(replay_children=True) step_options = StepOptions(next_attempt_delay_seconds=30) - wait_options = WaitOptions(seconds=60) + wait_options = WaitOptions(wait_seconds=60) callback_options = CallbackOptions( timeout_seconds=300, heartbeat_timeout_seconds=60 ) diff --git a/tests/operation/wait_test.py b/tests/operation/wait_test.py index 569886c..17b9de9 100644 --- a/tests/operation/wait_test.py +++ b/tests/operation/wait_test.py @@ -57,7 +57,7 @@ def test_wait_handler_not_completed(): operation_type=OperationType.WAIT, action=OperationAction.START, sub_type=OperationSubType.WAIT, - wait_options=WaitOptions(seconds=30), + wait_options=WaitOptions(wait_seconds=30), ) mock_state.create_checkpoint.assert_called_once_with( operation_update=expected_operation @@ -85,7 +85,7 @@ def test_wait_handler_with_none_name(): operation_type=OperationType.WAIT, action=OperationAction.START, sub_type=OperationSubType.WAIT, - wait_options=WaitOptions(seconds=5), + wait_options=WaitOptions(wait_seconds=5), ) mock_state.create_checkpoint.assert_called_once_with( operation_update=expected_operation