aws-durable-execution-sdk-python-testing 1.1.2__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- aws_durable_execution_sdk_python_testing/__about__.py +1 -1
- aws_durable_execution_sdk_python_testing/cli.py +27 -25
- aws_durable_execution_sdk_python_testing/execution.py +5 -1
- aws_durable_execution_sdk_python_testing/web/routes.py +14 -6
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/METADATA +1 -2
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/RECORD +10 -10
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/WHEEL +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/entry_points.txt +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/licenses/LICENSE +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.2.dist-info → aws_durable_execution_sdk_python_testing-1.2.1.dist-info}/licenses/NOTICE +0 -0
|
@@ -21,7 +21,9 @@ from urllib.parse import urljoin
|
|
|
21
21
|
|
|
22
22
|
import aws_durable_execution_sdk_python
|
|
23
23
|
import boto3 # type: ignore
|
|
24
|
-
import
|
|
24
|
+
from urllib.error import HTTPError, URLError
|
|
25
|
+
from urllib.request import Request, urlopen
|
|
26
|
+
|
|
25
27
|
from botocore.exceptions import ConnectionError # type: ignore
|
|
26
28
|
|
|
27
29
|
from aws_durable_execution_sdk_python_testing.exceptions import (
|
|
@@ -348,37 +350,37 @@ class CliApp:
|
|
|
348
350
|
endpoint_url = self.config.local_runner_endpoint
|
|
349
351
|
url = urljoin(endpoint_url, "/start-durable-execution")
|
|
350
352
|
|
|
351
|
-
headers = {"Content-Type": "application/json"}
|
|
352
353
|
payload = start_input.to_dict()
|
|
354
|
+
data = json.dumps(payload).encode("utf-8")
|
|
355
|
+
req = Request(
|
|
356
|
+
url,
|
|
357
|
+
data=data,
|
|
358
|
+
headers={"Content-Type": "application/json"},
|
|
359
|
+
method="POST",
|
|
360
|
+
)
|
|
353
361
|
|
|
354
|
-
response = requests.post(url, json=payload, headers=headers, timeout=30)
|
|
355
|
-
|
|
356
|
-
if response.status_code == 201: # noqa: PLR2004
|
|
357
|
-
# Success - print the response
|
|
358
|
-
result = response.json()
|
|
359
|
-
print(json.dumps(result, indent=2)) # noqa: T201
|
|
360
|
-
return 0
|
|
361
|
-
|
|
362
|
-
# Error - print error details
|
|
363
362
|
try:
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
363
|
+
with urlopen(req, timeout=10) as response: # noqa: S310
|
|
364
|
+
result = json.loads(response.read().decode("utf-8"))
|
|
365
|
+
print(json.dumps(result, indent=2)) # noqa: T201
|
|
366
|
+
return 0
|
|
367
|
+
except HTTPError as e:
|
|
368
|
+
try:
|
|
369
|
+
error_data = json.loads(e.read().decode("utf-8"))
|
|
370
|
+
logger.exception("HTTP error response")
|
|
371
|
+
print( # noqa: T201
|
|
372
|
+
f"Error: {error_data.get('ErrorMessage', 'Unknown error')}",
|
|
373
|
+
file=sys.stderr,
|
|
374
|
+
)
|
|
375
|
+
except json.JSONDecodeError:
|
|
376
|
+
logger.exception("Non-JSON error response")
|
|
377
|
+
return 1
|
|
378
|
+
|
|
379
|
+
except URLError:
|
|
375
380
|
logger.exception(
|
|
376
381
|
"Error: Could not connect to the local runner server. Is it running?"
|
|
377
382
|
)
|
|
378
383
|
return 1
|
|
379
|
-
except requests.exceptions.Timeout:
|
|
380
|
-
logger.exception("Request timeout")
|
|
381
|
-
return 1
|
|
382
384
|
except Exception:
|
|
383
385
|
logger.exception("Unexpected error in invoke command")
|
|
384
386
|
return 1
|
|
@@ -91,7 +91,11 @@ class Execution:
|
|
|
91
91
|
# Pattern: arn:(aws[a-zA-Z-]*)?:lambda:[a-z]{2}(-gov)?-[a-z]+-\d{1}:\d{12}:durable-execution:[a-zA-Z0-9-_\.]+:[a-zA-Z0-9-_\.]+:[a-zA-Z0-9-_\.]+
|
|
92
92
|
# Example: arn:aws:lambda:us-east-1:123456789012:durable-execution:myDurableFunction:myDurableExecutionName:ce67da72-3701-4f83-9174-f4189d27b0a5
|
|
93
93
|
return Execution(
|
|
94
|
-
durable_execution_arn=str(uuid4())
|
|
94
|
+
durable_execution_arn=str(uuid4())
|
|
95
|
+
+ "/"
|
|
96
|
+
+ (input.invocation_id or str(uuid4())),
|
|
97
|
+
start_input=input,
|
|
98
|
+
operations=[],
|
|
95
99
|
)
|
|
96
100
|
|
|
97
101
|
def to_json_dict(self) -> dict[str, Any]:
|
|
@@ -39,14 +39,22 @@ class Route:
|
|
|
39
39
|
def from_string(cls, path: str) -> Route:
|
|
40
40
|
"""Create a Route from a string.
|
|
41
41
|
|
|
42
|
+
Each segment is URL-decoded; ``raw_path`` is preserved as the
|
|
43
|
+
original wire path. Splitting on ``/`` happens before decoding so
|
|
44
|
+
that an encoded ``%2F`` inside a captured value (e.g. an ARN that
|
|
45
|
+
contains ``/``) stays inside its segment instead of being treated
|
|
46
|
+
as a path separator.
|
|
47
|
+
|
|
42
48
|
Args:
|
|
43
49
|
path: The raw path string
|
|
44
50
|
|
|
45
51
|
Returns:
|
|
46
|
-
Route instance with parsed segments
|
|
52
|
+
Route instance with parsed, URL-decoded segments
|
|
47
53
|
"""
|
|
48
|
-
# Remove leading/trailing slashes
|
|
49
|
-
|
|
54
|
+
# Remove leading/trailing slashes, split on '/', then URL-decode each
|
|
55
|
+
# segment. Order matters: split on the literal '/' first so '%2F'-
|
|
56
|
+
# encoded slashes inside values don't act as separators.
|
|
57
|
+
segments = [unquote(s) for s in path.strip("/").split("/") if s]
|
|
50
58
|
return cls(raw_path=path, segments=segments)
|
|
51
59
|
|
|
52
60
|
def matches_pattern(self, pattern: list[str]) -> bool:
|
|
@@ -445,7 +453,7 @@ class CallbackSuccessRoute(BytesPayloadRoute):
|
|
|
445
453
|
return cls(
|
|
446
454
|
raw_path=route.raw_path,
|
|
447
455
|
segments=route.segments,
|
|
448
|
-
callback_id=
|
|
456
|
+
callback_id=route.segments[2],
|
|
449
457
|
)
|
|
450
458
|
|
|
451
459
|
|
|
@@ -488,7 +496,7 @@ class CallbackFailureRoute(BytesPayloadRoute):
|
|
|
488
496
|
return cls(
|
|
489
497
|
raw_path=route.raw_path,
|
|
490
498
|
segments=route.segments,
|
|
491
|
-
callback_id=
|
|
499
|
+
callback_id=route.segments[2],
|
|
492
500
|
)
|
|
493
501
|
|
|
494
502
|
|
|
@@ -531,7 +539,7 @@ class CallbackHeartbeatRoute(Route):
|
|
|
531
539
|
return cls(
|
|
532
540
|
raw_path=route.raw_path,
|
|
533
541
|
segments=route.segments,
|
|
534
|
-
callback_id=
|
|
542
|
+
callback_id=route.segments[2],
|
|
535
543
|
)
|
|
536
544
|
|
|
537
545
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aws-durable-execution-sdk-python-testing
|
|
3
|
-
Version: 1.1
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: AWS Durable Execution Testing SDK for Python
|
|
5
5
|
Project-URL: Documentation, https://github.com/aws/aws-durable-execution-sdk-python-testing#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/aws/aws-durable-execution-sdk-python-testing/issues
|
|
@@ -20,7 +20,6 @@ Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
21
|
Requires-Dist: aws-durable-execution-sdk-python>=1.0.0
|
|
22
22
|
Requires-Dist: boto3>=1.42.1
|
|
23
|
-
Requires-Dist: requests>=2.25.0
|
|
24
23
|
Description-Content-Type: text/markdown
|
|
25
24
|
|
|
26
25
|
# AWS Durable Execution Testing SDK for Python
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
aws_durable_execution_sdk_python_testing/__about__.py,sha256=
|
|
1
|
+
aws_durable_execution_sdk_python_testing/__about__.py,sha256=JZrqCSb8juf621nWIpGb8MqwJ5sX9zUXmjBapJE-ZlU,137
|
|
2
2
|
aws_durable_execution_sdk_python_testing/__init__.py,sha256=NJnSWv9wZndxH7C0lBDVyQ61uhT6i79m5Z_u-PJCVxg,578
|
|
3
|
-
aws_durable_execution_sdk_python_testing/cli.py,sha256=
|
|
3
|
+
aws_durable_execution_sdk_python_testing/cli.py,sha256=LvduQB2oipKvuaJclIU3eQ806G0Gq5djVQlKPp0QpOg,18960
|
|
4
4
|
aws_durable_execution_sdk_python_testing/client.py,sha256=1CFuUXBZIkM7YOWwlJu4OrcjrJSTk01-Zc3N75kYSR4,1682
|
|
5
5
|
aws_durable_execution_sdk_python_testing/exceptions.py,sha256=ZgFPDtKgBn4-tj7fqaye901CksNQWL9RmMhgJBhEu_U,9110
|
|
6
|
-
aws_durable_execution_sdk_python_testing/execution.py,sha256=
|
|
6
|
+
aws_durable_execution_sdk_python_testing/execution.py,sha256=QmnuC4dv42pbPY3babT3VhOndUBeKcJ6urvMo6griRc,17581
|
|
7
7
|
aws_durable_execution_sdk_python_testing/executor.py,sha256=Q0ktkPa8OUUX8ky8pujmUfiiIRNyMIEPCagqdmOw008,48594
|
|
8
8
|
aws_durable_execution_sdk_python_testing/invoker.py,sha256=Glx9ZN9hRRO_94Skb_qp95Y-DYCdTOfRapmt_KJ5uaU,13494
|
|
9
9
|
aws_durable_execution_sdk_python_testing/model.py,sha256=xS6kHPEo4RdHph_rN8dVpQxZC0XzZJpYRLtbABe3A_U,121291
|
|
@@ -41,12 +41,12 @@ aws_durable_execution_sdk_python_testing/web/__init__.py,sha256=S8pemv1lfMXK4Kp8
|
|
|
41
41
|
aws_durable_execution_sdk_python_testing/web/errors.py,sha256=8elkOXggINFhmfRFSPqu3XvD0msiJ2gd5GD86o7pTQU,340
|
|
42
42
|
aws_durable_execution_sdk_python_testing/web/handlers.py,sha256=5_r6zaoaPujnNJohXQ_iPbXJJCR7vPMJfDT_fXr-VjI,29523
|
|
43
43
|
aws_durable_execution_sdk_python_testing/web/models.py,sha256=B4SKVcTculNsO4Qd53tqkPnwVxwguP5PjNgnWF7dp8o,8852
|
|
44
|
-
aws_durable_execution_sdk_python_testing/web/routes.py,sha256=
|
|
44
|
+
aws_durable_execution_sdk_python_testing/web/routes.py,sha256=NTHngxMDvsr78v_VjBXAf-tfwzm8P4o_DgiANJGwVuA,19935
|
|
45
45
|
aws_durable_execution_sdk_python_testing/web/serialization.py,sha256=qN6qJNgEYVqRQD9uhHupJVxyZfz4sc8KzIwxEqVIEcI,7747
|
|
46
46
|
aws_durable_execution_sdk_python_testing/web/server.py,sha256=DQWwgyb_GKkHbFw_OYgPG1o7uIZ4-sG7F-GAUclLYu0,8853
|
|
47
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
48
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
49
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
50
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
51
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
52
|
-
aws_durable_execution_sdk_python_testing-1.1.
|
|
47
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/METADATA,sha256=5DDVFc5rG6KHHTIFJiwFgjDksf8ySxedvXMtybSYYCY,8921
|
|
48
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
49
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/entry_points.txt,sha256=fMm3DMHWb7k4-PSseaQ-BjUxNV_3Z7RyJaDVSwqnkEo,87
|
|
50
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
51
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/licenses/NOTICE,sha256=1CkO1kwu3Q_OHYTj-d-yiBJA_lNN73a4zSntavaD4oc,67
|
|
52
|
+
aws_durable_execution_sdk_python_testing-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|