dex-python-sdk 1.38.0__tar.gz → 1.39.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.
- dex_python_sdk-1.38.0/README.md → dex_python_sdk-1.39.1/PKG-INFO +53 -0
- dex_python_sdk-1.38.0/PKG-INFO → dex_python_sdk-1.39.1/README.md +36 -17
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/__init__.py +10 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_async_value_hydrator.py +14 -4
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_async_worker_dispatcher.py +12 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_value_hydrator.py +12 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_worker_dispatcher.py +27 -0
- dex_python_sdk-1.39.1/dex/action.py +365 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/async_client.py +7 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/client.py +7 -0
- dex_python_sdk-1.39.1/dex/dexpb/dex_pb2.py +443 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/dexpb/dex_pb2.pyi +4 -2
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow.py +49 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow_config.py +24 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/pyproject.toml +1 -1
- dex_python_sdk-1.38.0/dex/dexpb/dex_pb2.py +0 -443
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/LEGACY_NOTICES.md +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/LICENSE +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_attribute_reads.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_credential_transport.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_flow_service_tls.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_grpc_errors.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_invocation_context.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_message_size.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_native.pyi +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_pull_worker.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_server_protocol.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_utils.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/_value_mapper.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/async_worker.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/attribute.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/attribute_match.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/attribute_values.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/blob_cache.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/channel.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/client_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/codec.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/condition.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/context.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/credential.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/dexpb/__init__.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/dexpb/dex_pb2_grpc.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow_info.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow_result.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/flow_service_tls_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/pull_registration.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/py.typed +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/rpc_invoke_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/runtime_errors.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/step.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/step_execution.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/stream.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/subflow.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/timer.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/wait.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/wait_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/worker.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/dex/worker_options.py +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/Cargo.lock +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/Cargo.toml +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/Cargo.toml +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/LICENSE +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/README.md +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/config.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/entry.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/error.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/format.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/lib.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/policy.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/src/store.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache/tests/blob_cache_integration.rs +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache-python/Cargo.toml +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache-python/LICENSE +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache-python/README.md +0 -0
- {dex_python_sdk-1.38.0 → dex_python_sdk-1.39.1}/sdk-rust/crates/dex-blob-cache-python/src/lib.rs +0 -0
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dex-python-sdk
|
|
3
|
+
Version: 1.39.1
|
|
4
|
+
Requires-Dist: grpcio>=1.83.0
|
|
5
|
+
Requires-Dist: grpcio-status>=1.83.0
|
|
6
|
+
Requires-Dist: protobuf>=7.35.1
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
License-File: LEGACY_NOTICES.md
|
|
9
|
+
Summary: Python SDK for the Dex workflow engine
|
|
10
|
+
Author: Super Durable
|
|
11
|
+
License-Expression: LicenseRef-Sustainable-Use-1.0
|
|
12
|
+
Requires-Python: >=3.11
|
|
13
|
+
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
|
+
Project-URL: Homepage, https://github.com/superdurable/dex/tree/main/sdk-python
|
|
15
|
+
Project-URL: Repository, https://github.com/superdurable/dex
|
|
16
|
+
|
|
1
17
|
|
|
2
18
|
# Dex SDK for Python
|
|
3
19
|
|
|
@@ -370,6 +386,42 @@ RPC handlers can stage `channel.delete(context, message_id)`. Declare the RPC as
|
|
|
370
386
|
Attribute locks already select transactional execution, but Channel deletion
|
|
371
387
|
itself does not.
|
|
372
388
|
|
|
389
|
+
## Dex Web Actions
|
|
390
|
+
|
|
391
|
+
Since 1.39.0, an RPC can declare an **Action**, which Dex Web offers to a person
|
|
392
|
+
on each run while its condition matches. Pass `action=` to `@rpc`:
|
|
393
|
+
|
|
394
|
+
```python
|
|
395
|
+
from dex import Action, AttributeMatch, rpc, when_attribute_matches
|
|
396
|
+
|
|
397
|
+
# dex:input field-name:reason value-type:string source:user required:true description:"Reason"
|
|
398
|
+
@rpc(
|
|
399
|
+
lock_attributes=(case_status.lock(),),
|
|
400
|
+
action=Action(
|
|
401
|
+
"Reject refund",
|
|
402
|
+
required_permission="refund.approve",
|
|
403
|
+
condition=when_attribute_matches(
|
|
404
|
+
case_status, AttributeMatch.equal_to("awaiting-manager")
|
|
405
|
+
),
|
|
406
|
+
),
|
|
407
|
+
)
|
|
408
|
+
def reject_refund(self, context: Context, request: RejectRefundInput) -> RPCResult[str]:
|
|
409
|
+
if case_status.get(context) != "awaiting-manager":
|
|
410
|
+
raise ValueError("the case is no longer awaiting a decision")
|
|
411
|
+
case_status.set(context, "rejected")
|
|
412
|
+
return RPCResult(f"rejected: {request.reason}")
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
Registry construction validates the Action against the Flow's persistence
|
|
416
|
+
schema. The Worker then sends the Action permission mappings whenever a handler
|
|
417
|
+
writes a condition Attribute, and Client and SubFlow starts write the initial
|
|
418
|
+
`DexWorkQueuePermissions`, as Go Workers and Clients do. The condition is
|
|
419
|
+
optional; an Action without one is offered on every active run. The handler must
|
|
420
|
+
still check current state, because the condition does not authorize the call.
|
|
421
|
+
`dexcli visualize --schema-version 2.0` reads the declaration and the
|
|
422
|
+
`# dex:input` directives into the Flow Definition Graph. See the `Action` and
|
|
423
|
+
`when_attribute_matches` docstrings and the Dex Web reference for the rules.
|
|
424
|
+
|
|
373
425
|
## RPC state loading
|
|
374
426
|
|
|
375
427
|
RPCs receive ordinary Attributes and all Channel size metadata by default.
|
|
@@ -1123,3 +1175,4 @@ removes only the default exclusion; it does not override query filters. Keep
|
|
|
1123
1175
|
the query, inclusion option, and page size consistent across pages.
|
|
1124
1176
|
|
|
1125
1177
|
Pass keyword-only `include_continued_as_new=True` to synchronous or asynchronous `search_flows` for execution-chain inspection. The default is `False`.
|
|
1178
|
+
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: dex-python-sdk
|
|
3
|
-
Version: 1.38.0
|
|
4
|
-
Requires-Dist: grpcio>=1.83.0
|
|
5
|
-
Requires-Dist: grpcio-status>=1.83.0
|
|
6
|
-
Requires-Dist: protobuf>=7.35.1
|
|
7
|
-
License-File: LICENSE
|
|
8
|
-
License-File: LEGACY_NOTICES.md
|
|
9
|
-
Summary: Python SDK for the Dex workflow engine
|
|
10
|
-
Author: Super Durable
|
|
11
|
-
License-Expression: LicenseRef-Sustainable-Use-1.0
|
|
12
|
-
Requires-Python: >=3.11
|
|
13
|
-
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
|
-
Project-URL: Homepage, https://github.com/superdurable/dex/tree/main/sdk-python
|
|
15
|
-
Project-URL: Repository, https://github.com/superdurable/dex
|
|
16
|
-
|
|
17
1
|
|
|
18
2
|
# Dex SDK for Python
|
|
19
3
|
|
|
@@ -386,6 +370,42 @@ RPC handlers can stage `channel.delete(context, message_id)`. Declare the RPC as
|
|
|
386
370
|
Attribute locks already select transactional execution, but Channel deletion
|
|
387
371
|
itself does not.
|
|
388
372
|
|
|
373
|
+
## Dex Web Actions
|
|
374
|
+
|
|
375
|
+
Since 1.39.0, an RPC can declare an **Action**, which Dex Web offers to a person
|
|
376
|
+
on each run while its condition matches. Pass `action=` to `@rpc`:
|
|
377
|
+
|
|
378
|
+
```python
|
|
379
|
+
from dex import Action, AttributeMatch, rpc, when_attribute_matches
|
|
380
|
+
|
|
381
|
+
# dex:input field-name:reason value-type:string source:user required:true description:"Reason"
|
|
382
|
+
@rpc(
|
|
383
|
+
lock_attributes=(case_status.lock(),),
|
|
384
|
+
action=Action(
|
|
385
|
+
"Reject refund",
|
|
386
|
+
required_permission="refund.approve",
|
|
387
|
+
condition=when_attribute_matches(
|
|
388
|
+
case_status, AttributeMatch.equal_to("awaiting-manager")
|
|
389
|
+
),
|
|
390
|
+
),
|
|
391
|
+
)
|
|
392
|
+
def reject_refund(self, context: Context, request: RejectRefundInput) -> RPCResult[str]:
|
|
393
|
+
if case_status.get(context) != "awaiting-manager":
|
|
394
|
+
raise ValueError("the case is no longer awaiting a decision")
|
|
395
|
+
case_status.set(context, "rejected")
|
|
396
|
+
return RPCResult(f"rejected: {request.reason}")
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
Registry construction validates the Action against the Flow's persistence
|
|
400
|
+
schema. The Worker then sends the Action permission mappings whenever a handler
|
|
401
|
+
writes a condition Attribute, and Client and SubFlow starts write the initial
|
|
402
|
+
`DexWorkQueuePermissions`, as Go Workers and Clients do. The condition is
|
|
403
|
+
optional; an Action without one is offered on every active run. The handler must
|
|
404
|
+
still check current state, because the condition does not authorize the call.
|
|
405
|
+
`dexcli visualize --schema-version 2.0` reads the declaration and the
|
|
406
|
+
`# dex:input` directives into the Flow Definition Graph. See the `Action` and
|
|
407
|
+
`when_attribute_matches` docstrings and the Dex Web reference for the rules.
|
|
408
|
+
|
|
389
409
|
## RPC state loading
|
|
390
410
|
|
|
391
411
|
RPCs receive ordinary Attributes and all Channel size metadata by default.
|
|
@@ -1139,4 +1159,3 @@ removes only the default exclusion; it does not override query filters. Keep
|
|
|
1139
1159
|
the query, inclusion option, and page size consistent across pages.
|
|
1140
1160
|
|
|
1141
1161
|
Pass keyword-only `include_continued_as_new=True` to synchronous or asynchronous `search_flows` for execution-chain inspection. The default is `False`.
|
|
1142
|
-
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
# See LICENSE and LEGACY_NOTICES.md.
|
|
10
10
|
|
|
11
11
|
from dex._grpc_errors import RetryAfterError, retry_after
|
|
12
|
+
from dex.action import (
|
|
13
|
+
WORK_QUEUE_PERMISSIONS_INDEX_KEY,
|
|
14
|
+
Action,
|
|
15
|
+
ActionCondition,
|
|
16
|
+
when_attribute_matches,
|
|
17
|
+
)
|
|
12
18
|
from dex.async_client import AsyncClient
|
|
13
19
|
from dex.async_worker import AsyncWorker
|
|
14
20
|
from dex.attribute import (
|
|
@@ -134,6 +140,10 @@ from dex.worker import Worker
|
|
|
134
140
|
from dex.worker_options import PullWorkerOptions, WorkerOptions
|
|
135
141
|
|
|
136
142
|
__all__ = [
|
|
143
|
+
"Action",
|
|
144
|
+
"ActionCondition",
|
|
145
|
+
"WORK_QUEUE_PERMISSIONS_INDEX_KEY",
|
|
146
|
+
"when_attribute_matches",
|
|
137
147
|
"BOOL",
|
|
138
148
|
"BYTES",
|
|
139
149
|
"DOUBLE",
|
|
@@ -15,6 +15,7 @@ from typing import cast
|
|
|
15
15
|
import grpc
|
|
16
16
|
|
|
17
17
|
from dex._message_size import is_grpc_message_size_error
|
|
18
|
+
from dex._value_hydrator import _MAX_LOAD_BLOBS_ENTRIES
|
|
18
19
|
from dex.blob_cache import BlobCache
|
|
19
20
|
from dex.dexpb import dex_pb2 as pb
|
|
20
21
|
from dex.dexpb import dex_pb2_grpc
|
|
@@ -50,9 +51,7 @@ class AsyncValueHydrator:
|
|
|
50
51
|
flow_id: str,
|
|
51
52
|
values: list[pb.Value],
|
|
52
53
|
) -> list[pb.Value]:
|
|
53
|
-
return await self.hydrate_all_for_flows(
|
|
54
|
-
[(flow_id, value) for value in values]
|
|
55
|
-
)
|
|
54
|
+
return await self.hydrate_all_for_flows([(flow_id, value) for value in values])
|
|
56
55
|
|
|
57
56
|
async def hydrate_all_for_flows(
|
|
58
57
|
self,
|
|
@@ -226,8 +225,19 @@ class AsyncValueHydrator:
|
|
|
226
225
|
miss.hydrated = concrete
|
|
227
226
|
self._write_cache(miss, concrete)
|
|
228
227
|
|
|
229
|
-
async def _load_blob_values(
|
|
228
|
+
async def _load_blob_values(
|
|
229
|
+
self, misses: list[_PendingBlob]
|
|
230
|
+
) -> dict[str, pb.Value]:
|
|
230
231
|
"""Load blobs, halving a batch whose response exceeds a gRPC size limit."""
|
|
232
|
+
if len(misses) > _MAX_LOAD_BLOBS_ENTRIES:
|
|
233
|
+
values: dict[str, pb.Value] = {}
|
|
234
|
+
for start in range(0, len(misses), _MAX_LOAD_BLOBS_ENTRIES):
|
|
235
|
+
values.update(
|
|
236
|
+
await self._load_blob_values(
|
|
237
|
+
misses[start : start + _MAX_LOAD_BLOBS_ENTRIES]
|
|
238
|
+
)
|
|
239
|
+
)
|
|
240
|
+
return values
|
|
231
241
|
try:
|
|
232
242
|
response = await self._service.LoadBlobs(
|
|
233
243
|
pb.LoadBlobsRequest(
|
|
@@ -139,6 +139,9 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
139
139
|
raise TypeError("wait_for must return Wait")
|
|
140
140
|
response = pb.InvokeWaitForMethodResponse(
|
|
141
141
|
upsert_attributes=self._result_attribute_writes(context),
|
|
142
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
143
|
+
context
|
|
144
|
+
),
|
|
142
145
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
143
146
|
record_events=context.events,
|
|
144
147
|
publish_to_channel=context.publications,
|
|
@@ -246,6 +249,9 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
246
249
|
response = pb.InvokeExecuteMethodResponse(
|
|
247
250
|
step_decision=self._map_decision(flow, decision),
|
|
248
251
|
upsert_attributes=self._result_attribute_writes(context),
|
|
252
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
253
|
+
context
|
|
254
|
+
),
|
|
249
255
|
record_events=context.events,
|
|
250
256
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
251
257
|
publish_to_channel=context.publications,
|
|
@@ -328,6 +334,9 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
328
334
|
response = pb.InvokeExecuteMethodResponse(
|
|
329
335
|
step_decision=self._map_decision(flow, decision),
|
|
330
336
|
upsert_attributes=self._result_attribute_writes(context),
|
|
337
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
338
|
+
context
|
|
339
|
+
),
|
|
331
340
|
record_events=context.events,
|
|
332
341
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
333
342
|
publish_to_channel=context.publications,
|
|
@@ -380,6 +389,9 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
380
389
|
try:
|
|
381
390
|
response = pb.InvokeWorkerRPCResponse(
|
|
382
391
|
upsert_attributes=self._result_attribute_writes(context),
|
|
392
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
393
|
+
context
|
|
394
|
+
),
|
|
383
395
|
record_events=context.events,
|
|
384
396
|
delete_from_channel=context.channel_deletions,
|
|
385
397
|
publish_to_channel=context.publications,
|
|
@@ -20,6 +20,9 @@ from dex.dexpb import dex_pb2 as pb
|
|
|
20
20
|
from dex.dexpb import dex_pb2_grpc
|
|
21
21
|
from dex.runtime_errors import BlobMessageTooLargeError
|
|
22
22
|
|
|
23
|
+
# The server rejects more than 1000 entries while history offload is on.
|
|
24
|
+
_MAX_LOAD_BLOBS_ENTRIES = 1000
|
|
25
|
+
|
|
23
26
|
_LOGGER = logging.getLogger(__name__)
|
|
24
27
|
|
|
25
28
|
|
|
@@ -222,6 +225,15 @@ class ValueHydrator:
|
|
|
222
225
|
|
|
223
226
|
def _load_blob_values(self, misses: list[_PendingBlob]) -> dict[str, pb.Value]:
|
|
224
227
|
"""Load blobs, halving a batch whose response exceeds a gRPC size limit."""
|
|
228
|
+
if len(misses) > _MAX_LOAD_BLOBS_ENTRIES:
|
|
229
|
+
values: dict[str, pb.Value] = {}
|
|
230
|
+
for start in range(0, len(misses), _MAX_LOAD_BLOBS_ENTRIES):
|
|
231
|
+
values.update(
|
|
232
|
+
self._load_blob_values(
|
|
233
|
+
misses[start : start + _MAX_LOAD_BLOBS_ENTRIES]
|
|
234
|
+
)
|
|
235
|
+
)
|
|
236
|
+
return values
|
|
225
237
|
try:
|
|
226
238
|
response = self._service.LoadBlobs(
|
|
227
239
|
pb.LoadBlobsRequest(
|
|
@@ -109,6 +109,9 @@ class WorkerDispatcher:
|
|
|
109
109
|
raise TypeError("wait_for must return Wait")
|
|
110
110
|
response = pb.InvokeWaitForMethodResponse(
|
|
111
111
|
upsert_attributes=self._result_attribute_writes(context),
|
|
112
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
113
|
+
context
|
|
114
|
+
),
|
|
112
115
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
113
116
|
record_events=context.events,
|
|
114
117
|
publish_to_channel=context.publications,
|
|
@@ -173,6 +176,9 @@ class WorkerDispatcher:
|
|
|
173
176
|
result=pb.InvokeExecuteMethodResponse(
|
|
174
177
|
step_decision=self._map_decision(flow, decision),
|
|
175
178
|
upsert_attributes=self._result_attribute_writes(context),
|
|
179
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
180
|
+
context
|
|
181
|
+
),
|
|
176
182
|
record_events=context.events,
|
|
177
183
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
178
184
|
publish_to_channel=context.publications,
|
|
@@ -246,6 +252,9 @@ class WorkerDispatcher:
|
|
|
246
252
|
return pb.InvokeExecuteMethodResponse(
|
|
247
253
|
step_decision=self._map_decision(flow, decision),
|
|
248
254
|
upsert_attributes=self._result_attribute_writes(context),
|
|
255
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
256
|
+
context
|
|
257
|
+
),
|
|
249
258
|
record_events=context.events,
|
|
250
259
|
upsert_step_exe_locals=list(context.local_writes.values()),
|
|
251
260
|
publish_to_channel=context.publications,
|
|
@@ -288,6 +297,9 @@ class WorkerDispatcher:
|
|
|
288
297
|
try:
|
|
289
298
|
response = pb.InvokeWorkerRPCResponse(
|
|
290
299
|
upsert_attributes=self._result_attribute_writes(context),
|
|
300
|
+
action_permission_mappings=self._result_action_permission_mappings(
|
|
301
|
+
context
|
|
302
|
+
),
|
|
291
303
|
record_events=context.events,
|
|
292
304
|
delete_from_channel=context.channel_deletions,
|
|
293
305
|
publish_to_channel=context.publications,
|
|
@@ -712,6 +724,9 @@ class WorkerDispatcher:
|
|
|
712
724
|
_apply_attribute_store_sync(write, definition)
|
|
713
725
|
_apply_hard_delete_on_null(write, definition)
|
|
714
726
|
mapped.attributes.append(write)
|
|
727
|
+
mapped.attributes.extend(
|
|
728
|
+
target.initial_work_queue_permissions_writes(mapped.attributes)
|
|
729
|
+
)
|
|
715
730
|
self._server_protocol.require_hard_delete_attribute_support(mapped.attributes)
|
|
716
731
|
if options.config_override is not None:
|
|
717
732
|
mapped.flow_config_override.CopyFrom(
|
|
@@ -730,6 +745,14 @@ class WorkerDispatcher:
|
|
|
730
745
|
self._server_protocol.require_hard_delete_attribute_support(writes)
|
|
731
746
|
return writes
|
|
732
747
|
|
|
748
|
+
@staticmethod
|
|
749
|
+
def _result_action_permission_mappings(
|
|
750
|
+
context: InvocationContext,
|
|
751
|
+
) -> pb.ActionPermissionMappings | None:
|
|
752
|
+
return context._flow.action_permission_mappings_for_writes(
|
|
753
|
+
list(context.attribute_writes.values())
|
|
754
|
+
)
|
|
755
|
+
|
|
733
756
|
@staticmethod
|
|
734
757
|
def _map_flow_retry(retry: RetryPolicy) -> pb.FlowRetryPolicy:
|
|
735
758
|
mapped = pb.FlowRetryPolicy(
|
|
@@ -777,6 +800,10 @@ class WorkerDispatcher:
|
|
|
777
800
|
)
|
|
778
801
|
if config.history_window_events is not None:
|
|
779
802
|
mapped.history_window_events = config.history_window_events
|
|
803
|
+
if config.delete_expired_history_objects is not None:
|
|
804
|
+
mapped.delete_expired_history_objects = (
|
|
805
|
+
config.delete_expired_history_objects
|
|
806
|
+
)
|
|
780
807
|
return mapped
|
|
781
808
|
|
|
782
809
|
def _map_decision(
|