Skip to content

Commit ca8de6b

Browse files
author
Alex Wang
committed
chore: update sdk model path
- Update sdk model path from parent folder to src folder - Add a lambda client initialization test case
1 parent bb1f2e9 commit ca8de6b

4 files changed

Lines changed: 100 additions & 35 deletions

File tree

botocore/data/lambdainternal-local/2015-03-31/service-2.json renamed to src/aws_durable_execution_sdk_python/botocore/data/lambdainternal-local/2015-03-31/service-2.json

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"name":"CheckpointDurableExecution",
1616
"http":{
1717
"method":"POST",
18-
"requestUri":"/2025-12-01/durable-execution-state/{CheckpointToken}/checkpoint",
18+
"requestUri":"/2025-12-01/durable-executions/{DurableExecutionArn}/checkpoint",
1919
"responseCode":200
2020
},
2121
"input":{"shape":"CheckpointDurableExecutionRequest"},
@@ -47,7 +47,7 @@
4747
"name":"GetDurableExecutionState",
4848
"http":{
4949
"method":"GET",
50-
"requestUri":"/2025-12-01/durable-execution-state/{CheckpointToken}/getState",
50+
"requestUri":"/2025-12-01/durable-executions/{DurableExecutionArn}/state",
5151
"responseCode":200
5252
},
5353
"input":{"shape":"GetDurableExecutionStateRequest"},
@@ -56,7 +56,8 @@
5656
{"shape":"InvalidParameterValueException"},
5757
{"shape":"TooManyRequestsException"},
5858
{"shape":"ServiceException"}
59-
]
59+
],
60+
"readonly":true
6061
},
6162
"GetDurableExecutionHistory":{
6263
"name":"GetDurableExecutionHistory",
@@ -141,13 +142,17 @@
141142
"shapes":{
142143
"CheckpointDurableExecutionRequest":{
143144
"type":"structure",
144-
"required":["CheckpointToken"],
145+
"required":[
146+
"DurableExecutionArn",
147+
"CheckpointToken"
148+
],
145149
"members":{
146-
"CheckpointToken":{
147-
"shape":"CheckpointToken",
150+
"DurableExecutionArn":{
151+
"shape":"DurableExecutionArn",
148152
"location":"uri",
149-
"locationName":"CheckpointToken"
153+
"locationName":"DurableExecutionArn"
150154
},
155+
"CheckpointToken":{"shape":"CheckpointToken"},
151156
"Updates":{"shape":"OperationUpdates"},
152157
"ClientToken":{"shape":"ClientToken"}
153158
}
@@ -168,6 +173,11 @@
168173
}
169174
},
170175
"ClientToken":{"type":"string"},
176+
"DurableExecutionArn":{
177+
"type":"string",
178+
"max":1024,
179+
"min":1
180+
},
171181
"GetDurableExecutionRequest":{
172182
"type":"structure",
173183
"required":["DurableExecutionArn"],
@@ -195,15 +205,31 @@
195205
},
196206
"GetDurableExecutionStateRequest":{
197207
"type":"structure",
198-
"required":["CheckpointToken"],
208+
"required":[
209+
"DurableExecutionArn",
210+
"CheckpointToken"
211+
],
199212
"members":{
213+
"DurableExecutionArn":{
214+
"shape":"DurableExecutionArn",
215+
"location":"uri",
216+
"locationName":"DurableExecutionArn"
217+
},
200218
"CheckpointToken":{
201219
"shape":"CheckpointToken",
202-
"location":"uri",
220+
"location":"querystring",
203221
"locationName":"CheckpointToken"
204222
},
205-
"MaxItems":{"shape":"Integer"},
206-
"Marker":{"shape":"String"}
223+
"Marker":{
224+
"shape":"PaginationMarker",
225+
"location":"querystring",
226+
"locationName":"Marker"
227+
},
228+
"MaxItems":{
229+
"shape":"ItemCount",
230+
"location":"querystring",
231+
"locationName":"MaxItems"
232+
}
207233
}
208234
},
209235
"GetDurableExecutionStateResponse":{

botocore/data/lambdainternal/2015-03-31/service-2.json renamed to src/aws_durable_execution_sdk_python/botocore/data/lambdainternal/2015-03-31/service-2.json

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"name":"CheckpointDurableExecution",
1515
"http":{
1616
"method":"POST",
17-
"requestUri":"/2025-12-01/durable-execution-state/{CheckpointToken}/checkpoint",
17+
"requestUri":"/2025-12-01/durable-executions/{DurableExecutionArn}/checkpoint",
1818
"responseCode":200
1919
},
2020
"input":{"shape":"CheckpointDurableExecutionRequest"},
@@ -46,7 +46,7 @@
4646
"name":"GetDurableExecutionState",
4747
"http":{
4848
"method":"GET",
49-
"requestUri":"/2025-12-01/durable-execution-state/{CheckpointToken}/getState",
49+
"requestUri":"/2025-12-01/durable-executions/{DurableExecutionArn}/state",
5050
"responseCode":200
5151
},
5252
"input":{"shape":"GetDurableExecutionStateRequest"},
@@ -55,7 +55,8 @@
5555
{"shape":"InvalidParameterValueException"},
5656
{"shape":"TooManyRequestsException"},
5757
{"shape":"ServiceException"}
58-
]
58+
],
59+
"readonly":true
5960
},
6061
"GetDurableExecutionHistory":{
6162
"name":"GetDurableExecutionHistory",
@@ -140,13 +141,17 @@
140141
"shapes":{
141142
"CheckpointDurableExecutionRequest":{
142143
"type":"structure",
143-
"required":["CheckpointToken"],
144+
"required":[
145+
"DurableExecutionArn",
146+
"CheckpointToken"
147+
],
144148
"members":{
145-
"CheckpointToken":{
146-
"shape":"CheckpointToken",
149+
"DurableExecutionArn":{
150+
"shape":"DurableExecutionArn",
147151
"location":"uri",
148-
"locationName":"CheckpointToken"
152+
"locationName":"DurableExecutionArn"
149153
},
154+
"CheckpointToken":{"shape":"CheckpointToken"},
150155
"Updates":{"shape":"OperationUpdates"},
151156
"ClientToken":{"shape":"ClientToken"}
152157
}
@@ -167,6 +172,11 @@
167172
}
168173
},
169174
"ClientToken":{"type":"string"},
175+
"DurableExecutionArn":{
176+
"type":"string",
177+
"max":1024,
178+
"min":1
179+
},
170180
"GetDurableExecutionRequest":{
171181
"type":"structure",
172182
"required":["DurableExecutionArn"],
@@ -194,15 +204,31 @@
194204
},
195205
"GetDurableExecutionStateRequest":{
196206
"type":"structure",
197-
"required":["CheckpointToken"],
207+
"required":[
208+
"DurableExecutionArn",
209+
"CheckpointToken"
210+
],
198211
"members":{
212+
"DurableExecutionArn":{
213+
"shape":"DurableExecutionArn",
214+
"location":"uri",
215+
"locationName":"DurableExecutionArn"
216+
},
199217
"CheckpointToken":{
200218
"shape":"CheckpointToken",
201-
"location":"uri",
219+
"location":"querystring",
202220
"locationName":"CheckpointToken"
203221
},
204-
"MaxItems":{"shape":"Integer"},
205-
"Marker":{"shape":"String"}
222+
"Marker":{
223+
"shape":"PaginationMarker",
224+
"location":"querystring",
225+
"locationName":"Marker"
226+
},
227+
"MaxItems":{
228+
"shape":"ItemCount",
229+
"location":"querystring",
230+
"locationName":"MaxItems"
231+
}
206232
}
207233
},
208234
"GetDurableExecutionStateResponse":{

src/aws_durable_execution_sdk_python/lambda_service.py

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import datetime
44
import logging
55
import os
6-
import sys
76
from dataclasses import dataclass, field
87
from enum import Enum
8+
from pathlib import Path
99
from typing import TYPE_CHECKING, Any, Protocol
1010

1111
import boto3 # type: ignore
@@ -834,17 +834,9 @@ def load_preview_botocore_models() -> None:
834834
"""
835835
Load boto3 models from the Python path for custom preview client.
836836
"""
837-
data_paths = set()
838-
for path in sys.path:
839-
botocore_dir = os.path.join(path, "botocore")
840-
if os.path.isdir(botocore_dir):
841-
data_paths.add(os.path.join(botocore_dir, "data"))
842-
843-
new_data_path = [
844-
p for p in os.environ.get("AWS_DATA_PATH", "").split(os.pathsep) if p
845-
]
846-
new_data_path = list(set(new_data_path).union(data_paths))
847-
os.environ["AWS_DATA_PATH"] = os.pathsep.join(new_data_path)
837+
os.environ["AWS_DATA_PATH"] = str(
838+
Path(__file__).parent.joinpath("botocore", "data")
839+
)
848840

849841
@staticmethod
850842
def initialize_local_runner_client() -> LambdaClient:

tests/e2e/execution_int_test.py

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,15 @@
1010
durable_step,
1111
durable_with_child_context,
1212
)
13-
from aws_durable_execution_sdk_python.execution import InvocationStatus, durable_handler
13+
from aws_durable_execution_sdk_python.execution import (
14+
InvocationStatus,
15+
durable_handler,
16+
)
1417
from aws_durable_execution_sdk_python.lambda_context import LambdaContext
1518
from aws_durable_execution_sdk_python.lambda_service import (
1619
CheckpointOutput,
1720
CheckpointUpdatedExecutionState,
21+
LambdaClient,
1822
OperationAction,
1923
OperationType,
2024
)
@@ -382,3 +386,20 @@ def mock_checkpoint(
382386
assert checkpoint.action is OperationAction.START
383387
assert checkpoint.operation_id == "1"
384388
assert checkpoint.wait_options.seconds == 1
389+
390+
391+
def test_lambda_client_initialization():
392+
"""Test initialization of real Lambda client with specified endpoint and region."""
393+
endpoint = "https://durable.durable-functions.devo.us-west-2.lambda.aws.a2z.com"
394+
region = "us-west-2"
395+
396+
client = LambdaClient.initialize_from_endpoint_and_region(endpoint, region)
397+
398+
assert client is not None
399+
assert client.client is not None
400+
client.checkpoint(
401+
durable_execution_arn="dummy",
402+
checkpoint_token="dummy",
403+
updates=[],
404+
client_token=None,
405+
)

0 commit comments

Comments
 (0)