durable-workflow 2.16.0__tar.gz → 2.17.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.
- {durable_workflow-2.16.0/src/durable_workflow.egg-info → durable_workflow-2.17.1}/PKG-INFO +1 -1
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/pyproject.toml +3 -3
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/__init__.py +8 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_metric_routes.py +1 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/client.py +288 -6
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/errors.py +156 -1
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/sync.py +70 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/worker.py +130 -2
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/workflow.py +21 -1
- {durable_workflow-2.16.0 → durable_workflow-2.17.1/src/durable_workflow.egg-info}/PKG-INFO +1 -1
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow.egg-info/SOURCES.txt +5 -0
- durable_workflow-2.17.1/tests/test_activity_run_closed_refusal.py +221 -0
- durable_workflow-2.17.1/tests/test_completion_size_limit.py +201 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_metric_routes.py +1 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_public_boundary_scanner.py +44 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_replay_regression_corpus.py +65 -1
- durable_workflow-2.17.1/tests/test_run_closed_settlement_replay.py +658 -0
- durable_workflow-2.17.1/tests/test_static_credential_validation.py +58 -0
- durable_workflow-2.17.1/tests/test_update_outcome.py +417 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/LICENSE +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/README.md +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/setup.cfg +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_activity_lease.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_activity_process.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_avro.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_cancellation_scope.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_cancellation_scope_history.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_condition_fingerprint.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_cooperative_cancellation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_failure_reporting.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_poll_transport.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_prepared_local_activity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_query_task_authority.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/_typed_values.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/activity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/auth_composition.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/cancellation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/external_storage.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/external_task_input.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/external_task_result.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/history_bundle_verify.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/interceptors.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/invocable.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/metrics.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/nexus.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/py.typed +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/python_conformance.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/replay_clock.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/replay_clock_math.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/replay_conformance.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/replay_verify.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/retry_policy.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/serializer.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/server_compatibility.json +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/telemetry.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/telemetry_carrier.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/testing.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/worker_session.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/worker_status.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow/workflow_updates_conformance.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow.egg-info/entry_points.txt +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow.egg-info/requires.txt +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/src/durable_workflow.egg-info/top_level.txt +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_cancellation_policies.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_context.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_heartbeat_authority.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_identity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_lease_authority.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_lease_renewal.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_lease_worker.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_process.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_activity_retry_info.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_auth_composition.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_avro_value_benchmark.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_avro_value_protocol.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_business_replay_clock.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_business_replay_clock_child.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_business_replay_clock_parallel.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_business_replay_clock_redrive.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_business_replay_clock_sequence_claims.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_context.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_remaining_time.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_scope_admission.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_scope_authoring.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_scope_boundary.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cancellation_scope_opening.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_child_workflow_policies.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_ci_checkout.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_ci_integration_endpoint.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_client.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_client_iterators.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_client_telemetry.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_client_timeouts.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_codec_regression_corpus.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_committed_cancellation_scope_descendants.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_committed_cancellation_scope_groups.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_committed_cancellation_scope_history.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_committed_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_condition_fingerprint.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_condition_occurrence_id.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_condition_replay_drift.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_control_plane_parity_fixtures.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cooperative_cancellation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cooperative_cancellation_client.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cooperative_cancellation_worker.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_cooperative_remote_worker.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_docs_release_channel.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_docstring_cross_references.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_durable_selection.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_empty_callback_failure.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_errors.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_external_storage.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_external_task_input.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_external_task_result.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_failure_reporting.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_generator_lifecycle.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_golden_history_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_history_bundle_pruned.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_history_bundle_schema2.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_history_bundle_verify.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_history_event_contract.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_invocable.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_local_activity_backoff.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_local_failure_reporting.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_message_streams.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_metrics.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_nexus_durable_wait.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_nexus_namespace.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_nexus_wire.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_order_processing_example.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_parallel_completion_order_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_parallel_saga_authoring.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_patch_history.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_pending_operation_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_poll_failure_backoff.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_poll_transport.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_portal_source_split.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_prepared_local_activity_client.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_prepared_local_activity_groups.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_prepared_local_activity_policies.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_prepared_local_activity_worker.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_publish_workflow_isolation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_pypi_project_surface.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_python_conformance.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_queries.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_query_task_authority.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_query_timeout_retry.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_readme_quickstart.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_redrive_call_ledger.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_redrive_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_redrive_successor_evidence.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_registration_ambiguity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_release_metadata.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_replay_clock.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_replay_conformance.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_replay_verify.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_retry_policy.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_run_activities.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_run_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_runtime_external_payload_transport.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_schedules.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_scoped_run_cancellation_context.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sdk_metrics_contract.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_search_attribute_replay_identity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_serializer.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_signals.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sleep.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_standalone_activity_client.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sticky_execution.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sticky_history_suffix.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_storage_admission.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sync.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_sync_activities.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_telemetry.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_telemetry_carrier.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_testing_failures.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_testing_harness.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_testing_nexus.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_threaded_heartbeat_example.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_tls_trust.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_transport_diagnostics.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_typed_values.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_typed_workflow_values.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_update_signal_condition_replay.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_updates.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_wait_condition.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_deregistration.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_observation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_session.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_startup_buffered.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_startup_raw.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_startup_read_budget.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_startup_snapshot.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_status.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_worker_telemetry_wire.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_entry_arguments.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_entrypoint_validation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_handler_validation.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_identity.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_result_timeout.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_streams.py +0 -0
- {durable_workflow-2.16.0 → durable_workflow-2.17.1}/tests/test_workflow_updates_conformance.py +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "durable-workflow"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.17.1"
|
|
8
8
|
description = "Python client and worker SDK for Durable Workflow Cloud and self-hosted Server"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.10"
|
|
@@ -79,8 +79,8 @@ durable-workflow-replay-conformance = "durable_workflow.replay_conformance:main"
|
|
|
79
79
|
durable-workflow-workflow-updates-conformance = "durable_workflow.workflow_updates_conformance:main"
|
|
80
80
|
|
|
81
81
|
[tool.durable-workflow]
|
|
82
|
-
product-train = "2.
|
|
83
|
-
registry-version = "2.
|
|
82
|
+
product-train = "2.17.1"
|
|
83
|
+
registry-version = "2.17.1"
|
|
84
84
|
supported-server-versions = "2.8.0"
|
|
85
85
|
supported-server-release-baselines = { "2" = "2.8.0", "3" = "3.0.0" }
|
|
86
86
|
worker-protocol-version = "1.20"
|
|
@@ -104,8 +104,11 @@ from .errors import (
|
|
|
104
104
|
SignalFailed,
|
|
105
105
|
TypedValueError,
|
|
106
106
|
Unauthorized,
|
|
107
|
+
UnrecognizedUpdateOutcome,
|
|
107
108
|
UpdateFailed,
|
|
109
|
+
UpdateNotFound,
|
|
108
110
|
UpdateRejected,
|
|
111
|
+
UpdateStillPending,
|
|
109
112
|
UpdateValidationFailed,
|
|
110
113
|
WorkflowAlreadyStarted,
|
|
111
114
|
WorkflowCancelled,
|
|
@@ -113,6 +116,7 @@ from .errors import (
|
|
|
113
116
|
WorkflowFailed,
|
|
114
117
|
WorkflowNotFound,
|
|
115
118
|
WorkflowPayloadDecodeError,
|
|
119
|
+
WorkflowTaskCompletionTooLarge,
|
|
116
120
|
WorkflowTerminated,
|
|
117
121
|
WorkflowTimedOut,
|
|
118
122
|
)
|
|
@@ -411,13 +415,17 @@ __all__ = [
|
|
|
411
415
|
"SignalFailed",
|
|
412
416
|
"TransportRetryPolicy",
|
|
413
417
|
"Unauthorized",
|
|
418
|
+
"UnrecognizedUpdateOutcome",
|
|
414
419
|
"UpdateFailed",
|
|
420
|
+
"UpdateNotFound",
|
|
415
421
|
"UpdateRejected",
|
|
422
|
+
"UpdateStillPending",
|
|
416
423
|
"UpdateValidationFailed",
|
|
417
424
|
"WorkflowAlreadyStarted",
|
|
418
425
|
"WorkflowCancelled",
|
|
419
426
|
"WorkflowFailed",
|
|
420
427
|
"WorkflowNotFound",
|
|
428
|
+
"WorkflowTaskCompletionTooLarge",
|
|
421
429
|
"WorkflowTerminated",
|
|
422
430
|
"WorkflowTimedOut",
|
|
423
431
|
"EXTERNAL_TASK_INPUT_CONTRACT_SCHEMA",
|
|
@@ -31,6 +31,7 @@ _ROUTES = (
|
|
|
31
31
|
*(f"/workflows/{{workflow_id}}/{action}"
|
|
32
32
|
for action in ("archive", "cancel", "repair", "terminate", "request-cancellation", "runs")),
|
|
33
33
|
*(f"/workflows/{{workflow_id}}/{action}/{{name}}" for action in ("signal", "query", "update")),
|
|
34
|
+
"/workflows/{workflow_id}/updates/{update_id}",
|
|
34
35
|
"/workflows/{workflow_id}/message-streams/{name}/messages",
|
|
35
36
|
"/workflows/{workflow_id}/runs/{run_id}",
|
|
36
37
|
*(f"/workflows/{{workflow_id}}/runs/{{run_id}}/{action}"
|
|
@@ -74,12 +74,16 @@ from .errors import (
|
|
|
74
74
|
RuntimeDiscoveryUnavailable,
|
|
75
75
|
ServerError,
|
|
76
76
|
SignalFailed,
|
|
77
|
+
UnrecognizedUpdateOutcome,
|
|
77
78
|
UpdateFailed,
|
|
79
|
+
UpdateRejected,
|
|
80
|
+
UpdateStillPending,
|
|
78
81
|
WorkflowCancelled,
|
|
79
82
|
WorkflowFailed,
|
|
80
83
|
WorkflowTerminated,
|
|
81
84
|
WorkflowTimedOut,
|
|
82
85
|
_raise_for_status,
|
|
86
|
+
_raise_for_update_outcome_read,
|
|
83
87
|
)
|
|
84
88
|
from .external_storage import (
|
|
85
89
|
RUNTIME_EXTERNAL_PAYLOAD_REFERENCE_SCHEMA,
|
|
@@ -121,6 +125,11 @@ CONTROL_PLANE_REQUEST_CONTRACT_SCHEMA = "durable-workflow.v2.control-plane-reque
|
|
|
121
125
|
CONTROL_PLANE_REQUEST_CONTRACT_VERSION = 1
|
|
122
126
|
_QUERY_TASKS_DISCOVERY_PATH = "worker_protocol.server_capabilities.query_tasks"
|
|
123
127
|
_COOPERATIVE_CANCELLATION_DISCOVERY_PATH = "worker_protocol.server_capabilities.cooperative_cancellation"
|
|
128
|
+
_UPDATE_OUTCOME_READS_DISCOVERY_PATH = "capabilities.update_outcome_reads"
|
|
129
|
+
_UPDATE_OUTCOME_WAIT_STAGES = ("accepted", "completed")
|
|
130
|
+
# Client-side headroom beyond a requested completion wait, so the HTTP timeout
|
|
131
|
+
# never cuts off a Server that is still legitimately waiting.
|
|
132
|
+
_UPDATE_OUTCOME_WAIT_HEADROOM_SECONDS = 30.0
|
|
124
133
|
_UPDATE_WAIT_STAGES_DISCOVERY_PATH = (
|
|
125
134
|
"control_plane.request_contract.operations.update.fields.wait_for.canonical_values"
|
|
126
135
|
)
|
|
@@ -304,6 +313,52 @@ def _command_request_failure(exc: Exception, *, command: str, request_id: str) -
|
|
|
304
313
|
return exc
|
|
305
314
|
|
|
306
315
|
|
|
316
|
+
def _update_outcome_value(
|
|
317
|
+
receipt: dict[str, Any], *, workflow_id: str, update_id: str, result_type: Any = None,
|
|
318
|
+
) -> Any:
|
|
319
|
+
"""Return a completed update's decoded result, or raise for any other receipt.
|
|
320
|
+
|
|
321
|
+
A pending receipt raises :class:`UpdateStillPending`, never ``None``.
|
|
322
|
+
"""
|
|
323
|
+
status = receipt.get("update_status")
|
|
324
|
+
if isinstance(receipt.get("result_envelope"), dict) or status == "completed":
|
|
325
|
+
value = receipt.get("result")
|
|
326
|
+
return value if result_type is None else decode_payload_value(value, result_type, "update result")
|
|
327
|
+
if status == "failed":
|
|
328
|
+
message = receipt.get("failure_message")
|
|
329
|
+
raise UpdateFailed(
|
|
330
|
+
message if isinstance(message, str) and message else "workflow update failed",
|
|
331
|
+
status=200,
|
|
332
|
+
body=receipt,
|
|
333
|
+
)
|
|
334
|
+
if status == "rejected":
|
|
335
|
+
raise UpdateRejected("update rejected", body=receipt)
|
|
336
|
+
|
|
337
|
+
if status != "accepted":
|
|
338
|
+
raise UnrecognizedUpdateOutcome(
|
|
339
|
+
f"update {update_id} on workflow {workflow_id} answered with update_status {status!r}, "
|
|
340
|
+
"which is not completed, accepted, failed or rejected; no result was returned",
|
|
341
|
+
workflow_id=workflow_id,
|
|
342
|
+
update_id=update_id,
|
|
343
|
+
body=receipt,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
def text(name: str) -> str | None:
|
|
347
|
+
value = receipt.get(name)
|
|
348
|
+
return value if isinstance(value, str) and value else None
|
|
349
|
+
|
|
350
|
+
raise UpdateStillPending(
|
|
351
|
+
workflow_id=text("workflow_id") or workflow_id,
|
|
352
|
+
update_id=text("update_id") or update_id,
|
|
353
|
+
run_id=text("run_id"),
|
|
354
|
+
update_name=text("update_name"),
|
|
355
|
+
request_id=text("request_id"),
|
|
356
|
+
update_status=text("update_status"),
|
|
357
|
+
wait_timed_out=receipt.get("wait_timed_out") is True,
|
|
358
|
+
body=receipt,
|
|
359
|
+
)
|
|
360
|
+
|
|
361
|
+
|
|
307
362
|
def _resolve_namespace_name(
|
|
308
363
|
name: str | None,
|
|
309
364
|
namespace_alias: str | None,
|
|
@@ -1633,7 +1688,7 @@ class WorkflowHandle:
|
|
|
1633
1688
|
wait_timeout_seconds: int | None = None,
|
|
1634
1689
|
request_id: str | None = None,
|
|
1635
1690
|
) -> Any:
|
|
1636
|
-
"""Send
|
|
1691
|
+
"""Send an update to this workflow and return the Server's receipt. See :meth:`Client.update_workflow`."""
|
|
1637
1692
|
return await self._client.update_workflow(
|
|
1638
1693
|
self.workflow_id,
|
|
1639
1694
|
update_name,
|
|
@@ -1643,6 +1698,38 @@ class WorkflowHandle:
|
|
|
1643
1698
|
request_id=request_id,
|
|
1644
1699
|
)
|
|
1645
1700
|
|
|
1701
|
+
async def update_outcome(
|
|
1702
|
+
self,
|
|
1703
|
+
update_id: str,
|
|
1704
|
+
*,
|
|
1705
|
+
wait_for: str = "completed",
|
|
1706
|
+
wait_timeout_seconds: int | None = None,
|
|
1707
|
+
result_type: Any = None,
|
|
1708
|
+
) -> Any:
|
|
1709
|
+
"""Read an accepted update's outcome later by update id. See :meth:`Client.update_outcome`."""
|
|
1710
|
+
return await self._client.update_outcome(
|
|
1711
|
+
self.workflow_id,
|
|
1712
|
+
update_id,
|
|
1713
|
+
wait_for=wait_for,
|
|
1714
|
+
wait_timeout_seconds=wait_timeout_seconds,
|
|
1715
|
+
result_type=result_type,
|
|
1716
|
+
)
|
|
1717
|
+
|
|
1718
|
+
async def update_outcome_receipt(
|
|
1719
|
+
self,
|
|
1720
|
+
update_id: str,
|
|
1721
|
+
*,
|
|
1722
|
+
wait_for: str = "accepted",
|
|
1723
|
+
wait_timeout_seconds: int | None = None,
|
|
1724
|
+
) -> dict[str, Any]:
|
|
1725
|
+
"""Read an accepted update's receipt by update id. See :meth:`Client.update_outcome_receipt`."""
|
|
1726
|
+
return await self._client.update_outcome_receipt(
|
|
1727
|
+
self.workflow_id,
|
|
1728
|
+
update_id,
|
|
1729
|
+
wait_for=wait_for,
|
|
1730
|
+
wait_timeout_seconds=wait_timeout_seconds,
|
|
1731
|
+
)
|
|
1732
|
+
|
|
1646
1733
|
|
|
1647
1734
|
class StandaloneActivityHandle:
|
|
1648
1735
|
"""Convenience wrapper for operating on one standalone activity job.
|
|
@@ -1790,6 +1877,24 @@ class ScheduleHandle:
|
|
|
1790
1877
|
)
|
|
1791
1878
|
|
|
1792
1879
|
|
|
1880
|
+
def _request_body_bytes(request: httpx.Request) -> int | None:
|
|
1881
|
+
"""The encoded body length of a sent request, when it was buffered."""
|
|
1882
|
+
try:
|
|
1883
|
+
return len(request.content)
|
|
1884
|
+
except httpx.RequestNotRead:
|
|
1885
|
+
return None
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
def _validate_static_credential(option: str, value: str | None) -> None:
|
|
1889
|
+
if not value:
|
|
1890
|
+
return
|
|
1891
|
+
# Python's extra whitespace code points are Cc controls, also forbidden here.
|
|
1892
|
+
# Validate the original value, including credentials masked by role fallback.
|
|
1893
|
+
if (value[0].isspace() or value[-1].isspace()
|
|
1894
|
+
or any(ord(char) <= 0x1F or 0x7F <= ord(char) <= 0x9F for char in value)):
|
|
1895
|
+
raise ValueError(f"{option} must not have edge whitespace or control characters")
|
|
1896
|
+
|
|
1897
|
+
|
|
1793
1898
|
class Client:
|
|
1794
1899
|
"""Async HTTP client for Durable Workflow control-plane and worker APIs.
|
|
1795
1900
|
|
|
@@ -1802,6 +1907,9 @@ class Client:
|
|
|
1802
1907
|
``tls_context`` selects an explicit trust configuration. It must require
|
|
1803
1908
|
certificate and hostname verification. Treat the context as read-only after
|
|
1804
1909
|
construction; worker query clones and Nexus namespace views reuse it.
|
|
1910
|
+
|
|
1911
|
+
Static tokens must have no edge whitespace or control characters. Invalid
|
|
1912
|
+
values raise ``ValueError`` naming the option, without exposing its value.
|
|
1805
1913
|
"""
|
|
1806
1914
|
|
|
1807
1915
|
def __init__(
|
|
@@ -1825,6 +1933,9 @@ class Client:
|
|
|
1825
1933
|
external_storage_cache: ExternalPayloadCache | None = None,
|
|
1826
1934
|
telemetry: ExecutionTelemetry | None = None,
|
|
1827
1935
|
) -> None:
|
|
1936
|
+
_validate_static_credential("token", token)
|
|
1937
|
+
_validate_static_credential("control_token", control_token)
|
|
1938
|
+
_validate_static_credential("worker_token", worker_token)
|
|
1828
1939
|
if tls_context is not None:
|
|
1829
1940
|
if not isinstance(tls_context, ssl.SSLContext):
|
|
1830
1941
|
raise TypeError("tls_context must be an ssl.SSLContext")
|
|
@@ -2068,6 +2179,7 @@ class Client:
|
|
|
2068
2179
|
timeout: float | None = None,
|
|
2069
2180
|
context: str = "",
|
|
2070
2181
|
retry: bool = True,
|
|
2182
|
+
raise_for_status: Callable[..., None] = _raise_for_status,
|
|
2071
2183
|
) -> Any:
|
|
2072
2184
|
if worker and discovery:
|
|
2073
2185
|
raise ValueError("a request cannot be both worker-plane and cluster discovery")
|
|
@@ -2167,7 +2279,14 @@ class Client:
|
|
|
2167
2279
|
body = exc.response.json()
|
|
2168
2280
|
except ValueError:
|
|
2169
2281
|
body = exc.response.text
|
|
2170
|
-
|
|
2282
|
+
# The typed completion-size refusal carries the limit; the
|
|
2283
|
+
# size is the encoded request body this client sent.
|
|
2284
|
+
if raise_for_status is _raise_for_status:
|
|
2285
|
+
raise_for_status(
|
|
2286
|
+
exc.response.status_code, body, context=context,
|
|
2287
|
+
request_bytes=_request_body_bytes(exc.request),
|
|
2288
|
+
)
|
|
2289
|
+
raise_for_status(exc.response.status_code, body, context=context)
|
|
2171
2290
|
raise # unreachable, but keeps type checker happy
|
|
2172
2291
|
|
|
2173
2292
|
status_code = str(resp.status_code)
|
|
@@ -3098,6 +3217,27 @@ class Client:
|
|
|
3098
3217
|
supported_values=supported_stages,
|
|
3099
3218
|
)
|
|
3100
3219
|
|
|
3220
|
+
async def _require_update_outcome_reads(self, operation: str) -> None:
|
|
3221
|
+
info = await self._runtime_discovery(
|
|
3222
|
+
operation=operation,
|
|
3223
|
+
required_path=_UPDATE_OUTCOME_READS_DISCOVERY_PATH,
|
|
3224
|
+
)
|
|
3225
|
+
capabilities = info.get("capabilities")
|
|
3226
|
+
supported = capabilities.get("update_outcome_reads") if isinstance(capabilities, dict) else None
|
|
3227
|
+
if supported is not True:
|
|
3228
|
+
raise RuntimeCapabilityUnsupported(
|
|
3229
|
+
operation,
|
|
3230
|
+
_UPDATE_OUTCOME_READS_DISCOVERY_PATH,
|
|
3231
|
+
(
|
|
3232
|
+
f"{operation} is unsupported by this runtime because GET /api/cluster/info "
|
|
3233
|
+
f"does not advertise {_UPDATE_OUTCOME_READS_DISCOVERY_PATH}=true (native "
|
|
3234
|
+
"Server 3.6.0 or later), so an update outcome cannot be read by id. The SDK "
|
|
3235
|
+
"never resubmits an update in place of reading it. Upgrade Server, or retry "
|
|
3236
|
+
"update_workflow() with the update's original request_id, which returns the "
|
|
3237
|
+
"retained receipt instead of admitting another update."
|
|
3238
|
+
),
|
|
3239
|
+
)
|
|
3240
|
+
|
|
3101
3241
|
def get_workflow_handle(
|
|
3102
3242
|
self, workflow_id: str, *, run_id: str | None = None, workflow_type: str = ""
|
|
3103
3243
|
) -> WorkflowHandle:
|
|
@@ -4964,18 +5104,28 @@ class Client:
|
|
|
4964
5104
|
wait_timeout_seconds: int | None = None,
|
|
4965
5105
|
request_id: str | None = None,
|
|
4966
5106
|
) -> Any:
|
|
4967
|
-
"""Send
|
|
5107
|
+
"""Send an update to a running workflow and return the Server's receipt.
|
|
4968
5108
|
|
|
4969
5109
|
Updates are request/response calls to a named handler on the workflow;
|
|
4970
5110
|
the handler may mutate durable workflow state and return a value.
|
|
4971
|
-
``wait_for`` selects how long the server waits before
|
|
4972
|
-
|
|
4973
|
-
|
|
5111
|
+
``wait_for`` selects how long the server waits before answering:
|
|
5112
|
+
``"accepted"`` (the default when omitted) answers once the update is
|
|
5113
|
+
durably accepted and routed, and ``"completed"`` waits up to
|
|
5114
|
+
``wait_timeout_seconds`` for the handler's outcome.
|
|
4974
5115
|
When the workflow contract declares a validator, a capable Server does
|
|
4975
5116
|
not return that accepted state until synchronous validation succeeds.
|
|
4976
5117
|
Validator rejection and validation-routing failures remain typed and
|
|
4977
5118
|
do not silently fall back to post-accept handler failure.
|
|
4978
5119
|
|
|
5120
|
+
The return value is the receipt ``dict``, not the decoded handler
|
|
5121
|
+
result. Its ``update_status`` says where the update is: ``"completed"``
|
|
5122
|
+
carries the decoded value in ``result`` (which may be ``None``) and the
|
|
5123
|
+
encoded ``result_envelope``; ``"accepted"`` means the update is still
|
|
5124
|
+
pending and has no result yet, even though ``result`` is ``None``, and
|
|
5125
|
+
``wait_timed_out`` is ``True`` when a completion wait ran out. Keep the
|
|
5126
|
+
receipt's ``update_id`` to read the outcome later with
|
|
5127
|
+
:meth:`update_outcome`, which never admits another update.
|
|
5128
|
+
|
|
4979
5129
|
``request_id`` is the caller command key (1-255 opaque, case-sensitive
|
|
4980
5130
|
bytes) that makes a retry of this update safe. When omitted the client
|
|
4981
5131
|
generates ``sdk-python-update-<uuid>`` once per call, so the transport
|
|
@@ -5025,6 +5175,138 @@ class Client:
|
|
|
5025
5175
|
data.setdefault("request_id", key)
|
|
5026
5176
|
return data
|
|
5027
5177
|
|
|
5178
|
+
async def update_outcome(
|
|
5179
|
+
self,
|
|
5180
|
+
workflow_id: str,
|
|
5181
|
+
update_id: str,
|
|
5182
|
+
*,
|
|
5183
|
+
wait_for: str = "completed",
|
|
5184
|
+
wait_timeout_seconds: int | None = None,
|
|
5185
|
+
result_type: Any = None,
|
|
5186
|
+
) -> Any:
|
|
5187
|
+
"""Read an accepted update's outcome later by its update id, without submitting it again.
|
|
5188
|
+
|
|
5189
|
+
By default this waits for the outcome (``wait_for="completed"``) up to
|
|
5190
|
+
``wait_timeout_seconds``, or the Server's update wait default. It
|
|
5191
|
+
returns the decoded result of a completed update, including ``None``.
|
|
5192
|
+
``result_type`` opts in to decoding the result to that annotation, as
|
|
5193
|
+
:meth:`get_result` does.
|
|
5194
|
+
|
|
5195
|
+
A still-pending update raises
|
|
5196
|
+
:class:`~durable_workflow.errors.UpdateStillPending` and is never
|
|
5197
|
+
returned as ``None``; call this again with the same ``update_id`` to
|
|
5198
|
+
keep waiting. A failed update raises
|
|
5199
|
+
:class:`~durable_workflow.errors.UpdateFailed`, a rejected one
|
|
5200
|
+
:class:`~durable_workflow.errors.UpdateRejected`, and an id with no
|
|
5201
|
+
retained update (including one pruned with its run)
|
|
5202
|
+
:class:`~durable_workflow.errors.UpdateNotFound`. A value is returned
|
|
5203
|
+
only from a completed receipt for the requested update; an answer that
|
|
5204
|
+
names another update or workflow, or has any other status, raises
|
|
5205
|
+
:class:`~durable_workflow.errors.UnrecognizedUpdateOutcome`.
|
|
5206
|
+
|
|
5207
|
+
An empty, ``.`` or ``..`` workflow or update id, an unknown
|
|
5208
|
+
``wait_for`` or a non-positive ``wait_timeout_seconds`` raises
|
|
5209
|
+
:class:`ValueError` before any request. With ``wait_timeout_seconds``
|
|
5210
|
+
the HTTP timeout becomes that wait plus 30 seconds when that exceeds
|
|
5211
|
+
the client's ``timeout``, so a long wait is not cut off.
|
|
5212
|
+
|
|
5213
|
+
The read follows the update across continue-as-new; the receipt's
|
|
5214
|
+
``run_id`` names the run that owns it now. It needs a Server that
|
|
5215
|
+
advertises ``capabilities.update_outcome_reads`` (native 3.6.0 and
|
|
5216
|
+
later) and otherwise raises
|
|
5217
|
+
:class:`~durable_workflow.errors.RuntimeCapabilityUnsupported` without
|
|
5218
|
+
reading or resubmitting anything.
|
|
5219
|
+
"""
|
|
5220
|
+
if result_type is not None:
|
|
5221
|
+
validate_annotation(result_type, "result_type")
|
|
5222
|
+
receipt = await self._read_update_outcome(
|
|
5223
|
+
"Client.update_outcome", workflow_id, update_id, wait_for, wait_timeout_seconds,
|
|
5224
|
+
)
|
|
5225
|
+
return _update_outcome_value(receipt, workflow_id=workflow_id, update_id=update_id, result_type=result_type)
|
|
5226
|
+
|
|
5227
|
+
async def update_outcome_receipt(
|
|
5228
|
+
self,
|
|
5229
|
+
workflow_id: str,
|
|
5230
|
+
update_id: str,
|
|
5231
|
+
*,
|
|
5232
|
+
wait_for: str = "accepted",
|
|
5233
|
+
wait_timeout_seconds: int | None = None,
|
|
5234
|
+
) -> dict[str, Any]:
|
|
5235
|
+
"""Read an accepted update's Server receipt by its update id. It writes nothing.
|
|
5236
|
+
|
|
5237
|
+
By default this answers at once (``wait_for="accepted"``); pass
|
|
5238
|
+
``wait_for="completed"`` to wait for the outcome. The receipt is the
|
|
5239
|
+
same one :meth:`update_workflow` returns: ``update_status`` is
|
|
5240
|
+
``"accepted"`` while the update is pending (``wait_timed_out`` says
|
|
5241
|
+
whether a completion wait ran out) and ``"completed"`` once it has a
|
|
5242
|
+
``result``, which may be ``None``.
|
|
5243
|
+
|
|
5244
|
+
Failed, rejected and unknown updates, invalid ids and receipts that do
|
|
5245
|
+
not match the request raise as in :meth:`update_outcome`, and long
|
|
5246
|
+
waits extend the HTTP timeout the same way. Without the Server's
|
|
5247
|
+
``capabilities.update_outcome_reads`` this raises
|
|
5248
|
+
:class:`~durable_workflow.errors.RuntimeCapabilityUnsupported`;
|
|
5249
|
+
resubmitting the update is never a substitute for reading it.
|
|
5250
|
+
"""
|
|
5251
|
+
return await self._read_update_outcome(
|
|
5252
|
+
"Client.update_outcome_receipt", workflow_id, update_id, wait_for, wait_timeout_seconds,
|
|
5253
|
+
)
|
|
5254
|
+
|
|
5255
|
+
async def _read_update_outcome(
|
|
5256
|
+
self,
|
|
5257
|
+
operation: str,
|
|
5258
|
+
workflow_id: str,
|
|
5259
|
+
update_id: str,
|
|
5260
|
+
wait_for: str,
|
|
5261
|
+
wait_timeout_seconds: int | None,
|
|
5262
|
+
) -> dict[str, Any]:
|
|
5263
|
+
if wait_for not in _UPDATE_OUTCOME_WAIT_STAGES:
|
|
5264
|
+
raise ValueError(f"{operation} wait_for must be 'accepted' or 'completed', not {wait_for!r}")
|
|
5265
|
+
# "." and ".." would resolve onto another route (".." reaches the workflow itself).
|
|
5266
|
+
for name, value in (("workflow id", workflow_id), ("update id", update_id)):
|
|
5267
|
+
if not isinstance(value, str) or not value.strip() or value in (".", ".."):
|
|
5268
|
+
raise ValueError(f"{operation} needs a non-empty {name} other than '.' or '..', not {value!r}")
|
|
5269
|
+
if wait_timeout_seconds is not None and (
|
|
5270
|
+
isinstance(wait_timeout_seconds, bool)
|
|
5271
|
+
or not isinstance(wait_timeout_seconds, int)
|
|
5272
|
+
or wait_timeout_seconds < 1
|
|
5273
|
+
):
|
|
5274
|
+
raise ValueError(
|
|
5275
|
+
f"{operation} wait_timeout_seconds must be a positive integer, not {wait_timeout_seconds!r}"
|
|
5276
|
+
)
|
|
5277
|
+
await self._require_update_outcome_reads(operation)
|
|
5278
|
+
path = f"/workflows/{quote(workflow_id, safe='')}/updates/{quote(update_id, safe='')}"
|
|
5279
|
+
query: dict[str, Any] = {}
|
|
5280
|
+
if wait_for == "completed":
|
|
5281
|
+
query["wait_for"] = wait_for
|
|
5282
|
+
if wait_timeout_seconds is not None:
|
|
5283
|
+
query["wait_timeout_seconds"] = wait_timeout_seconds
|
|
5284
|
+
if query:
|
|
5285
|
+
path += "?" + urlencode(query)
|
|
5286
|
+
timeout = None
|
|
5287
|
+
if wait_timeout_seconds is not None:
|
|
5288
|
+
timeout = max(self.timeout, wait_timeout_seconds + _UPDATE_OUTCOME_WAIT_HEADROOM_SECONDS)
|
|
5289
|
+
data = await self._request(
|
|
5290
|
+
"GET", path, context=workflow_id, timeout=timeout, raise_for_status=_raise_for_update_outcome_read,
|
|
5291
|
+
)
|
|
5292
|
+
problem = None
|
|
5293
|
+
if not isinstance(data, dict):
|
|
5294
|
+
problem = f"is not a JSON object but {type(data).__name__}"
|
|
5295
|
+
elif data.get("update_id") != update_id:
|
|
5296
|
+
problem = f"names update {data.get('update_id')!r}"
|
|
5297
|
+
elif not isinstance(data.get("update_status"), str):
|
|
5298
|
+
problem = "carries no string update_status"
|
|
5299
|
+
elif data.get("workflow_id") is not None and data.get("workflow_id") != workflow_id:
|
|
5300
|
+
problem = f"names workflow {data.get('workflow_id')!r}"
|
|
5301
|
+
if problem is not None:
|
|
5302
|
+
raise UnrecognizedUpdateOutcome(
|
|
5303
|
+
f"{operation} asked for update {update_id} on workflow {workflow_id}, but the answer {problem}",
|
|
5304
|
+
workflow_id=workflow_id,
|
|
5305
|
+
update_id=update_id,
|
|
5306
|
+
body=data,
|
|
5307
|
+
)
|
|
5308
|
+
return cast(dict[str, Any], data)
|
|
5309
|
+
|
|
5028
5310
|
async def get_result(
|
|
5029
5311
|
self,
|
|
5030
5312
|
handle: WorkflowHandle,
|
|
@@ -301,6 +301,60 @@ class ServerError(DurableWorkflowError):
|
|
|
301
301
|
)
|
|
302
302
|
|
|
303
303
|
|
|
304
|
+
WORKFLOW_TASK_COMPLETION_BYTES = "workflow_task_completion_bytes"
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
class WorkflowTaskCompletionTooLarge(ServerError):
|
|
308
|
+
"""The Server refused a workflow-task completion as too large (typed 413).
|
|
309
|
+
|
|
310
|
+
Server 3.6.0 and later accept a workflow-task completion of up to 16
|
|
311
|
+
payload limits (32 MiB by default) and refuse a larger one with ``413
|
|
312
|
+
payload_too_large`` and ``limit_kind: workflow_task_completion_bytes``.
|
|
313
|
+
Replaying the task produces the same commands, so resending it cannot
|
|
314
|
+
succeed: this error is not retryable. The worker fails the run with a
|
|
315
|
+
``structural_limit`` failure instead of resending the completion.
|
|
316
|
+
|
|
317
|
+
:attr:`limit` is the Server's aggregate limit in bytes, when it reported
|
|
318
|
+
one. :attr:`size` is the encoded request body the SDK sent, in bytes.
|
|
319
|
+
"""
|
|
320
|
+
|
|
321
|
+
non_retryable = True
|
|
322
|
+
limit_kind = WORKFLOW_TASK_COMPLETION_BYTES
|
|
323
|
+
|
|
324
|
+
def __init__(self, status: int, body: object, *, size: int | None = None) -> None:
|
|
325
|
+
super().__init__(status, body)
|
|
326
|
+
limit = body.get("limit") if isinstance(body, dict) else None
|
|
327
|
+
message = body.get("message") if isinstance(body, dict) else None
|
|
328
|
+
self.limit: int | None = limit if type(limit) is int else None
|
|
329
|
+
self.size = size
|
|
330
|
+
self.server_message: str | None = message if isinstance(message, str) and message else None
|
|
331
|
+
self.args = (self.structural_limit_message(),)
|
|
332
|
+
|
|
333
|
+
@staticmethod
|
|
334
|
+
def matches(status: int, body: object) -> bool:
|
|
335
|
+
"""Whether a response is the typed completion-size refusal."""
|
|
336
|
+
return (
|
|
337
|
+
status == 413
|
|
338
|
+
and isinstance(body, dict)
|
|
339
|
+
and body.get("reason") == "payload_too_large"
|
|
340
|
+
and body.get("limit_kind") == WORKFLOW_TASK_COMPLETION_BYTES
|
|
341
|
+
)
|
|
342
|
+
|
|
343
|
+
def structural_limit_message(self) -> str:
|
|
344
|
+
"""The failure message the worker records on the run.
|
|
345
|
+
|
|
346
|
+
It starts with ``Structural limit exceeded:``, which the Server
|
|
347
|
+
classifies as the ``structural_limit`` failure category.
|
|
348
|
+
"""
|
|
349
|
+
size = f"{self.size} bytes" if self.size is not None else "larger than the limit"
|
|
350
|
+
limit = f"the server limit of {self.limit} bytes" if self.limit is not None else "the server limit"
|
|
351
|
+
return (
|
|
352
|
+
f"Structural limit exceeded: {WORKFLOW_TASK_COMPLETION_BYTES}: the workflow task completion is "
|
|
353
|
+
f"{size}, over {limit}. Split the fan-out into smaller batches, move work into child workflows, "
|
|
354
|
+
"or continue-as-new; offload large payloads with external payload storage."
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
|
|
304
358
|
class NexusOperationFailed(DurableWorkflowError):
|
|
305
359
|
"""A Nexus service operation completed with a typed service failure."""
|
|
306
360
|
|
|
@@ -636,6 +690,73 @@ class UpdateFailed(InvalidArgument):
|
|
|
636
690
|
return value if isinstance(value, str) and value.strip() else None
|
|
637
691
|
|
|
638
692
|
|
|
693
|
+
class UpdateNotFound(UpdateFailed):
|
|
694
|
+
"""No retained update has this id for this workflow (HTTP 404 ``update_not_found``).
|
|
695
|
+
|
|
696
|
+
Raised by :meth:`~durable_workflow.Client.update_outcome` and
|
|
697
|
+
:meth:`~durable_workflow.Client.update_outcome_receipt`. This includes an
|
|
698
|
+
update pruned with its run, so it does not prove the update was never
|
|
699
|
+
admitted. It subclasses :class:`UpdateFailed`, so callers that treat every
|
|
700
|
+
unreadable outcome alike can catch that.
|
|
701
|
+
"""
|
|
702
|
+
|
|
703
|
+
|
|
704
|
+
class UpdateStillPending(DurableWorkflowError):
|
|
705
|
+
"""An accepted update that has not completed, so it has no result yet.
|
|
706
|
+
|
|
707
|
+
Raised by :meth:`~durable_workflow.Client.update_outcome` when the Server
|
|
708
|
+
answers with an accepted, still-open update: either a plain read, or a
|
|
709
|
+
completion wait that ran out (:attr:`wait_timed_out`). This is never a
|
|
710
|
+
``None`` result. Call ``update_outcome()`` again with :attr:`update_id` to
|
|
711
|
+
keep waiting; reading never admits another update.
|
|
712
|
+
"""
|
|
713
|
+
|
|
714
|
+
def __init__(
|
|
715
|
+
self,
|
|
716
|
+
*,
|
|
717
|
+
workflow_id: str,
|
|
718
|
+
update_id: str,
|
|
719
|
+
run_id: str | None = None,
|
|
720
|
+
update_name: str | None = None,
|
|
721
|
+
request_id: str | None = None,
|
|
722
|
+
update_status: str | None = None,
|
|
723
|
+
wait_timed_out: bool = False,
|
|
724
|
+
body: dict[str, Any] | None = None,
|
|
725
|
+
) -> None:
|
|
726
|
+
label = f"{update_name} ({update_id})" if update_name else update_id
|
|
727
|
+
super().__init__(
|
|
728
|
+
f"Update {label} on workflow {workflow_id} is still {update_status or 'pending'}; it has no "
|
|
729
|
+
f"result yet. Call update_outcome() again with update id {update_id!r} to keep waiting. "
|
|
730
|
+
"Reading never admits another update."
|
|
731
|
+
)
|
|
732
|
+
self.workflow_id = workflow_id
|
|
733
|
+
self.update_id = update_id
|
|
734
|
+
self.run_id = run_id
|
|
735
|
+
self.update_name = update_name
|
|
736
|
+
self.request_id = request_id
|
|
737
|
+
self.update_status = update_status
|
|
738
|
+
self.wait_timed_out = wait_timed_out
|
|
739
|
+
self.body = body
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
class UnrecognizedUpdateOutcome(DurableWorkflowError):
|
|
743
|
+
"""An update outcome read answered with a receipt the SDK cannot trust.
|
|
744
|
+
|
|
745
|
+
Raised by :meth:`~durable_workflow.Client.update_outcome` and
|
|
746
|
+
:meth:`~durable_workflow.Client.update_outcome_receipt` when a successful
|
|
747
|
+
answer does not name the requested update, carries no string
|
|
748
|
+
``update_status``, echoes another workflow, or (for ``update_outcome``)
|
|
749
|
+
is neither completed, pending, failed nor rejected. No value is returned
|
|
750
|
+
from such an answer. :attr:`body` preserves it for diagnosis.
|
|
751
|
+
"""
|
|
752
|
+
|
|
753
|
+
def __init__(self, message: str, *, workflow_id: str, update_id: str, body: object | None = None) -> None:
|
|
754
|
+
super().__init__(message)
|
|
755
|
+
self.workflow_id = workflow_id
|
|
756
|
+
self.update_id = update_id
|
|
757
|
+
self.body = body
|
|
758
|
+
|
|
759
|
+
|
|
639
760
|
class UpdateRejected(DurableWorkflowError):
|
|
640
761
|
"""A workflow update was rejected by the workflow's validator."""
|
|
641
762
|
|
|
@@ -912,10 +1033,15 @@ class AvroNotInstalledError(DurableWorkflowError, ImportError):
|
|
|
912
1033
|
"""Raised when the core ``avro`` runtime dependency is unavailable."""
|
|
913
1034
|
|
|
914
1035
|
|
|
915
|
-
def _raise_for_status(
|
|
1036
|
+
def _raise_for_status(
|
|
1037
|
+
status: int, body: object, *, context: str = "", request_bytes: int | None = None,
|
|
1038
|
+
) -> None:
|
|
916
1039
|
if status < 400:
|
|
917
1040
|
return
|
|
918
1041
|
|
|
1042
|
+
if WorkflowTaskCompletionTooLarge.matches(status, body):
|
|
1043
|
+
raise WorkflowTaskCompletionTooLarge(status, body, size=request_bytes)
|
|
1044
|
+
|
|
919
1045
|
reason = body.get("reason") if isinstance(body, dict) else None
|
|
920
1046
|
message = body.get("message", "") if isinstance(body, dict) else str(body)
|
|
921
1047
|
operation = _control_plane_operation(body)
|
|
@@ -1089,6 +1215,35 @@ def _raise_for_status(status: int, body: object, *, context: str = "") -> None:
|
|
|
1089
1215
|
raise ServerError(status, body)
|
|
1090
1216
|
|
|
1091
1217
|
|
|
1218
|
+
def _raise_for_update_outcome_read(status: int, body: object, *, context: str = "") -> None:
|
|
1219
|
+
"""Map a refused update outcome read (Server #1131) to the update's typed failure.
|
|
1220
|
+
|
|
1221
|
+
``404 update_not_found`` raises :class:`UpdateNotFound`, and a rejected
|
|
1222
|
+
update, which answers with its original rejection status, raises
|
|
1223
|
+
:class:`UpdateRejected` as submitting it did. Everything else, including
|
|
1224
|
+
``422`` failed updates, takes the usual mapping.
|
|
1225
|
+
"""
|
|
1226
|
+
if status >= 400 and isinstance(body, dict):
|
|
1227
|
+
reason = body.get("reason")
|
|
1228
|
+
message = body.get("message")
|
|
1229
|
+
if status == 404 and reason == "update_not_found":
|
|
1230
|
+
raise UpdateNotFound(
|
|
1231
|
+
message if isinstance(message, str) and message else "update not found",
|
|
1232
|
+
status=status,
|
|
1233
|
+
body=body,
|
|
1234
|
+
)
|
|
1235
|
+
if body.get("update_status") == "rejected":
|
|
1236
|
+
if not isinstance(message, str) or not message:
|
|
1237
|
+
message = f"update rejected: {reason}" if isinstance(reason, str) and reason else "update rejected"
|
|
1238
|
+
errors = body.get("validation_errors")
|
|
1239
|
+
raise UpdateRejected(
|
|
1240
|
+
message,
|
|
1241
|
+
validation_errors=errors if isinstance(errors, dict) and errors else None,
|
|
1242
|
+
body=body,
|
|
1243
|
+
)
|
|
1244
|
+
_raise_for_status(status, body, context=context)
|
|
1245
|
+
|
|
1246
|
+
|
|
1092
1247
|
def _control_plane_operation(body: object) -> str | None:
|
|
1093
1248
|
if not isinstance(body, dict):
|
|
1094
1249
|
return None
|