Skip to content

Commit 22cfe56

Browse files
committed
fix: update StartDate to StartTimestamp and StopDate to EndTimestamp
1 parent b8eb7ba commit 22cfe56

2 files changed

Lines changed: 25 additions & 23 deletions

File tree

src/aws_durable_execution_sdk_python_testing/executor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,15 @@ def get_execution_details(self, execution_arn: str) -> GetDurableExecutionRespon
142142
durable_execution_name=execution.start_input.execution_name,
143143
function_arn=f"arn:aws:lambda:us-east-1:123456789012:function:{execution.start_input.function_name}",
144144
status=status,
145-
start_date=execution_op.start_timestamp.isoformat()
145+
start_timestamp=execution_op.start_timestamp.isoformat()
146146
if execution_op.start_timestamp
147147
else datetime.now(UTC).isoformat(),
148148
input_payload=execution_op.execution_details.input_payload
149149
if execution_op.execution_details
150150
else None,
151151
result=result,
152152
error=error,
153-
stop_date=execution_op.end_timestamp.isoformat()
153+
end_timestamp=execution_op.end_timestamp.isoformat()
154154
if execution_op.end_timestamp
155155
else None,
156156
version="1.0",
@@ -223,17 +223,17 @@ def list_executions(
223223
durable_execution_name=execution.start_input.execution_name,
224224
function_arn=f"arn:aws:lambda:us-east-1:123456789012:function:{execution.start_input.function_name}",
225225
status=execution_status,
226-
start_date=execution_op.start_timestamp.isoformat()
226+
start_timestamp=execution_op.start_timestamp.isoformat()
227227
if execution_op.start_timestamp
228228
else datetime.now(UTC).isoformat(),
229-
stop_date=execution_op.end_timestamp.isoformat()
229+
end_timestamp=execution_op.end_timestamp.isoformat()
230230
if execution_op.end_timestamp
231231
else None,
232232
)
233233
filtered_executions.append(execution_summary)
234234

235235
# Sort by start date
236-
filtered_executions.sort(key=lambda e: e.start_date, reverse=reverse_order)
236+
filtered_executions.sort(key=lambda e: e.start_timestamp, reverse=reverse_order)
237237

238238
# Apply pagination
239239
if max_items is None:
@@ -333,7 +333,7 @@ def stop_execution(
333333
# Stop the execution
334334
self.fail_execution(execution_arn, stop_error)
335335

336-
return StopDurableExecutionResponse(stop_date=datetime.now(UTC).isoformat())
336+
return StopDurableExecutionResponse(end_timestamp=datetime.now(UTC).isoformat())
337337

338338
def get_execution_state(
339339
self,

src/aws_durable_execution_sdk_python_testing/model.py

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ class GetDurableExecutionResponse:
131131
durable_execution_name: str
132132
function_arn: str
133133
status: str
134-
start_date: str
134+
start_timestamp: str
135135
input_payload: str | None = None
136136
result: str | None = None
137137
error: ErrorObject | None = None
138-
stop_date: str | None = None
138+
end_timestamp: str | None = None
139139
version: str | None = None
140140

141141
@classmethod
@@ -149,11 +149,11 @@ def from_dict(cls, data: dict) -> GetDurableExecutionResponse:
149149
durable_execution_name=data["DurableExecutionName"],
150150
function_arn=data["FunctionArn"],
151151
status=data["Status"],
152-
start_date=data["StartDate"],
152+
start_timestamp=data["StartTimestamp"],
153153
input_payload=data.get("InputPayload"),
154154
result=data.get("Result"),
155155
error=error,
156-
stop_date=data.get("StopDate"),
156+
end_timestamp=data.get("EndTimestamp"),
157157
version=data.get("Version"),
158158
)
159159

@@ -163,16 +163,18 @@ def to_dict(self) -> dict[str, Any]:
163163
"DurableExecutionName": self.durable_execution_name,
164164
"FunctionArn": self.function_arn,
165165
"Status": self.status,
166-
"StartDate": self.start_date,
166+
"StartTimestamp": self.start_timestamp,
167167
}
168168
if self.input_payload is not None:
169169
result["InputPayload"] = self.input_payload
170170
if self.result is not None:
171171
result["Result"] = self.result
172172
if self.error is not None:
173173
result["Error"] = self.error.to_dict()
174-
if self.stop_date is not None:
175-
result["StopDate"] = self.stop_date
174+
if self.end_timestamp is not None:
175+
result["EndTimestamp"] = self.end_timestamp
176+
if self.end_timestamp is not None:
177+
result["EndTimestamp"] = self.end_timestamp
176178
if self.version is not None:
177179
result["Version"] = self.version
178180
return result
@@ -186,8 +188,8 @@ class Execution:
186188
durable_execution_name: str
187189
function_arn: str
188190
status: str
189-
start_date: str
190-
stop_date: str | None = None
191+
start_timestamp: str
192+
end_timestamp: str | None = None
191193

192194
@classmethod
193195
def from_dict(cls, data: dict) -> Execution:
@@ -198,21 +200,21 @@ def from_dict(cls, data: dict) -> Execution:
198200
"FunctionArn", ""
199201
), # Make optional for backward compatibility
200202
status=data["Status"],
201-
start_date=data["StartDate"],
202-
stop_date=data.get("StopDate"),
203+
start_timestamp=data["StartTimestamp"],
204+
end_timestamp=data.get("EndTimestamp"),
203205
)
204206

205207
def to_dict(self) -> dict[str, Any]:
206208
result = {
207209
"DurableExecutionArn": self.durable_execution_arn,
208210
"DurableExecutionName": self.durable_execution_name,
209211
"Status": self.status,
210-
"StartDate": self.start_date,
212+
"StartTimestamp": self.start_timestamp,
211213
}
212214
if self.function_arn: # Only include if not empty
213215
result["FunctionArn"] = self.function_arn
214-
if self.stop_date is not None:
215-
result["StopDate"] = self.stop_date
216+
if self.end_timestamp is not None:
217+
result["EndTimestamp"] = self.end_timestamp
216218
return result
217219

218220

@@ -323,14 +325,14 @@ def to_dict(self) -> dict[str, Any]:
323325
class StopDurableExecutionResponse:
324326
"""Response from stopping a durable execution."""
325327

326-
stop_date: str
328+
end_timestamp: str
327329

328330
@classmethod
329331
def from_dict(cls, data: dict) -> StopDurableExecutionResponse:
330-
return cls(stop_date=data["StopDate"])
332+
return cls(end_timestamp=data["EndTimestamp"])
331333

332334
def to_dict(self) -> dict[str, Any]:
333-
return {"StopDate": self.stop_date}
335+
return {"EndTimestamp": self.end_timestamp}
334336

335337

336338
@dataclass(frozen=True)

0 commit comments

Comments
 (0)