Skip to content

Commit 3744185

Browse files
committed
fix: use datetime for InvocationCompletedDetails timestamps
1 parent de37171 commit 3744185

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

src/aws_durable_execution_sdk_python_testing/execution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def has_pending_operations(self, execution: Execution) -> bool:
225225
return False
226226

227227
def record_invocation_completion(
228-
self, start_timestamp: float, end_timestamp: float, request_id: str
228+
self, start_timestamp: datetime, end_timestamp: datetime, request_id: str
229229
) -> None:
230230
"""Record an invocation completion event."""
231231
self.invocation_completions.append(

src/aws_durable_execution_sdk_python_testing/executor.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -419,9 +419,7 @@ def get_execution_history(
419419
for completion in execution.invocation_completions:
420420
invocation_event = HistoryEvent.create_invocation_completed(
421421
event_id=0, # Temporary, will be reassigned
422-
event_timestamp=datetime.fromtimestamp(
423-
completion.end_timestamp, tz=UTC
424-
),
422+
event_timestamp=completion.end_timestamp,
425423
start_timestamp=completion.start_timestamp,
426424
end_timestamp=completion.end_timestamp,
427425
request_id=completion.request_id,
@@ -784,13 +782,13 @@ async def invoke() -> None:
784782

785783
self._store.save(execution)
786784

787-
invocation_start = time.time()
785+
invocation_start = datetime.now(UTC)
788786
invoke_response = self._invoker.invoke(
789787
execution.start_input.function_name,
790788
invocation_input,
791789
execution.start_input.lambda_endpoint,
792790
)
793-
invocation_end = time.time()
791+
invocation_end = datetime.now(UTC)
794792

795793
# Reload execution after invocation in case it was completed via checkpoint
796794
execution = self._store.load(execution_arn)

src/aws_durable_execution_sdk_python_testing/model.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,8 +1227,8 @@ def to_dict(self) -> dict[str, Any]:
12271227
class InvocationCompletedDetails:
12281228
"""Invocation completed event details."""
12291229

1230-
start_timestamp: float
1231-
end_timestamp: float
1230+
start_timestamp: datetime.datetime
1231+
end_timestamp: datetime.datetime
12321232
request_id: str
12331233

12341234
@classmethod
@@ -2261,8 +2261,8 @@ def create_invocation_completed(
22612261
cls,
22622262
event_id: int,
22632263
event_timestamp: datetime.datetime,
2264-
start_timestamp: float,
2265-
end_timestamp: float,
2264+
start_timestamp: datetime.datetime,
2265+
end_timestamp: datetime.datetime,
22662266
request_id: str,
22672267
) -> Event:
22682268
"""Create invocation completed event."""

0 commit comments

Comments
 (0)