Skip to content
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 src/aws_durable_execution_sdk_python/lambda_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def create_context_fail(
def create_execution_succeed(cls, payload: str) -> OperationUpdate:
"""Create an instance of OperationUpdate for type: EXECUTION, action: SUCCEED."""
return cls(
operation_id=f"execution-result-{datetime.datetime.now(tz=datetime.UTC)}",
operation_id=f"execution-result-{int(datetime.datetime.now(tz=datetime.UTC).timestamp() * 1000)}",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

align with what ts doing right now

operation_type=OperationType.EXECUTION,
action=OperationAction.SUCCEED,
payload=payload,
Expand All @@ -505,7 +505,7 @@ def create_execution_succeed(cls, payload: str) -> OperationUpdate:
def create_execution_fail(cls, error: ErrorObject) -> OperationUpdate:
"""Create an instance of OperationUpdate for type: EXECUTION, action: FAIL."""
return cls(
operation_id=f"execution-result-{datetime.datetime.now(tz=datetime.UTC)}",
operation_id=f"execution-result-{int(datetime.datetime.now(tz=datetime.UTC).timestamp() * 1000)}",
operation_type=OperationType.EXECUTION,
action=OperationAction.FAIL,
error=error,
Expand Down
7 changes: 5 additions & 2 deletions tests/lambda_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,9 +686,12 @@ def test_operation_update_create_wait_start():
@patch("aws_durable_execution_sdk_python.lambda_service.datetime")
def test_operation_update_create_execution_succeed(mock_datetime):
"""Test OperationUpdate.create_execution_succeed factory method."""
mock_datetime.datetime.now.return_value = "2023-01-01"

mock_datetime.datetime.now.return_value = datetime.datetime.fromtimestamp(
1672531200.0, tz=datetime.UTC
)
update = OperationUpdate.create_execution_succeed("success_payload")
assert update.operation_id == "execution-result-2023-01-01"
assert update.operation_id == "execution-result-1672531200000"
assert update.operation_type == OperationType.EXECUTION
assert update.action == OperationAction.SUCCEED
assert update.payload == "success_payload"
Expand Down