aws-durable-execution-sdk-python 1.1.2__py3-none-any.whl → 1.3.0__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/__about__.py +1 -1
- aws_durable_execution_sdk_python/__init__.py +3 -1
- aws_durable_execution_sdk_python/context.py +21 -0
- aws_durable_execution_sdk_python/logger.py +1 -1
- aws_durable_execution_sdk_python/operation/step.py +3 -2
- aws_durable_execution_sdk_python/operation/wait_for_condition.py +3 -2
- aws_durable_execution_sdk_python/state.py +4 -4
- {aws_durable_execution_sdk_python-1.1.2.dist-info → aws_durable_execution_sdk_python-1.3.0.dist-info}/METADATA +1 -1
- {aws_durable_execution_sdk_python-1.1.2.dist-info → aws_durable_execution_sdk_python-1.3.0.dist-info}/RECORD +12 -12
- {aws_durable_execution_sdk_python-1.1.2.dist-info → aws_durable_execution_sdk_python-1.3.0.dist-info}/WHEEL +0 -0
- {aws_durable_execution_sdk_python-1.1.2.dist-info → aws_durable_execution_sdk_python-1.3.0.dist-info}/licenses/LICENSE +0 -0
- {aws_durable_execution_sdk_python-1.1.2.dist-info → aws_durable_execution_sdk_python-1.3.0.dist-info}/licenses/NOTICE +0 -0
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
# Main context - used in every durable function
|
|
4
4
|
# Helper decorators - commonly used for step functions
|
|
5
|
+
# Concurrency
|
|
6
|
+
from aws_durable_execution_sdk_python.concurrency.models import BatchResult
|
|
5
7
|
from aws_durable_execution_sdk_python.context import (
|
|
6
8
|
DurableContext,
|
|
7
9
|
durable_step,
|
|
@@ -20,7 +22,7 @@ from aws_durable_execution_sdk_python.exceptions import (
|
|
|
20
22
|
from aws_durable_execution_sdk_python.execution import durable_execution
|
|
21
23
|
|
|
22
24
|
# Essential context types - passed to user functions
|
|
23
|
-
from aws_durable_execution_sdk_python.types import
|
|
25
|
+
from aws_durable_execution_sdk_python.types import StepContext
|
|
24
26
|
|
|
25
27
|
__all__ = [
|
|
26
28
|
"BatchResult",
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import hashlib
|
|
4
4
|
import logging
|
|
5
|
+
from dataclasses import dataclass
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Concatenate, Generic, ParamSpec, TypeVar
|
|
6
7
|
|
|
7
8
|
from aws_durable_execution_sdk_python.config import (
|
|
@@ -74,6 +75,20 @@ logger = logging.getLogger(__name__)
|
|
|
74
75
|
PASS_THROUGH_SERDES: SerDes[Any] = PassThroughSerDes()
|
|
75
76
|
|
|
76
77
|
|
|
78
|
+
@dataclass(frozen=True)
|
|
79
|
+
class ExecutionContext:
|
|
80
|
+
"""Readonly metadata about the current durable execution context.
|
|
81
|
+
|
|
82
|
+
This class provides immutable access to execution-level metadata.
|
|
83
|
+
|
|
84
|
+
Attributes:
|
|
85
|
+
durable_execution_arn: The Amazon Resource Name (ARN) of the current
|
|
86
|
+
durable execution.
|
|
87
|
+
"""
|
|
88
|
+
|
|
89
|
+
durable_execution_arn: str
|
|
90
|
+
|
|
91
|
+
|
|
77
92
|
def durable_step(
|
|
78
93
|
func: Callable[Concatenate[StepContext, Params], T],
|
|
79
94
|
) -> Callable[Params, Callable[[StepContext], T]]:
|
|
@@ -218,11 +233,13 @@ class DurableContext(DurableContextProtocol):
|
|
|
218
233
|
def __init__(
|
|
219
234
|
self,
|
|
220
235
|
state: ExecutionState,
|
|
236
|
+
execution_context: ExecutionContext,
|
|
221
237
|
lambda_context: LambdaContext | None = None,
|
|
222
238
|
parent_id: str | None = None,
|
|
223
239
|
logger: Logger | None = None,
|
|
224
240
|
) -> None:
|
|
225
241
|
self.state: ExecutionState = state
|
|
242
|
+
self.execution_context: ExecutionContext = execution_context
|
|
226
243
|
self.lambda_context = lambda_context
|
|
227
244
|
self._parent_id: str | None = parent_id
|
|
228
245
|
self._step_counter: OrderedCounter = OrderedCounter()
|
|
@@ -245,6 +262,9 @@ class DurableContext(DurableContextProtocol):
|
|
|
245
262
|
):
|
|
246
263
|
return DurableContext(
|
|
247
264
|
state=state,
|
|
265
|
+
execution_context=ExecutionContext(
|
|
266
|
+
durable_execution_arn=state.durable_execution_arn
|
|
267
|
+
),
|
|
248
268
|
lambda_context=lambda_context,
|
|
249
269
|
parent_id=None,
|
|
250
270
|
)
|
|
@@ -254,6 +274,7 @@ class DurableContext(DurableContextProtocol):
|
|
|
254
274
|
logger.debug("Creating child context for parent %s", parent_id)
|
|
255
275
|
return DurableContext(
|
|
256
276
|
state=self.state,
|
|
277
|
+
execution_context=self.execution_context,
|
|
257
278
|
lambda_context=self.lambda_context,
|
|
258
279
|
parent_id=parent_id,
|
|
259
280
|
logger=self.logger.with_log_info(
|
|
@@ -72,7 +72,7 @@ class Logger(LoggerInterface):
|
|
|
72
72
|
# Use 'operation_name' instead of 'name' as key because the stdlib LogRecord internally reserved 'name' parameter
|
|
73
73
|
extra["operationName"] = info.name
|
|
74
74
|
if info.attempt is not None:
|
|
75
|
-
extra["attempt"] = info.attempt
|
|
75
|
+
extra["attempt"] = info.attempt
|
|
76
76
|
if info.operation_id:
|
|
77
77
|
extra["operationId"] = info.operation_id
|
|
78
78
|
return cls(
|
|
@@ -202,9 +202,10 @@ class StepOperationExecutor(OperationExecutor[T]):
|
|
|
202
202
|
ExecutionError: For fatal errors that should not be retried
|
|
203
203
|
May raise other exceptions that will be handled by retry_handler
|
|
204
204
|
"""
|
|
205
|
-
attempt
|
|
205
|
+
# Get current attempt - checkpointed attempts + 1
|
|
206
|
+
attempt: int = 1
|
|
206
207
|
if checkpointed_result.operation and checkpointed_result.operation.step_details:
|
|
207
|
-
attempt = checkpointed_result.operation.step_details.attempt
|
|
208
|
+
attempt = checkpointed_result.operation.step_details.attempt + 1
|
|
208
209
|
|
|
209
210
|
step_context: StepContext = StepContext(
|
|
210
211
|
logger=self.context_logger.with_log_info(
|
|
@@ -170,10 +170,11 @@ class WaitForConditionOperationExecutor(OperationExecutor[T]):
|
|
|
170
170
|
else:
|
|
171
171
|
current_state = self.config.initial_state
|
|
172
172
|
|
|
173
|
-
# Get attempt number
|
|
173
|
+
# Get attempt number - current attempt is checkpointed attempts + 1
|
|
174
|
+
# The checkpoint stores completed attempts, so the current attempt being executed is one more
|
|
174
175
|
attempt: int = 1
|
|
175
176
|
if checkpointed_result.operation and checkpointed_result.operation.step_details:
|
|
176
|
-
attempt = checkpointed_result.operation.step_details.attempt
|
|
177
|
+
attempt = checkpointed_result.operation.step_details.attempt + 1
|
|
177
178
|
|
|
178
179
|
try:
|
|
179
180
|
# Execute the check function with the injected logger
|
|
@@ -45,12 +45,12 @@ class CheckpointBatcherConfig:
|
|
|
45
45
|
Attributes:
|
|
46
46
|
max_batch_size_bytes: Maximum batch size in bytes (default: 750KB)
|
|
47
47
|
max_batch_time_seconds: Maximum time to wait before flushing batch (default: 1.0 second)
|
|
48
|
-
max_batch_operations: Maximum number of operations per batch (default:
|
|
48
|
+
max_batch_operations: Maximum number of operations per batch (default: 250)
|
|
49
49
|
"""
|
|
50
50
|
|
|
51
|
-
max_batch_size_bytes: int = 750 * 1024 # 750KB
|
|
52
|
-
max_batch_time_seconds: float = 1.0
|
|
53
|
-
max_batch_operations: int
|
|
51
|
+
max_batch_size_bytes: int = 750 * 1024 # 750KB
|
|
52
|
+
max_batch_time_seconds: float = 1.0
|
|
53
|
+
max_batch_operations: int = 250
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
@dataclass(frozen=True)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aws-durable-execution-sdk-python
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0
|
|
4
4
|
Summary: AWS Durable Execution SDK for Python
|
|
5
5
|
Project-URL: Documentation, https://github.com/aws/aws-durable-execution-sdk-python#readme
|
|
6
6
|
Project-URL: Issues, https://github.com/aws/aws-durable-execution-sdk-python/issues
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
aws_durable_execution_sdk_python/.gitignore,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
aws_durable_execution_sdk_python/__about__.py,sha256=
|
|
3
|
-
aws_durable_execution_sdk_python/__init__.py,sha256=
|
|
2
|
+
aws_durable_execution_sdk_python/__about__.py,sha256=PF_oYcM9RTUC3P846c3d27JU5o-gxm6cwcu_mFzcSDo,137
|
|
3
|
+
aws_durable_execution_sdk_python/__init__.py,sha256=cPHNbPu8u7DLEotMt6x85AmM2tEGN4rUIK_R-FQhV0g,1100
|
|
4
4
|
aws_durable_execution_sdk_python/config.py,sha256=vd_8IZO5KZU3qWENbWDVtyLglqw3sa6SU-R8CYUgm9g,18938
|
|
5
|
-
aws_durable_execution_sdk_python/context.py,sha256=
|
|
5
|
+
aws_durable_execution_sdk_python/context.py,sha256=HwQn2ByStVxRErox23SqqwsRHjvKY439yNESPar9H2A,23154
|
|
6
6
|
aws_durable_execution_sdk_python/exceptions.py,sha256=AvuXnBHAijXb3TepNTu5CVDb_cpR6Yw6x4W3jELVneQ,13631
|
|
7
7
|
aws_durable_execution_sdk_python/execution.py,sha256=A20fOp6_wXdIcL1YiqJ_RGJbQ09D1lSivBQnUY0FT3Y,18571
|
|
8
8
|
aws_durable_execution_sdk_python/identifier.py,sha256=0NyNTb8mTrUni7PlmFtzvJdW6lk0_XpuAaL89LNc378,324
|
|
9
9
|
aws_durable_execution_sdk_python/lambda_service.py,sha256=FkkcmFxDZLA4JS7mMW2YT9BfqTNHHJtEk9kSADwu5bk,37858
|
|
10
|
-
aws_durable_execution_sdk_python/logger.py,sha256=
|
|
10
|
+
aws_durable_execution_sdk_python/logger.py,sha256=DtPNfJS9PFUfeJqHTl34rSxYRizvVVWAtblV-5zpuY4,4277
|
|
11
11
|
aws_durable_execution_sdk_python/py.typed,sha256=DbCDcAirv769HS1ibzZLXq8VPazYf7JCkKSzj3ctudM,58
|
|
12
12
|
aws_durable_execution_sdk_python/retries.py,sha256=CNJ6msQHVhcdSjMuuQAvR0WvsaN7cFA7QgQTVI8pK2w,5829
|
|
13
13
|
aws_durable_execution_sdk_python/serdes.py,sha256=-hzqPyAHi1rsOUwpi7RjiJBNiDc0Oe5_QVNMemYBfGY,16808
|
|
14
|
-
aws_durable_execution_sdk_python/state.py,sha256=
|
|
14
|
+
aws_durable_execution_sdk_python/state.py,sha256=aJOB575jTZ1cCVNpLUMJTynj3twwlhAbkwMRduHloww,33191
|
|
15
15
|
aws_durable_execution_sdk_python/suspend.py,sha256=PIgc6w5-diZIq58-tPv51dzBSHGW7e4oR0QFam8Vgi0,3323
|
|
16
16
|
aws_durable_execution_sdk_python/threading.py,sha256=cU7vIEWHYco-qqkgoAMyPHSOQ8b_Q_r_rZGG7m1g7I4,7650
|
|
17
17
|
aws_durable_execution_sdk_python/types.py,sha256=8vqwa5q2EikesX_NdhR_njin7l7uHakhWPH_ntHY_PI,5152
|
|
@@ -26,11 +26,11 @@ aws_durable_execution_sdk_python/operation/child.py,sha256=L2RMHhTt_xewAS20T1iZN
|
|
|
26
26
|
aws_durable_execution_sdk_python/operation/invoke.py,sha256=R-31JLlazDWECe8Q242LMqiwuyg1_GzycDNKYJEoz_M,6801
|
|
27
27
|
aws_durable_execution_sdk_python/operation/map.py,sha256=NMp-U3dvv2OK9kiUF1PQfkll1JKzpL7Sh_cxyda_Kyk,5024
|
|
28
28
|
aws_durable_execution_sdk_python/operation/parallel.py,sha256=uzxa_XsTvimC63HpadwCjNhGoUcqxM8P4bvQLVHQTq0,4715
|
|
29
|
-
aws_durable_execution_sdk_python/operation/step.py,sha256=
|
|
29
|
+
aws_durable_execution_sdk_python/operation/step.py,sha256=hnwiLtXNLAOl71FPduxyMYaUggQsrelLeP1W5kRXXlM,15629
|
|
30
30
|
aws_durable_execution_sdk_python/operation/wait.py,sha256=P1R7-BrQ0eadFxQiGLHL3ySkuJUqPvVv7zewAzBeVT8,4193
|
|
31
|
-
aws_durable_execution_sdk_python/operation/wait_for_condition.py,sha256=
|
|
32
|
-
aws_durable_execution_sdk_python-1.
|
|
33
|
-
aws_durable_execution_sdk_python-1.
|
|
34
|
-
aws_durable_execution_sdk_python-1.
|
|
35
|
-
aws_durable_execution_sdk_python-1.
|
|
36
|
-
aws_durable_execution_sdk_python-1.
|
|
31
|
+
aws_durable_execution_sdk_python/operation/wait_for_condition.py,sha256=9t-XsfKQfg66Ys57L61VWA5_JYPvVNnGD6ddFq-h4Xg,11921
|
|
32
|
+
aws_durable_execution_sdk_python-1.3.0.dist-info/METADATA,sha256=jivJXjguOtgHqdOqSsVZhgu5zelPYEC85-tJKdY9fDA,6424
|
|
33
|
+
aws_durable_execution_sdk_python-1.3.0.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
34
|
+
aws_durable_execution_sdk_python-1.3.0.dist-info/licenses/LICENSE,sha256=CeipvOyAZxBGUsFoaFqwkx54aPnIKEtm9a5u2uXxEws,10142
|
|
35
|
+
aws_durable_execution_sdk_python-1.3.0.dist-info/licenses/NOTICE,sha256=1CkO1kwu3Q_OHYTj-d-yiBJA_lNN73a4zSntavaD4oc,67
|
|
36
|
+
aws_durable_execution_sdk_python-1.3.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|