aws-durable-execution-sdk-python-testing 1.1.0__tar.gz → 1.1.1__tar.gz
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-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/PKG-INFO +1 -1
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/__about__.py +1 -1
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/execution.py +7 -7
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/invoker.py +1 -3
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/stores/filesystem.py +6 -31
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/stores/sqlite.py +3 -13
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/.gitignore +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/LICENSE +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/NOTICE +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/README.md +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processor.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/base.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/callback.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/context.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/execution.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/step.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/processors/wait.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/transformer.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/checkpoint.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/callback.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/context.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/execution.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/invoke.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/step.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/operations/wait.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/checkpoint/validators/transitions.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/cli.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/client.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/exceptions.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/executor.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/model.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/observer.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/py.typed +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/runner.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/scheduler.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/stores/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/stores/base.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/stores/memory.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/token.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/__init__.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/errors.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/handlers.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/models.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/routes.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/serialization.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/aws_durable_execution_sdk_python_testing/web/server.py +0 -0
- {aws_durable_execution_sdk_python_testing-1.1.0 → aws_durable_execution_sdk_python_testing-1.1.1}/pyproject.toml +0 -0
|
@@ -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.1.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
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import json
|
|
4
3
|
from dataclasses import replace
|
|
5
4
|
from datetime import UTC, datetime
|
|
6
5
|
from enum import Enum
|
|
@@ -33,7 +32,6 @@ from aws_durable_execution_sdk_python_testing.model import (
|
|
|
33
32
|
)
|
|
34
33
|
from aws_durable_execution_sdk_python_testing.token import (
|
|
35
34
|
CheckpointToken,
|
|
36
|
-
CallbackToken,
|
|
37
35
|
)
|
|
38
36
|
|
|
39
37
|
|
|
@@ -96,12 +94,12 @@ class Execution:
|
|
|
96
94
|
durable_execution_arn=str(uuid4()), start_input=input, operations=[]
|
|
97
95
|
)
|
|
98
96
|
|
|
99
|
-
def
|
|
100
|
-
"""Serialize execution to dictionary
|
|
97
|
+
def to_json_dict(self) -> dict[str, Any]:
|
|
98
|
+
"""Serialize execution to JSON-serializable dictionary"""
|
|
101
99
|
return {
|
|
102
100
|
"DurableExecutionArn": self.durable_execution_arn,
|
|
103
101
|
"StartInput": self.start_input.to_dict(),
|
|
104
|
-
"Operations": [op.
|
|
102
|
+
"Operations": [op.to_json_dict() for op in self.operations],
|
|
105
103
|
"Updates": [update.to_dict() for update in self.updates],
|
|
106
104
|
"InvocationCompletions": [
|
|
107
105
|
completion.to_dict() for completion in self.invocation_completions
|
|
@@ -115,13 +113,15 @@ class Execution:
|
|
|
115
113
|
}
|
|
116
114
|
|
|
117
115
|
@classmethod
|
|
118
|
-
def
|
|
116
|
+
def from_json_dict(cls, data: dict[str, Any]) -> Execution:
|
|
119
117
|
"""Deserialize execution from dictionary."""
|
|
120
118
|
# Reconstruct start_input
|
|
121
119
|
start_input = StartDurableExecutionInput.from_dict(data["StartInput"])
|
|
122
120
|
|
|
123
121
|
# Reconstruct operations
|
|
124
|
-
operations = [
|
|
122
|
+
operations = [
|
|
123
|
+
Operation.from_json_dict(op_data) for op_data in data["Operations"]
|
|
124
|
+
]
|
|
125
125
|
|
|
126
126
|
# Create execution
|
|
127
127
|
execution = cls(
|
|
@@ -12,12 +12,10 @@ from aws_durable_execution_sdk_python.execution import (
|
|
|
12
12
|
DurableExecutionInvocationInputWithClient,
|
|
13
13
|
DurableExecutionInvocationOutput,
|
|
14
14
|
InitialExecutionState,
|
|
15
|
-
InvocationStatus,
|
|
16
15
|
)
|
|
17
16
|
|
|
18
17
|
from aws_durable_execution_sdk_python_testing.exceptions import (
|
|
19
18
|
DurableFunctionsTestError,
|
|
20
|
-
ServiceException,
|
|
21
19
|
)
|
|
22
20
|
from aws_durable_execution_sdk_python_testing.model import LambdaContext
|
|
23
21
|
|
|
@@ -239,7 +237,7 @@ class LambdaInvoker(Invoker):
|
|
|
239
237
|
response = client.invoke(
|
|
240
238
|
FunctionName=function_name,
|
|
241
239
|
InvocationType="RequestResponse", # Synchronous invocation
|
|
242
|
-
Payload=json.dumps(input.
|
|
240
|
+
Payload=json.dumps(input.to_json_dict()),
|
|
243
241
|
)
|
|
244
242
|
|
|
245
243
|
# Check HTTP status code
|
|
@@ -4,7 +4,6 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import json
|
|
6
6
|
import logging
|
|
7
|
-
from datetime import UTC, datetime
|
|
8
7
|
from pathlib import Path
|
|
9
8
|
|
|
10
9
|
from aws_durable_execution_sdk_python_testing.exceptions import (
|
|
@@ -16,30 +15,6 @@ from aws_durable_execution_sdk_python_testing.stores.base import (
|
|
|
16
15
|
)
|
|
17
16
|
|
|
18
17
|
|
|
19
|
-
class DateTimeEncoder(json.JSONEncoder):
|
|
20
|
-
"""Custom JSON encoder that handles datetime objects."""
|
|
21
|
-
|
|
22
|
-
def default(self, obj):
|
|
23
|
-
if isinstance(obj, datetime):
|
|
24
|
-
return obj.timestamp()
|
|
25
|
-
return super().default(obj)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def datetime_object_hook(obj):
|
|
29
|
-
"""JSON object hook to convert unix timestamps back to datetime objects."""
|
|
30
|
-
if isinstance(obj, dict):
|
|
31
|
-
for key, value in obj.items():
|
|
32
|
-
if isinstance(value, int | float) and key.endswith(
|
|
33
|
-
("_timestamp", "_time", "Timestamp", "Time")
|
|
34
|
-
):
|
|
35
|
-
try: # noqa: SIM105
|
|
36
|
-
obj[key] = datetime.fromtimestamp(value, tz=UTC)
|
|
37
|
-
except (ValueError, OSError):
|
|
38
|
-
# Leave as number if not a valid timestamp
|
|
39
|
-
pass
|
|
40
|
-
return obj
|
|
41
|
-
|
|
42
|
-
|
|
43
18
|
class FileSystemExecutionStore(BaseExecutionStore):
|
|
44
19
|
"""File system-based execution store for persistence."""
|
|
45
20
|
|
|
@@ -69,10 +44,10 @@ class FileSystemExecutionStore(BaseExecutionStore):
|
|
|
69
44
|
def save(self, execution: Execution) -> None:
|
|
70
45
|
"""Save execution to file system."""
|
|
71
46
|
file_path = self._get_file_path(execution.durable_execution_arn)
|
|
72
|
-
data = execution.
|
|
47
|
+
data = execution.to_json_dict()
|
|
73
48
|
|
|
74
49
|
with open(file_path, "w", encoding="utf-8") as f:
|
|
75
|
-
json.dump(data, f, indent=2
|
|
50
|
+
json.dump(data, f, indent=2)
|
|
76
51
|
|
|
77
52
|
def load(self, execution_arn: str) -> Execution:
|
|
78
53
|
"""Load execution from file system."""
|
|
@@ -82,9 +57,9 @@ class FileSystemExecutionStore(BaseExecutionStore):
|
|
|
82
57
|
raise ResourceNotFoundException(msg)
|
|
83
58
|
|
|
84
59
|
with open(file_path, encoding="utf-8") as f:
|
|
85
|
-
data = json.load(f
|
|
60
|
+
data = json.load(f)
|
|
86
61
|
|
|
87
|
-
return Execution.
|
|
62
|
+
return Execution.from_json_dict(data)
|
|
88
63
|
|
|
89
64
|
def update(self, execution: Execution) -> None:
|
|
90
65
|
"""Update execution in file system (same as save)."""
|
|
@@ -96,8 +71,8 @@ class FileSystemExecutionStore(BaseExecutionStore):
|
|
|
96
71
|
for file_path in self._storage_dir.glob("*.json"):
|
|
97
72
|
try:
|
|
98
73
|
with open(file_path, encoding="utf-8") as f:
|
|
99
|
-
data = json.load(f
|
|
100
|
-
executions.append(Execution.
|
|
74
|
+
data = json.load(f)
|
|
75
|
+
executions.append(Execution.from_json_dict(data))
|
|
101
76
|
except (json.JSONDecodeError, KeyError, OSError) as e:
|
|
102
77
|
logging.warning("Skipping corrupted file %s: %s", file_path, e)
|
|
103
78
|
continue
|
|
@@ -17,10 +17,6 @@ from aws_durable_execution_sdk_python_testing.execution import Execution
|
|
|
17
17
|
from aws_durable_execution_sdk_python_testing.stores.base import (
|
|
18
18
|
ExecutionStore,
|
|
19
19
|
)
|
|
20
|
-
from aws_durable_execution_sdk_python_testing.stores.filesystem import (
|
|
21
|
-
DateTimeEncoder,
|
|
22
|
-
datetime_object_hook,
|
|
23
|
-
)
|
|
24
20
|
|
|
25
21
|
|
|
26
22
|
class SQLiteExecutionStore(ExecutionStore):
|
|
@@ -102,7 +98,7 @@ class SQLiteExecutionStore(ExecutionStore):
|
|
|
102
98
|
execution_op.end_timestamp.timestamp()
|
|
103
99
|
if execution_op.end_timestamp
|
|
104
100
|
else None,
|
|
105
|
-
json.dumps(execution.
|
|
101
|
+
json.dumps(execution.to_json_dict()),
|
|
106
102
|
),
|
|
107
103
|
)
|
|
108
104
|
except sqlite3.Error as e:
|
|
@@ -125,9 +121,7 @@ class SQLiteExecutionStore(ExecutionStore):
|
|
|
125
121
|
if not row:
|
|
126
122
|
raise ResourceNotFoundException(f"Execution {execution_arn} not found")
|
|
127
123
|
|
|
128
|
-
return Execution.
|
|
129
|
-
json.loads(row[0], object_hook=datetime_object_hook)
|
|
130
|
-
)
|
|
124
|
+
return Execution.from_json_dict(json.loads(row[0]))
|
|
131
125
|
except sqlite3.Error as e:
|
|
132
126
|
raise RuntimeError(f"Failed to load execution {execution_arn}: {e}") from e
|
|
133
127
|
except json.JSONDecodeError as e:
|
|
@@ -222,11 +216,7 @@ class SQLiteExecutionStore(ExecutionStore):
|
|
|
222
216
|
executions: list[Execution] = []
|
|
223
217
|
for durable_execution_arn, data in rows:
|
|
224
218
|
try:
|
|
225
|
-
executions.append(
|
|
226
|
-
Execution.from_dict(
|
|
227
|
-
json.loads(data, object_hook=datetime_object_hook)
|
|
228
|
-
)
|
|
229
|
-
)
|
|
219
|
+
executions.append(Execution.from_json_dict(json.loads(data)))
|
|
230
220
|
except (json.JSONDecodeError, ValueError) as e:
|
|
231
221
|
# Log corrupted data but continue with other records
|
|
232
222
|
print(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|