dex-python-sdk 1.45.3__tar.gz → 1.45.7__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.3/README.md → dex_python_sdk-1.45.7/PKG-INFO +43 -9
- dex_python_sdk-1.45.3/PKG-INFO → dex_python_sdk-1.45.7/README.md +26 -26
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/__init__.py +12 -1
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_async_worker_dispatcher.py +4 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_invocation_context.py +22 -0
- dex_python_sdk-1.45.7/dex/_pull_slot_streams.py +945 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_pull_worker.py +222 -107
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_server_protocol.py +26 -2
- dex_python_sdk-1.45.7/dex/_stop_flow_mapping.py +43 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_worker_dispatcher.py +22 -1
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/async_client.py +14 -12
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/async_worker.py +42 -3
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/client.py +14 -12
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/condition.py +79 -0
- dex_python_sdk-1.45.7/dex/dexpb/dex_pb2.py +471 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/dexpb/dex_pb2.pyi +34 -8
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_options.py +56 -1
- dex_python_sdk-1.45.7/dex/graceful_completion_context.py +108 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/pull_registration.py +129 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/runtime_errors.py +50 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/wait.py +7 -3
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/worker.py +42 -3
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/worker_options.py +116 -6
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/pyproject.toml +1 -1
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/Cargo.lock +1 -0
- dex_python_sdk-1.45.3/dex/dexpb/dex_pb2.py +0 -467
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/LEGACY_NOTICES.md +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/LICENSE +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_async_value_hydrator.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_attribute_reads.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_credential_transport.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_flow_definition_upload.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_flow_service_tls.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_grpc_errors.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_history_point_mapping.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_message_size.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_native.pyi +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_task_queue_names.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_utils.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_value_hydrator.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/_value_mapper.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/action.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/attribute.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/attribute_match.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/attribute_values.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/blob_cache.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/channel.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/client_options.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/codec.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/context.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/credential.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/dexpb/__init__.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/dexpb/dex_pb2_grpc.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_config.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_definition.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_info.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_result.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_service_tls_options.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/flow_state.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/join.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/py.typed +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/rpc_invoke_options.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/step.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/step_execution.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/stream.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/subflow.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/timer.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/dex/wait_options.py +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/Cargo.toml +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/Cargo.toml +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/LICENSE +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/README.md +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/config.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/entry.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/error.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/format.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/lib.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/policy.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/src/store.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache/tests/blob_cache_integration.rs +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache-python/Cargo.toml +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache-python/LICENSE +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/sdk-rust/crates/dex-blob-cache-python/README.md +0 -0
- {dex_python_sdk-1.45.3 → dex_python_sdk-1.45.7}/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.45.7
|
|
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
|
|
|
@@ -215,15 +231,32 @@ finally:
|
|
|
215
231
|
worker_thread.join()
|
|
216
232
|
```
|
|
217
233
|
|
|
218
|
-
|
|
219
|
-
is one execution slot serving the sticky queue
|
|
220
|
-
Flow type names must be unique within a Dex
|
|
221
|
-
CPU count. Start fails if
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
234
|
+
By default the Worker is fixed: it opens exactly `max_concurrent_tasks`
|
|
235
|
+
long-lived streams. Each stream is one execution slot serving the sticky queue
|
|
236
|
+
and every registered Flow type. Flow type names must be unique within a Dex
|
|
237
|
+
server. Concurrency defaults to the CPU count. Start fails if an explicit
|
|
238
|
+
`max_concurrent_tasks` exceeds the Server's reported
|
|
239
|
+
`matching.maxConcurrentTasksCap`; zero means no limit was reported. With
|
|
240
|
+
`max_concurrent_tasks` unset, the Worker opens one stream first and clamps its
|
|
241
|
+
CPU-count default to the cap with a warning. The Worker checks the limit on
|
|
242
|
+
its first registration only. After a failed check it half-closes its streams,
|
|
243
|
+
drops any task they receive, and never reports readiness; registration waiters
|
|
244
|
+
raise the limit error. A lower limit reported on a later reconnect is logged as
|
|
245
|
+
a warning, and the Worker keeps running.
|
|
246
|
+
|
|
247
|
+
Set `min_open_slots` below `max_concurrent_tasks` to make the Worker adaptive.
|
|
248
|
+
It then keeps between `min_open_slots` and `max_concurrent_tasks` slot streams
|
|
249
|
+
open, both counting the reserved RPC slots, so an idle Worker holds fewer
|
|
250
|
+
Server streams. It doubles its Step-and-RPC streams when a task takes the last
|
|
251
|
+
idle one and half-closes half of the idle surplus every 30 seconds. An adaptive
|
|
252
|
+
Worker clamps `max_concurrent_tasks` to the Server cap with a warning instead
|
|
253
|
+
of failing start. `worker.pull_slot_stream_state()` returns a snapshot of the
|
|
254
|
+
open, busy, and idle streams.
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
# Between 8 and 64 slot streams, one of them reserved for RPCs.
|
|
258
|
+
pull = PullWorkerOptions(max_concurrent_tasks=64, min_open_slots=8)
|
|
259
|
+
```
|
|
227
260
|
`idle_streams_per_queue` is deprecated, remains accepted, and has no effect.
|
|
228
261
|
Each slot executes every task it receives and never rejects a task for capacity.
|
|
229
262
|
Step heartbeats and stream writes use the same stream. Busy streams send a Pong
|
|
@@ -1170,3 +1203,4 @@ original terms as described in [LEGACY_NOTICES.md](LEGACY_NOTICES.md).
|
|
|
1170
1203
|
|
|
1171
1204
|
Searches return runs that match the query. Include `FlowType` when using shared
|
|
1172
1205
|
index slots, and keep the query and page size consistent across pages.
|
|
1206
|
+
|
|
@@ -1,19 +1,3 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: dex-python-sdk
|
|
3
|
-
Version: 1.45.3
|
|
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
|
|
|
@@ -231,15 +215,32 @@ finally:
|
|
|
231
215
|
worker_thread.join()
|
|
232
216
|
```
|
|
233
217
|
|
|
234
|
-
|
|
235
|
-
is one execution slot serving the sticky queue
|
|
236
|
-
Flow type names must be unique within a Dex
|
|
237
|
-
CPU count. Start fails if
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
218
|
+
By default the Worker is fixed: it opens exactly `max_concurrent_tasks`
|
|
219
|
+
long-lived streams. Each stream is one execution slot serving the sticky queue
|
|
220
|
+
and every registered Flow type. Flow type names must be unique within a Dex
|
|
221
|
+
server. Concurrency defaults to the CPU count. Start fails if an explicit
|
|
222
|
+
`max_concurrent_tasks` exceeds the Server's reported
|
|
223
|
+
`matching.maxConcurrentTasksCap`; zero means no limit was reported. With
|
|
224
|
+
`max_concurrent_tasks` unset, the Worker opens one stream first and clamps its
|
|
225
|
+
CPU-count default to the cap with a warning. The Worker checks the limit on
|
|
226
|
+
its first registration only. After a failed check it half-closes its streams,
|
|
227
|
+
drops any task they receive, and never reports readiness; registration waiters
|
|
228
|
+
raise the limit error. A lower limit reported on a later reconnect is logged as
|
|
229
|
+
a warning, and the Worker keeps running.
|
|
230
|
+
|
|
231
|
+
Set `min_open_slots` below `max_concurrent_tasks` to make the Worker adaptive.
|
|
232
|
+
It then keeps between `min_open_slots` and `max_concurrent_tasks` slot streams
|
|
233
|
+
open, both counting the reserved RPC slots, so an idle Worker holds fewer
|
|
234
|
+
Server streams. It doubles its Step-and-RPC streams when a task takes the last
|
|
235
|
+
idle one and half-closes half of the idle surplus every 30 seconds. An adaptive
|
|
236
|
+
Worker clamps `max_concurrent_tasks` to the Server cap with a warning instead
|
|
237
|
+
of failing start. `worker.pull_slot_stream_state()` returns a snapshot of the
|
|
238
|
+
open, busy, and idle streams.
|
|
239
|
+
|
|
240
|
+
```python
|
|
241
|
+
# Between 8 and 64 slot streams, one of them reserved for RPCs.
|
|
242
|
+
pull = PullWorkerOptions(max_concurrent_tasks=64, min_open_slots=8)
|
|
243
|
+
```
|
|
243
244
|
`idle_streams_per_queue` is deprecated, remains accepted, and has no effect.
|
|
244
245
|
Each slot executes every task it receives and never rejects a task for capacity.
|
|
245
246
|
Step heartbeats and stream writes use the same stream. Busy streams send a Pong
|
|
@@ -1186,4 +1187,3 @@ original terms as described in [LEGACY_NOTICES.md](LEGACY_NOTICES.md).
|
|
|
1186
1187
|
|
|
1187
1188
|
Searches return runs that match the query. Include `FlowType` when using shared
|
|
1188
1189
|
index slots, and keep the query and page size consistent across pages.
|
|
1189
|
-
|
|
@@ -45,8 +45,12 @@ from dex.codec import (
|
|
|
45
45
|
Value,
|
|
46
46
|
WireKind,
|
|
47
47
|
)
|
|
48
|
-
from dex.condition import ConditionCombination
|
|
48
|
+
from dex.condition import ConditionCombination, graceful_completion_requested
|
|
49
49
|
from dex.context import AsyncContext, Context, RecoveryErrorInfo, StepAttemptProgress
|
|
50
|
+
from dex.graceful_completion_context import (
|
|
51
|
+
is_graceful_completion_condition_completed,
|
|
52
|
+
supports_graceful_completion_condition,
|
|
53
|
+
)
|
|
50
54
|
from dex.credential import (
|
|
51
55
|
ApiKeyCredential,
|
|
52
56
|
ApiKeyExchangeError,
|
|
@@ -100,6 +104,7 @@ from dex.pull_registration import (
|
|
|
100
104
|
PullQueueRegistrationState,
|
|
101
105
|
PullRegistrationError,
|
|
102
106
|
PullRegistrationState,
|
|
107
|
+
PullSlotStreamState,
|
|
103
108
|
)
|
|
104
109
|
from dex.rpc_invoke_options import RPCInvokeOptions
|
|
105
110
|
from dex.runtime_errors import (
|
|
@@ -116,6 +121,7 @@ from dex.runtime_errors import (
|
|
|
116
121
|
FlowErrorType,
|
|
117
122
|
FlowNotActiveOrNotFoundError,
|
|
118
123
|
FlowNotFoundError,
|
|
124
|
+
GracefulCompletionConditionUnsupportedError,
|
|
119
125
|
InvalidStepResultError,
|
|
120
126
|
LongPollTimeoutError,
|
|
121
127
|
RequestTimeoutError,
|
|
@@ -254,6 +260,7 @@ __all__ = [
|
|
|
254
260
|
"CloneForkFlowOptions",
|
|
255
261
|
"CloneForkFlowResult",
|
|
256
262
|
"CloneForkFlowUnsupportedError",
|
|
263
|
+
"GracefulCompletionConditionUnsupportedError",
|
|
257
264
|
"SubFlowResetPolicy",
|
|
258
265
|
"RetryPolicy",
|
|
259
266
|
"SearchFlowEntry",
|
|
@@ -292,6 +299,7 @@ __all__ = [
|
|
|
292
299
|
"PullRegistrationError",
|
|
293
300
|
"PullRegistrationState",
|
|
294
301
|
"PullQueueRegistrationState",
|
|
302
|
+
"PullSlotStreamState",
|
|
295
303
|
"WaitForAttributeOptions",
|
|
296
304
|
"WaitForStepCompletionOptions",
|
|
297
305
|
"dead_end",
|
|
@@ -299,7 +307,10 @@ __all__ = [
|
|
|
299
307
|
"force_complete_if_channels_empty",
|
|
300
308
|
"force_fail",
|
|
301
309
|
"graceful_complete",
|
|
310
|
+
"graceful_completion_requested",
|
|
302
311
|
"heartbeat",
|
|
312
|
+
"is_graceful_completion_condition_completed",
|
|
313
|
+
"supports_graceful_completion_condition",
|
|
303
314
|
"go_to",
|
|
304
315
|
"go_to_many",
|
|
305
316
|
"open_blob_cache",
|
|
@@ -118,6 +118,7 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
118
118
|
is_active=is_active,
|
|
119
119
|
deadline=deadline,
|
|
120
120
|
output_emitter=emitter,
|
|
121
|
+
server_protocol=self._server_protocol,
|
|
121
122
|
)
|
|
122
123
|
input = self._values.decode(request.step_input, step.input_codec)
|
|
123
124
|
response: pb.InvokeWaitForMethodResponse | None = None
|
|
@@ -227,6 +228,7 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
227
228
|
is_active=is_active,
|
|
228
229
|
deadline=deadline,
|
|
229
230
|
output_emitter=emitter,
|
|
231
|
+
server_protocol=self._server_protocol,
|
|
230
232
|
)
|
|
231
233
|
input = self._values.decode(request.step_input, step.input_codec)
|
|
232
234
|
response: pb.InvokeExecuteMethodResponse | None = None
|
|
@@ -313,6 +315,7 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
313
315
|
is_active=is_active,
|
|
314
316
|
deadline=deadline,
|
|
315
317
|
output_emitter=emitter,
|
|
318
|
+
server_protocol=self._server_protocol,
|
|
316
319
|
)
|
|
317
320
|
response: pb.InvokeExecuteMethodResponse | None = None
|
|
318
321
|
failure: BaseException | None = None
|
|
@@ -379,6 +382,7 @@ class AsyncWorkerDispatcher(WorkerDispatcher):
|
|
|
379
382
|
loaded_channel_names=request.loaded_channel_names,
|
|
380
383
|
loaded_channel_map_instances=request.loaded_channel_map_instances,
|
|
381
384
|
is_active=is_active,
|
|
385
|
+
server_protocol=self._server_protocol,
|
|
382
386
|
)
|
|
383
387
|
arguments: list[object] = [context]
|
|
384
388
|
if rpc.input_codec is not None:
|
|
@@ -13,6 +13,7 @@ from enum import Enum
|
|
|
13
13
|
from typing import Any, Callable, Protocol, Sequence, TypeVar, cast
|
|
14
14
|
from urllib.parse import unquote
|
|
15
15
|
|
|
16
|
+
from dex._server_protocol import NegotiatedServerProtocol
|
|
16
17
|
from dex._utils import require_map_instance, require_name
|
|
17
18
|
from dex._value_mapper import ValueMapper
|
|
18
19
|
from dex.attribute import (
|
|
@@ -84,8 +85,15 @@ class InvocationContext:
|
|
|
84
85
|
is_active: Callable[[], bool] | None = None,
|
|
85
86
|
output_emitter: _StepOutputEmitter | None = None,
|
|
86
87
|
deadline: datetime | None = None,
|
|
88
|
+
server_protocol: NegotiatedServerProtocol | None = None,
|
|
87
89
|
) -> None:
|
|
88
90
|
self._deadline = None if method is InvocationMethod.RPC else deadline
|
|
91
|
+
# None means a test or fake context with no negotiated Server.
|
|
92
|
+
self._server_protocol = (
|
|
93
|
+
server_protocol
|
|
94
|
+
if server_protocol is not None
|
|
95
|
+
else NegotiatedServerProtocol()
|
|
96
|
+
)
|
|
89
97
|
self._method = method
|
|
90
98
|
self._flow = flow
|
|
91
99
|
self._metadata = metadata
|
|
@@ -206,6 +214,20 @@ class InvocationContext:
|
|
|
206
214
|
and results[index].condition_status == pb.CONDITION_STATUS_COMPLETED
|
|
207
215
|
)
|
|
208
216
|
|
|
217
|
+
def is_graceful_completion_condition_completed(self) -> bool:
|
|
218
|
+
if (
|
|
219
|
+
self._method is not InvocationMethod.EXECUTE
|
|
220
|
+
or self._condition_results is None
|
|
221
|
+
):
|
|
222
|
+
return False
|
|
223
|
+
return any(
|
|
224
|
+
result.condition_status == pb.CONDITION_STATUS_COMPLETED
|
|
225
|
+
for result in self._condition_results.graceful_completion_results
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
def supports_graceful_completion_condition(self) -> bool:
|
|
229
|
+
return self._server_protocol.supports_graceful_completion_condition()
|
|
230
|
+
|
|
209
231
|
def wait_for_method_failed(self) -> bool:
|
|
210
232
|
return bool(
|
|
211
233
|
self._condition_results is not None
|