dex-python-sdk 1.45.16__tar.gz → 1.45.17__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.
- dex_python_sdk-1.45.16/README.md → dex_python_sdk-1.45.17/PKG-INFO +40 -0
- dex_python_sdk-1.45.16/PKG-INFO → dex_python_sdk-1.45.17/README.md +21 -19
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/async_client.py +23 -5
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/client.py +23 -5
- dex_python_sdk-1.45.17/dex/rpc_invoke_options.py +160 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/pyproject.toml +1 -1
- dex_python_sdk-1.45.16/dex/rpc_invoke_options.py +0 -42
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/LEGACY_NOTICES.md +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/LICENSE +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/__init__.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_async_value_hydrator.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_async_worker_dispatcher.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_attribute_reads.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_credential_transport.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_flow_definition_upload.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_flow_service_tls.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_grpc_errors.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_history_point_mapping.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_invocation_context.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_message_size.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_native.pyi +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_payload_message_codec.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_pull_slot_streams.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_pull_worker.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_server_protocol.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_stop_flow_mapping.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_task_queue_names.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_utils.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_value_hydrator.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_value_mapper.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/_worker_dispatcher.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/action.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/async_worker.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/attribute.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/attribute_match.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/attribute_values.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/blob_cache.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/channel.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/client_options.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/codec.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/condition.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/context.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/credential.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/dexpb/__init__.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/dexpb/dex_pb2.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/dexpb/dex_pb2.pyi +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/dexpb/dex_pb2_grpc.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_config.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_definition.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_info.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_options.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_result.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_service_tls_options.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/flow_state.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/graceful_completion_context.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/join.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/payload_encryption.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/pull_registration.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/py.typed +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/runtime_errors.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/step.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/step_execution.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/stream.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/subflow.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/timer.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/wait.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/wait_options.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/worker.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/dex/worker_options.py +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/Cargo.lock +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/Cargo.toml +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/Cargo.toml +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/LICENSE +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/README.md +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/config.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/entry.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/error.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/format.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/lib.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/policy.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/store.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/tests/blob_cache_integration.rs +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/Cargo.toml +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/LICENSE +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/README.md +0 -0
- {dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/src/lib.rs +0 -0
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dex-python-sdk
|
|
3
|
+
Version: 1.45.17
|
|
4
|
+
Requires-Dist: grpcio>=1.83.0
|
|
5
|
+
Requires-Dist: grpcio-status>=1.83.0
|
|
6
|
+
Requires-Dist: protobuf>=7.35.1
|
|
7
|
+
Requires-Dist: cryptography>=42.0.0 ; extra == 'encryption'
|
|
8
|
+
Provides-Extra: encryption
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: LEGACY_NOTICES.md
|
|
11
|
+
Summary: Python SDK for the Dex workflow engine
|
|
12
|
+
Author: Super Durable
|
|
13
|
+
License-Expression: LicenseRef-Sustainable-Use-1.0
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
+
Project-URL: Homepage, https://github.com/superdurable/dex/tree/main/sdk-python
|
|
17
|
+
Project-URL: Repository, https://github.com/superdurable/dex
|
|
18
|
+
|
|
1
19
|
|
|
2
20
|
# Dex SDK for Python
|
|
3
21
|
|
|
@@ -494,6 +512,27 @@ result = client.invoke_rpc(
|
|
|
494
512
|
registered ones. Locking and loading are independent; read-modify-write handlers
|
|
495
513
|
need both for the same instance.
|
|
496
514
|
|
|
515
|
+
`RPCInvokeOptions.request_id` sets a stable request ID for one call. With the
|
|
516
|
+
same request ID on every attempt on the same Flow run, Dex applies the RPC's
|
|
517
|
+
Flow state changes at most once. A repeat of a transactional or locking RPC
|
|
518
|
+
returns the recorded reply without running the handler again. A repeat of any
|
|
519
|
+
other RPC runs the handler again, and returns its new output when that attempt
|
|
520
|
+
changes no Flow state and records no event. Use a transactional or locking RPC,
|
|
521
|
+
for example when an event that is delivered at least once invokes an RPC.
|
|
522
|
+
`None`, the default, sends a new request ID on every call. The field's
|
|
523
|
+
docstring gives the deduplication window and the error that Dex Server 0.1.36
|
|
524
|
+
and earlier raise for a reused ID.
|
|
525
|
+
|
|
526
|
+
```python
|
|
527
|
+
options = dex.RPCInvokeOptions(request_id=f"{event.id}/increment_counter")
|
|
528
|
+
total = client.invoke_rpc(
|
|
529
|
+
counters.increment_counter,
|
|
530
|
+
event.flow_id,
|
|
531
|
+
event.delta,
|
|
532
|
+
options=options,
|
|
533
|
+
)
|
|
534
|
+
```
|
|
535
|
+
|
|
497
536
|
See the runnable [sequential chunking](../examples/python/dex_examples/patterns/sequentially-chunked-attribute-map)
|
|
498
537
|
and [hash partitioning](../examples/python/dex_examples/patterns/hash-partitioned-attribute-map)
|
|
499
538
|
patterns for complete async call sites.
|
|
@@ -1187,3 +1226,4 @@ original terms as described in [LEGACY_NOTICES.md](LEGACY_NOTICES.md).
|
|
|
1187
1226
|
|
|
1188
1227
|
Searches return runs that match the query. Include `FlowType` when using shared
|
|
1189
1228
|
index slots, and keep the query and page size consistent across pages.
|
|
1229
|
+
|
|
@@ -1,21 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: dex-python-sdk
|
|
3
|
-
Version: 1.45.16
|
|
4
|
-
Requires-Dist: grpcio>=1.83.0
|
|
5
|
-
Requires-Dist: grpcio-status>=1.83.0
|
|
6
|
-
Requires-Dist: protobuf>=7.35.1
|
|
7
|
-
Requires-Dist: cryptography>=42.0.0 ; extra == 'encryption'
|
|
8
|
-
Provides-Extra: encryption
|
|
9
|
-
License-File: LICENSE
|
|
10
|
-
License-File: LEGACY_NOTICES.md
|
|
11
|
-
Summary: Python SDK for the Dex workflow engine
|
|
12
|
-
Author: Super Durable
|
|
13
|
-
License-Expression: LicenseRef-Sustainable-Use-1.0
|
|
14
|
-
Requires-Python: >=3.11
|
|
15
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
16
|
-
Project-URL: Homepage, https://github.com/superdurable/dex/tree/main/sdk-python
|
|
17
|
-
Project-URL: Repository, https://github.com/superdurable/dex
|
|
18
|
-
|
|
19
1
|
|
|
20
2
|
# Dex SDK for Python
|
|
21
3
|
|
|
@@ -512,6 +494,27 @@ result = client.invoke_rpc(
|
|
|
512
494
|
registered ones. Locking and loading are independent; read-modify-write handlers
|
|
513
495
|
need both for the same instance.
|
|
514
496
|
|
|
497
|
+
`RPCInvokeOptions.request_id` sets a stable request ID for one call. With the
|
|
498
|
+
same request ID on every attempt on the same Flow run, Dex applies the RPC's
|
|
499
|
+
Flow state changes at most once. A repeat of a transactional or locking RPC
|
|
500
|
+
returns the recorded reply without running the handler again. A repeat of any
|
|
501
|
+
other RPC runs the handler again, and returns its new output when that attempt
|
|
502
|
+
changes no Flow state and records no event. Use a transactional or locking RPC,
|
|
503
|
+
for example when an event that is delivered at least once invokes an RPC.
|
|
504
|
+
`None`, the default, sends a new request ID on every call. The field's
|
|
505
|
+
docstring gives the deduplication window and the error that Dex Server 0.1.36
|
|
506
|
+
and earlier raise for a reused ID.
|
|
507
|
+
|
|
508
|
+
```python
|
|
509
|
+
options = dex.RPCInvokeOptions(request_id=f"{event.id}/increment_counter")
|
|
510
|
+
total = client.invoke_rpc(
|
|
511
|
+
counters.increment_counter,
|
|
512
|
+
event.flow_id,
|
|
513
|
+
event.delta,
|
|
514
|
+
options=options,
|
|
515
|
+
)
|
|
516
|
+
```
|
|
517
|
+
|
|
515
518
|
See the runnable [sequential chunking](../examples/python/dex_examples/patterns/sequentially-chunked-attribute-map)
|
|
516
519
|
and [hash partitioning](../examples/python/dex_examples/patterns/hash-partitioned-attribute-map)
|
|
517
520
|
patterns for complete async call sites.
|
|
@@ -1205,4 +1208,3 @@ original terms as described in [LEGACY_NOTICES.md](LEGACY_NOTICES.md).
|
|
|
1205
1208
|
|
|
1206
1209
|
Searches return runs that match the query. Include `FlowType` when using shared
|
|
1207
1210
|
index slots, and keep the query and page size consistent across pages.
|
|
1208
|
-
|
|
@@ -396,6 +396,13 @@ class AsyncClient:
|
|
|
396
396
|
RPC handlers are not automatically retried by this call. A timeout or
|
|
397
397
|
transport error does not prove that external effects or committed writes
|
|
398
398
|
did not happen. Use application idempotency before repeating a write.
|
|
399
|
+
Without ``RPCInvokeOptions.request_id``, each call sends a new request ID,
|
|
400
|
+
so calling the RPC again runs it again. To retry one logical call so that
|
|
401
|
+
Dex applies its Flow state changes at most once, pass the same
|
|
402
|
+
``RPCInvokeOptions.request_id`` on every attempt.
|
|
403
|
+
A repeat of a transactional or locking RPC returns the recorded reply
|
|
404
|
+
without running the handler again. See ``RPCInvokeOptions.request_id``
|
|
405
|
+
for the deduplication rules and an example.
|
|
399
406
|
Acquire and load the same exact AttributeMap instance for a dynamic
|
|
400
407
|
read-modify-write operation through RPCInvokeOptions. A lock alone does
|
|
401
408
|
not request the instance's value in the handler snapshot.
|
|
@@ -406,9 +413,11 @@ class AsyncClient:
|
|
|
406
413
|
input: The annotated input, or ``None`` for an input-free RPC.
|
|
407
414
|
run_id: Optional exact run. With ``""``, the server resolves the current
|
|
408
415
|
execution.
|
|
409
|
-
options: Additive runtime AttributeMap locks and exact map-instance loads
|
|
410
|
-
They cannot change timeout or
|
|
411
|
-
sorts, and deduplicates these
|
|
416
|
+
options: Additive runtime AttributeMap locks and exact map-instance loads,
|
|
417
|
+
and an optional request ID. They cannot change timeout or
|
|
418
|
+
transactionality. The Client unions, sorts, and deduplicates these
|
|
419
|
+
selections with the registered ones. ``options.request_id`` is sent
|
|
420
|
+
as the request ID; ``None`` sends a new UUID.
|
|
412
421
|
|
|
413
422
|
Returns:
|
|
414
423
|
The decoded ``RPCResult.output``, or ``None`` for a no-output RPC.
|
|
@@ -420,8 +429,13 @@ class AsyncClient:
|
|
|
420
429
|
ValueMappingError: If input or output mapping fails.
|
|
421
430
|
FlowNotActiveOrNotFoundError: If the Flow is missing or the selected path
|
|
422
431
|
cannot use its closed execution.
|
|
423
|
-
DexServiceError: If the service call otherwise fails.
|
|
432
|
+
DexServiceError: If the service call otherwise fails. Dex Server 0.1.36
|
|
433
|
+
and earlier raise it with ``grpc.StatusCode.INVALID_ARGUMENT`` for
|
|
434
|
+
a different request under a recorded ``options.request_id``.
|
|
424
435
|
RuntimeError: If the Server reports a protocol range without protocol 4.
|
|
436
|
+
|
|
437
|
+
.. versionchanged:: 1.45.17
|
|
438
|
+
Sends ``options.request_id`` as the request ID when it is set.
|
|
425
439
|
"""
|
|
426
440
|
registered_flow, rpc = self.registry._rpc_for_method(rpc_method)
|
|
427
441
|
(
|
|
@@ -453,7 +467,11 @@ class AsyncClient:
|
|
|
453
467
|
lock_attribute_keys=tuple(
|
|
454
468
|
sorted(set(rpc.locks + invocation_locks))
|
|
455
469
|
),
|
|
456
|
-
request_id=
|
|
470
|
+
request_id=(
|
|
471
|
+
options.request_id
|
|
472
|
+
if options.request_id is not None
|
|
473
|
+
else str(uuid4())
|
|
474
|
+
),
|
|
457
475
|
is_transactional=rpc.options.is_transactional,
|
|
458
476
|
load_attribute_map_instances=tuple(
|
|
459
477
|
sorted(
|
|
@@ -397,6 +397,13 @@ class Client:
|
|
|
397
397
|
RPC handlers are not automatically retried by this call. A timeout or
|
|
398
398
|
transport error does not prove that external effects or committed writes
|
|
399
399
|
did not happen. Use application idempotency before repeating a write.
|
|
400
|
+
Without ``RPCInvokeOptions.request_id``, each call sends a new request ID,
|
|
401
|
+
so calling the RPC again runs it again. To retry one logical call so that
|
|
402
|
+
Dex applies its Flow state changes at most once, pass the same
|
|
403
|
+
``RPCInvokeOptions.request_id`` on every attempt.
|
|
404
|
+
A repeat of a transactional or locking RPC returns the recorded reply
|
|
405
|
+
without running the handler again. See ``RPCInvokeOptions.request_id``
|
|
406
|
+
for the deduplication rules and an example.
|
|
400
407
|
Acquire and load the same exact AttributeMap instance for a dynamic
|
|
401
408
|
read-modify-write operation through RPCInvokeOptions. A lock alone does
|
|
402
409
|
not request the instance's value in the handler snapshot.
|
|
@@ -416,9 +423,11 @@ class Client:
|
|
|
416
423
|
input: The annotated RPC input, or ``None`` for an input-free RPC.
|
|
417
424
|
run_id: Optional exact run. With ``""``, the server resolves the current
|
|
418
425
|
execution.
|
|
419
|
-
options: Additive runtime AttributeMap locks and exact map-instance loads
|
|
420
|
-
They cannot change timeout or
|
|
421
|
-
sorts, and deduplicates these
|
|
426
|
+
options: Additive runtime AttributeMap locks and exact map-instance loads,
|
|
427
|
+
and an optional request ID. They cannot change timeout or
|
|
428
|
+
transactionality. The Client unions, sorts, and deduplicates these
|
|
429
|
+
selections with the registered ones. ``options.request_id`` is sent
|
|
430
|
+
as the request ID; ``None`` sends a new UUID.
|
|
422
431
|
|
|
423
432
|
Returns:
|
|
424
433
|
The decoded ``RPCResult.output``, or ``None`` for a no-output RPC.
|
|
@@ -430,8 +439,13 @@ class Client:
|
|
|
430
439
|
ValueMappingError: If input or output mapping fails.
|
|
431
440
|
FlowNotActiveOrNotFoundError: If the Flow is missing or the selected path
|
|
432
441
|
cannot use its closed execution.
|
|
433
|
-
DexServiceError: If the service call otherwise fails.
|
|
442
|
+
DexServiceError: If the service call otherwise fails. Dex Server 0.1.36
|
|
443
|
+
and earlier raise it with ``grpc.StatusCode.INVALID_ARGUMENT`` for
|
|
444
|
+
a different request under a recorded ``options.request_id``.
|
|
434
445
|
RuntimeError: If the Server reports a protocol range without protocol 4.
|
|
446
|
+
|
|
447
|
+
.. versionchanged:: 1.45.17
|
|
448
|
+
Sends ``options.request_id`` as the request ID when it is set.
|
|
435
449
|
"""
|
|
436
450
|
registered_flow, rpc = self.registry._rpc_for_method(rpc_method)
|
|
437
451
|
(
|
|
@@ -463,7 +477,11 @@ class Client:
|
|
|
463
477
|
lock_attribute_keys=tuple(
|
|
464
478
|
sorted(set(rpc.locks + invocation_locks))
|
|
465
479
|
),
|
|
466
|
-
request_id=
|
|
480
|
+
request_id=(
|
|
481
|
+
options.request_id
|
|
482
|
+
if options.request_id is not None
|
|
483
|
+
else str(uuid4())
|
|
484
|
+
),
|
|
467
485
|
is_transactional=rpc.options.is_transactional,
|
|
468
486
|
load_attribute_map_instances=tuple(
|
|
469
487
|
sorted(
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Sustainable Use License 1.0.
|
|
4
|
+
# You may not use this file except in compliance with the License.
|
|
5
|
+
# See the LICENSE file in the repository root.
|
|
6
|
+
#
|
|
7
|
+
# SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
|
|
13
|
+
from dex.attribute import AttributeLock, AttributeMapLoad
|
|
14
|
+
from dex.channel import ChannelMapLoad
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@dataclass(frozen=True)
|
|
18
|
+
class RPCInvokeOptions:
|
|
19
|
+
"""Add runtime-selected map instances and a request ID to one RPC invocation.
|
|
20
|
+
|
|
21
|
+
Dex unions these selections with the RPC decorator's fixed locks and state loads,
|
|
22
|
+
then sorts and deduplicates their physical names. Locking and loading are
|
|
23
|
+
independent. A read-modify-write handler must include the same AttributeMap
|
|
24
|
+
instance in both collections.
|
|
25
|
+
|
|
26
|
+
Set ``request_id`` when one logical call may be sent more than once, so that Dex
|
|
27
|
+
applies the RPC's Flow state changes at most once. The options are immutable;
|
|
28
|
+
reuse one instance for every attempt of the same call.
|
|
29
|
+
|
|
30
|
+
Attributes:
|
|
31
|
+
lock_attribute_map_instances: AttributeMap instance locks for this call.
|
|
32
|
+
load_attribute_map_instances: Exact AttributeMap instance snapshots.
|
|
33
|
+
load_channel_map_instances: Exact ChannelMap pending-message snapshots.
|
|
34
|
+
request_id: Optional non-empty request ID that identifies this invocation
|
|
35
|
+
for Dex request deduplication. ``None``, the default, sends a new
|
|
36
|
+
SDK-generated UUID on every call, so every call runs as a new request.
|
|
37
|
+
An empty string raises ``ValueError`` when the options are
|
|
38
|
+
constructed. Dex Server sets no other length or character rule.
|
|
39
|
+
|
|
40
|
+
Set a stable request ID when one logical call may be sent more than
|
|
41
|
+
once. Examples are a retry after a call whose outcome is unknown, such
|
|
42
|
+
as one that ended with a timeout or with UNAVAILABLE, and a Trigger
|
|
43
|
+
that delivers each event at least once and retries a failed delivery.
|
|
44
|
+
Derive the ID from the business event. When one event invokes several
|
|
45
|
+
RPCs on the same Flow run, give each RPC its own ID, such as the event
|
|
46
|
+
ID followed by the RPC name.
|
|
47
|
+
|
|
48
|
+
Dex applies an RPC's Flow state changes at most once per request ID.
|
|
49
|
+
Dex Server records the request ID and the reply when an attempt's
|
|
50
|
+
result commits. What a later attempt with the same request ID on the
|
|
51
|
+
same Flow run returns depends on the RPC and on that attempt:
|
|
52
|
+
|
|
53
|
+
- A transactional or locking RPC, declared with ``is_transactional``
|
|
54
|
+
or ``lock_attributes`` of ``@rpc``, returns the recorded reply
|
|
55
|
+
before a Worker runs the handler. Concurrent calls with the same
|
|
56
|
+
request ID share one handler execution and its result.
|
|
57
|
+
- Any other RPC runs its handler on a Worker again. When this
|
|
58
|
+
attempt's result changes Flow state or records an event, Dex
|
|
59
|
+
discards it and returns the recorded reply. When this attempt's
|
|
60
|
+
result changes no Flow state and records no event, Dex returns its
|
|
61
|
+
new output without looking up the request ID.
|
|
62
|
+
|
|
63
|
+
Use a transactional or locking RPC when every repeat must return the
|
|
64
|
+
recorded reply. For example, a non-transactional handler that marks an
|
|
65
|
+
event processed and returns ``"accepted"`` returns
|
|
66
|
+
``"already_processed"`` to a repeat that sees the mark and writes
|
|
67
|
+
nothing. For every RPC, the handler's side effects outside Dex, such
|
|
68
|
+
as an HTTP call, can repeat.
|
|
69
|
+
|
|
70
|
+
A call that the Server fails before any commit records nothing, and a
|
|
71
|
+
retry with the same request ID runs the RPC again. Such failures
|
|
72
|
+
include ``WorkerInvocationError``, ``RpcLockConflictError``, and the
|
|
73
|
+
RPC's handler timeout expiring while the handler runs.
|
|
74
|
+
|
|
75
|
+
A call that ends on the caller's side, such as a timeout before the
|
|
76
|
+
reply arrives, has an unknown outcome. The RPC may still commit after
|
|
77
|
+
the call raises. Retry it with the same request ID: when the first
|
|
78
|
+
call committed, the retry applies no changes again, and otherwise it
|
|
79
|
+
runs the RPC. For a transactional or locking RPC, a retry joins the
|
|
80
|
+
first call while it is in flight, or returns its recorded reply after
|
|
81
|
+
it commits.
|
|
82
|
+
|
|
83
|
+
Dex compares only the request ID, as it does for ``start_flow``. A
|
|
84
|
+
call with a recorded request ID is a repeat even when its RPC name,
|
|
85
|
+
input, or options differ. Dex answers it as described above and
|
|
86
|
+
applies none of its Flow changes. Build every attempt's input from
|
|
87
|
+
the stored event, so that a repeat carries the request the first call
|
|
88
|
+
sent. Dex Server 0.1.36 and earlier compare the whole request instead.
|
|
89
|
+
They reject a different request under a recorded request ID with
|
|
90
|
+
``DexServiceError`` whose ``code`` is ``grpc.StatusCode.INVALID_ARGUMENT``
|
|
91
|
+
and whose ``detail`` says the request ID "was already used for a
|
|
92
|
+
different request". To those servers, a Client with
|
|
93
|
+
``payload_encryption`` sends a different request on every attempt,
|
|
94
|
+
because each attempt encrypts the input with a new nonce.
|
|
95
|
+
|
|
96
|
+
Each Flow run keeps only its newest request IDs. The Server limit
|
|
97
|
+
``limits.maxRequestIdsPerRun`` sets how many, 1000 by default. Request
|
|
98
|
+
IDs of the run's other recorded Client requests, such as Attribute
|
|
99
|
+
writes, count toward the same limit. A call with an older, forgotten
|
|
100
|
+
request ID runs as a new request. A new run of the same Flow ID starts
|
|
101
|
+
with no recorded request IDs. Each kept request ID counts toward the
|
|
102
|
+
run's Flow state budget, so keep request IDs short.
|
|
103
|
+
|
|
104
|
+
After the Flow closes, a transactional or locking RPC with a recorded
|
|
105
|
+
request ID still returns its recorded reply, until Dex deletes the
|
|
106
|
+
closed run after its retention period. With a request ID that is not
|
|
107
|
+
recorded, it raises ``FlowNotActiveOrNotFoundError``. A run over its
|
|
108
|
+
Flow state budget, the Server limit ``limits.maxFlowStateBytes``,
|
|
109
|
+
keeps no request ID for an RPC that changes no Flow state, so a retry
|
|
110
|
+
of such an RPC runs again.
|
|
111
|
+
|
|
112
|
+
.. versionadded:: 1.45.17
|
|
113
|
+
|
|
114
|
+
Raises:
|
|
115
|
+
ValueError: If ``request_id`` is an empty string.
|
|
116
|
+
|
|
117
|
+
Examples:
|
|
118
|
+
>>> options = RPCInvokeOptions(
|
|
119
|
+
... lock_attribute_map_instances=(profiles.lock(partition),),
|
|
120
|
+
... load_attribute_map_instances=(profiles.load(partition),),
|
|
121
|
+
... )
|
|
122
|
+
>>> client.invoke_rpc(directory.upsert_customer_profile, flow_id, profile,
|
|
123
|
+
... options=options)
|
|
124
|
+
|
|
125
|
+
Deliver an event to a transactional RPC, retrying while the outcome is
|
|
126
|
+
unknown. Each retry for the same event adds ``event.delta`` at most once:
|
|
127
|
+
|
|
128
|
+
>>> import time
|
|
129
|
+
>>> import grpc
|
|
130
|
+
>>> from dex import DexServiceError, RPCInvokeOptions
|
|
131
|
+
>>> # increment_counter is declared with @rpc(is_transactional=True).
|
|
132
|
+
>>> def deliver_counter_event(event: CounterEvent) -> int:
|
|
133
|
+
... options = RPCInvokeOptions(request_id=f"{event.id}/increment_counter")
|
|
134
|
+
... for attempt in range(1, 6):
|
|
135
|
+
... try:
|
|
136
|
+
... return client.invoke_rpc(
|
|
137
|
+
... counters.increment_counter,
|
|
138
|
+
... event.flow_id,
|
|
139
|
+
... event.delta,
|
|
140
|
+
... options=options,
|
|
141
|
+
... )
|
|
142
|
+
... except DexServiceError as error:
|
|
143
|
+
... is_unknown_outcome = error.code in (
|
|
144
|
+
... grpc.StatusCode.UNAVAILABLE,
|
|
145
|
+
... grpc.StatusCode.DEADLINE_EXCEEDED,
|
|
146
|
+
... )
|
|
147
|
+
... if not is_unknown_outcome or attempt == 5:
|
|
148
|
+
... raise
|
|
149
|
+
... time.sleep(attempt)
|
|
150
|
+
... raise AssertionError("unreachable")
|
|
151
|
+
"""
|
|
152
|
+
|
|
153
|
+
lock_attribute_map_instances: tuple[AttributeLock, ...] = ()
|
|
154
|
+
load_attribute_map_instances: tuple[AttributeMapLoad, ...] = ()
|
|
155
|
+
load_channel_map_instances: tuple[ChannelMapLoad, ...] = ()
|
|
156
|
+
request_id: str | None = None
|
|
157
|
+
|
|
158
|
+
def __post_init__(self) -> None:
|
|
159
|
+
if self.request_id == "":
|
|
160
|
+
raise ValueError("RPC invoke request_id must not be empty")
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dex-python-sdk"
|
|
3
3
|
# Publish uses tag sdk-python/v*; CI stamps this for release builds.
|
|
4
|
-
version = "1.45.
|
|
4
|
+
version = "1.45.17"
|
|
5
5
|
description = "Python SDK for the Dex workflow engine"
|
|
6
6
|
authors = [{name = "Super Durable"}]
|
|
7
7
|
readme = "README.md"
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2026 Super Durable, Inc.
|
|
2
|
-
#
|
|
3
|
-
# Licensed under the Sustainable Use License 1.0.
|
|
4
|
-
# You may not use this file except in compliance with the License.
|
|
5
|
-
# See the LICENSE file in the repository root.
|
|
6
|
-
#
|
|
7
|
-
# SPDX-License-Identifier: LicenseRef-Sustainable-Use-1.0
|
|
8
|
-
|
|
9
|
-
from __future__ import annotations
|
|
10
|
-
|
|
11
|
-
from dataclasses import dataclass
|
|
12
|
-
|
|
13
|
-
from dex.attribute import AttributeLock, AttributeMapLoad
|
|
14
|
-
from dex.channel import ChannelMapLoad
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
@dataclass(frozen=True)
|
|
18
|
-
class RPCInvokeOptions:
|
|
19
|
-
"""Add runtime-selected map instances to one RPC invocation.
|
|
20
|
-
|
|
21
|
-
Dex unions these selections with the RPC decorator's fixed locks and state loads,
|
|
22
|
-
then sorts and deduplicates their physical names. Locking and loading are
|
|
23
|
-
independent. A read-modify-write handler must include the same AttributeMap
|
|
24
|
-
instance in both collections.
|
|
25
|
-
|
|
26
|
-
Attributes:
|
|
27
|
-
lock_attribute_map_instances: AttributeMap instance locks for this call.
|
|
28
|
-
load_attribute_map_instances: Exact AttributeMap instance snapshots.
|
|
29
|
-
load_channel_map_instances: Exact ChannelMap pending-message snapshots.
|
|
30
|
-
|
|
31
|
-
Examples:
|
|
32
|
-
>>> options = RPCInvokeOptions(
|
|
33
|
-
... lock_attribute_map_instances=(profiles.lock(partition),),
|
|
34
|
-
... load_attribute_map_instances=(profiles.load(partition),),
|
|
35
|
-
... )
|
|
36
|
-
>>> client.invoke_rpc(directory.upsert_customer_profile, flow_id, profile,
|
|
37
|
-
... options=options)
|
|
38
|
-
"""
|
|
39
|
-
|
|
40
|
-
lock_attribute_map_instances: tuple[AttributeLock, ...] = ()
|
|
41
|
-
load_attribute_map_instances: tuple[AttributeMapLoad, ...] = ()
|
|
42
|
-
load_channel_map_instances: tuple[ChannelMapLoad, ...] = ()
|
|
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
|
|
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
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/config.rs
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/entry.rs
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/error.rs
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/format.rs
RENAMED
|
File without changes
|
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/policy.rs
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache/src/store.rs
RENAMED
|
File without changes
|
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/Cargo.toml
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/LICENSE
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/README.md
RENAMED
|
File without changes
|
{dex_python_sdk-1.45.16 → dex_python_sdk-1.45.17}/sdk-rust/crates/dex-blob-cache-python/src/lib.rs
RENAMED
|
File without changes
|