durable-workflow 2.22.1__tar.gz → 2.24.0__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.22.1/src/durable_workflow.egg-info → durable_workflow-2.24.0}/PKG-INFO +1 -1
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/pyproject.toml +3 -3
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/__init__.py +6 -0
- durable_workflow-2.24.0/src/durable_workflow/_condition_input_order.py +140 -0
- durable_workflow-2.24.0/src/durable_workflow/_continue_as_new.py +35 -0
- durable_workflow-2.24.0/src/durable_workflow/_timeout_cleanup.py +63 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/activity.py +25 -7
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/client.py +51 -12
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/errors.py +55 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/replay_clock.py +81 -4
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/retry_policy.py +42 -1
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/testing.py +8 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/worker.py +210 -40
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/workflow.py +394 -17
- {durable_workflow-2.22.1 → durable_workflow-2.24.0/src/durable_workflow.egg-info}/PKG-INFO +1 -1
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow.egg-info/SOURCES.txt +11 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_checkpoint.py +3 -1
- durable_workflow-2.24.0/tests/test_activity_heartbeat_unavailable.py +297 -0
- durable_workflow-2.24.0/tests/test_business_replay_clock_entry.py +296 -0
- durable_workflow-2.24.0/tests/test_business_replay_clock_query_attestation.py +153 -0
- durable_workflow-2.24.0/tests/test_coalescing_signal_timer_replay.py +193 -0
- durable_workflow-2.24.0/tests/test_continue_as_new_target.py +174 -0
- durable_workflow-2.24.0/tests/test_ordered_condition_input.py +67 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_replay_regression_corpus.py +93 -1
- durable_workflow-2.24.0/tests/test_timeout_cleanup.py +430 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker.py +4 -0
- durable_workflow-2.24.0/tests/test_worker_transient_5xx_retry.py +370 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_transient_runtime.py +10 -1
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/LICENSE +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/README.md +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/setup.cfg +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_activity_checkpoint.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_activity_lease.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_activity_process.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_avro.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_cancellation_scope.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_cancellation_scope_history.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_capabilities_digest.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_condition_fingerprint.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_cooperative_cancellation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_failure_reporting.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_metric_routes.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_poll_transport.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_prepared_local_activity.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_query_task_authority.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_response_limit.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/_typed_values.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/auth_composition.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/cancellation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/external_storage.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/external_task_input.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/external_task_result.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/history_bundle_verify.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/interceptors.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/invocable.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/metrics.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/nexus.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/py.typed +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/python_conformance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/replay_clock_math.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/replay_conformance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/replay_verify.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/serializer.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/server_compatibility.json +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/sync.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/telemetry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/telemetry_carrier.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/worker_session.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/worker_status.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow/workflow_updates_conformance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow.egg-info/entry_points.txt +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow.egg-info/requires.txt +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/src/durable_workflow.egg-info/top_level.txt +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_acceptance_authority.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_acceptance_consumer.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_acceptance_entry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_cancellation_policies.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_context.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_exponential_retry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_heartbeat_authority.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_identity.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_install_inventory.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_lease_authority.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_lease_renewal.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_lease_worker.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_process.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_retry_cap_cell.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_retry_info.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_run_closed_refusal.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_activity_worker_lost.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_auth_composition.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_avro_value_benchmark.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_avro_value_protocol.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_business_replay_clock.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_business_replay_clock_child.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_business_replay_clock_parallel.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_business_replay_clock_redrive.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_business_replay_clock_sequence_claims.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_cause.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_context.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_remaining_time.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_scope_admission.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_scope_authoring.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_scope_boundary.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cancellation_scope_opening.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_capabilities_digest.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_capabilities_digest_unknown.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_checkpointed_batch_example.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_child_workflow_policies.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_ci_checkout.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_ci_integration_endpoint.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_client.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_client_iterators.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_client_telemetry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_client_timeouts.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_codec_regression_corpus.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_command_keys_acceptance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_command_keys_captured_inputs.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_command_keys_container_ownership.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_command_keys_workspace.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_committed_cancellation_scope_descendants.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_committed_cancellation_scope_groups.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_committed_cancellation_scope_history.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_committed_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_completion_size_limit.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_condition_fingerprint.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_condition_occurrence_id.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_condition_replay_drift.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_control_plane_parity_fixtures.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cooperative_cancellation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cooperative_cancellation_client.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cooperative_cancellation_worker.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_cooperative_remote_worker.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_docs_release_channel.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_docstring_cross_references.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_durable_selection.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_empty_callback_failure.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_errors.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_external_storage.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_external_task_input.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_external_task_result.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_failure_reporting.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_generator_lifecycle.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_golden_history_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_history_bundle_pruned.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_history_bundle_schema2.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_history_bundle_verify.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_history_event_contract.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_invocable.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_local_activity_backoff.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_local_failure_reporting.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_message_streams.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_metric_routes.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_metrics.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_native_timer_redrive_cell.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_native_timer_redrive_clock.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_nexus_durable_wait.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_nexus_namespace.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_nexus_wire.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_order_processing_example.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_completion_order_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_failure_order.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_group_boundaries.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_group_policy.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_member_failure_open_siblings.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_parallel_saga_authoring.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_patch_history.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_payload_policy_refresh.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_pending_operation_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_physical_command_key_readback.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_poll_failure_backoff.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_poll_transport.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_portal_source_split.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_prepared_local_activity_client.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_prepared_local_activity_groups.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_prepared_local_activity_policies.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_prepared_local_activity_worker.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_public_boundary_scanner.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_publish_workflow_isolation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_published_activity_acceptance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_published_pagination_evidence.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_pypi_project_surface.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_python_conformance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_queries.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_query_task_authority.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_query_timeout_retry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_quiesced_snapshot.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_readme_quickstart.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_redrive_call_ledger.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_redrive_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_redrive_successor_evidence.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_registration_ambiguity.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_release_metadata.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_release_promotion.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_replay_clock.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_replay_conformance.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_replay_verify.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_response_body_limit.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_result_continue_as_new.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_retry_cap_download.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_retry_cap_workflow.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_retry_policy.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_run_activities.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_run_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_run_closed_settlement_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_runtime_external_payload_transport.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_schedule_origin.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_schedules.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_scoped_run_cancellation_context.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sdk_metrics_contract.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_search_attribute_replay_identity.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_serializer.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_signal_external_workflow.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_signal_with_start.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_signals.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sleep.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_standalone_activity_client.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_static_credential_validation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sticky_execution.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sticky_history_suffix.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_storage_admission.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sync.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_sync_activities.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_synthetic_command_key_readback.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_telemetry.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_telemetry_carrier.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_testing_failures.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_testing_harness.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_testing_nexus.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_threaded_heartbeat_example.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_tls_trust.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_transport_diagnostics.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_typed_values.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_typed_workflow_values.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_update_outcome.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_update_signal_condition_replay.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_updates.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_wait_condition.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_deregistration.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_observation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_session.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_startup_buffered.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_startup_raw.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_startup_read_budget.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_startup_snapshot.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_status.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_worker_telemetry_wire.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_entry_arguments.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_entrypoint_validation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_handler_validation.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_identity.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_result_timeout.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/tests/test_workflow_streams.py +0 -0
- {durable_workflow-2.22.1 → durable_workflow-2.24.0}/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.24.0"
|
|
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.24.0"
|
|
83
|
+
registry-version = "2.24.0"
|
|
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"
|
|
@@ -8,6 +8,7 @@ except PackageNotFoundError: # source checkout without installed metadata
|
|
|
8
8
|
|
|
9
9
|
from . import activity, sync, testing, workflow
|
|
10
10
|
from ._activity_checkpoint import ActivityHeartbeatCheckpoint
|
|
11
|
+
from ._continue_as_new import ContinueAsNewTargetBuild
|
|
11
12
|
from .activity import ActivityContext, ActivityInfo, ActivityRetryInfo
|
|
12
13
|
from .auth_composition import (
|
|
13
14
|
AUTH_COMPOSITION_CONTRACT_SCHEMA,
|
|
@@ -73,9 +74,11 @@ from .errors import (
|
|
|
73
74
|
ActivityCancelled,
|
|
74
75
|
ActivityFailed,
|
|
75
76
|
ActivityHeartbeatResumeUnavailable,
|
|
77
|
+
ActivityHeartbeatUnavailable,
|
|
76
78
|
ChildWorkflowCancelled,
|
|
77
79
|
ChildWorkflowFailed,
|
|
78
80
|
ChildWorkflowTerminated,
|
|
81
|
+
ContinueAsNewTargetUnsupported,
|
|
79
82
|
DuplicateRegistrationError,
|
|
80
83
|
DurableOperationCancelled,
|
|
81
84
|
DurableWorkflowError,
|
|
@@ -272,6 +275,7 @@ __all__ = [
|
|
|
272
275
|
"ActivityRetryInfo",
|
|
273
276
|
"ActivityHeartbeatCheckpoint",
|
|
274
277
|
"ActivityHeartbeatResumeUnavailable",
|
|
278
|
+
"ActivityHeartbeatUnavailable",
|
|
275
279
|
"ActivityInterceptorContext",
|
|
276
280
|
"ActivityRetryPolicy",
|
|
277
281
|
"BridgeAdapterOutcome",
|
|
@@ -287,6 +291,8 @@ __all__ = [
|
|
|
287
291
|
"ChildWorkflowTerminated",
|
|
288
292
|
"Client",
|
|
289
293
|
"ContinueAsNew",
|
|
294
|
+
"ContinueAsNewTargetBuild",
|
|
295
|
+
"ContinueAsNewTargetUnsupported",
|
|
290
296
|
"DurableOperationCancelled",
|
|
291
297
|
"DurableOperationHandle",
|
|
292
298
|
"MessageStream",
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"""Canonical input positions for condition predicate replay."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Mapping, Sequence
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
CAPABILITY = "condition_wait_input_order"
|
|
10
|
+
AUTHORING = "condition_wait_input_order_authoring"
|
|
11
|
+
ORDER = "durable_receipt_order"
|
|
12
|
+
PENDING_INPUT = "condition_wait_pending_input_sequence"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def marked(payload: Mapping[str, Any]) -> bool:
|
|
16
|
+
return payload.get(CAPABILITY) == ORDER
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def positive_sequence(value: Any) -> int | None:
|
|
20
|
+
return value if type(value) is int and value > 0 else None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class CompetingSelection:
|
|
25
|
+
terminal_id: str
|
|
26
|
+
sequence: int
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def competing_selection(events: Sequence[Mapping[str, Any]], group_id: str) -> CompetingSelection | None:
|
|
30
|
+
candidates = [
|
|
31
|
+
(event, payload) for event in events
|
|
32
|
+
if event.get("event_type", event.get("type")) == "SelectionCandidateReady"
|
|
33
|
+
and isinstance(payload := event.get("payload"), Mapping)
|
|
34
|
+
and payload.get("selection_group_id") == group_id
|
|
35
|
+
]
|
|
36
|
+
if not candidates:
|
|
37
|
+
return None
|
|
38
|
+
if len(candidates) != 1:
|
|
39
|
+
raise ValueError("an ordered selection has more than one competing terminal event")
|
|
40
|
+
candidate, payload = candidates[0]
|
|
41
|
+
terminal_id = payload.get("resolution_event_id")
|
|
42
|
+
sequence = positive_sequence(payload.get("resolution_event_sequence"))
|
|
43
|
+
if (not isinstance(terminal_id, str) or not terminal_id or sequence is None
|
|
44
|
+
or sequence >= (positive_sequence(candidate.get("sequence")) or 0)
|
|
45
|
+
or not any(
|
|
46
|
+
event.get("sequence") == sequence
|
|
47
|
+
and (event.get("id") or event.get("event_id")) == terminal_id
|
|
48
|
+
and event.get("event_type", event.get("type")) == payload.get("resolution_event_type")
|
|
49
|
+
for event in events
|
|
50
|
+
)):
|
|
51
|
+
raise ValueError("ordered selection candidate does not match its terminal history event")
|
|
52
|
+
return CompetingSelection(terminal_id, sequence)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass
|
|
56
|
+
class Wait:
|
|
57
|
+
opening_sequence: int
|
|
58
|
+
scheduled_sequence: int | None = None
|
|
59
|
+
timer_id: str | None = None
|
|
60
|
+
fired_sequence: int | None = None
|
|
61
|
+
settled: bool | None = None
|
|
62
|
+
satisfying_receipt: int | None = None
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class History:
|
|
67
|
+
waits: dict[str, Wait]
|
|
68
|
+
applied_signal_receipts: frozenset[int]
|
|
69
|
+
update_receipts: dict[int, int]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def read(events: Sequence[Mapping[str, Any]]) -> History:
|
|
73
|
+
if not any(
|
|
74
|
+
event.get("event_type", event.get("type")) == "ConditionWaitOpened"
|
|
75
|
+
and isinstance(event.get("payload"), Mapping) and marked(event["payload"])
|
|
76
|
+
for event in events
|
|
77
|
+
):
|
|
78
|
+
return History({}, frozenset(), {})
|
|
79
|
+
waits: dict[str, Wait] = {}
|
|
80
|
+
receipts: dict[tuple[str, str], int] = {}
|
|
81
|
+
applied_signals: set[int] = set()
|
|
82
|
+
update_receipts: dict[int, int] = {}
|
|
83
|
+
for event in events:
|
|
84
|
+
kind = event.get("event_type", event.get("type"))
|
|
85
|
+
payload = event.get("payload")
|
|
86
|
+
if not isinstance(payload, Mapping):
|
|
87
|
+
continue
|
|
88
|
+
sequence = positive_sequence(event.get("sequence"))
|
|
89
|
+
command_id = event.get("workflow_command_id") or payload.get("workflow_command_id")
|
|
90
|
+
if sequence is not None and isinstance(command_id, str) and command_id:
|
|
91
|
+
if kind in ("SignalReceived", "UpdateAccepted"):
|
|
92
|
+
receipts.setdefault((kind, command_id), sequence)
|
|
93
|
+
elif kind == "SignalApplied":
|
|
94
|
+
receipt = receipts.get(("SignalReceived", command_id))
|
|
95
|
+
if receipt is not None:
|
|
96
|
+
applied_signals.add(receipt)
|
|
97
|
+
elif kind == "UpdateApplied":
|
|
98
|
+
receipt = receipts.get(("UpdateAccepted", command_id))
|
|
99
|
+
if receipt is not None:
|
|
100
|
+
update_receipts[sequence] = receipt
|
|
101
|
+
wait_id = payload.get("condition_wait_id")
|
|
102
|
+
if not isinstance(wait_id, str) or not wait_id:
|
|
103
|
+
continue
|
|
104
|
+
if kind == "ConditionWaitOpened" and marked(payload):
|
|
105
|
+
if sequence is None or wait_id in waits:
|
|
106
|
+
raise ValueError("ordered condition has an invalid opening sequence or repeated identity")
|
|
107
|
+
waits[wait_id] = Wait(sequence)
|
|
108
|
+
wait = waits.get(wait_id)
|
|
109
|
+
if wait is None:
|
|
110
|
+
continue
|
|
111
|
+
if kind == "TimerScheduled":
|
|
112
|
+
timer = payload.get("timer_id")
|
|
113
|
+
if (not marked(payload) or payload.get("timer_kind") != "condition_timeout"
|
|
114
|
+
or sequence is None or sequence <= wait.opening_sequence or not isinstance(timer, str)
|
|
115
|
+
or not timer or wait.scheduled_sequence is not None):
|
|
116
|
+
raise ValueError("ordered condition timer does not match its opening")
|
|
117
|
+
wait.scheduled_sequence = sequence
|
|
118
|
+
wait.timer_id = timer
|
|
119
|
+
elif kind == "TimerFired":
|
|
120
|
+
if (not marked(payload) or payload.get("timer_id") != wait.timer_id
|
|
121
|
+
or payload.get("timer_kind") != "condition_timeout" or wait.scheduled_sequence is None
|
|
122
|
+
or sequence is None or sequence <= wait.scheduled_sequence or wait.fired_sequence is not None):
|
|
123
|
+
raise ValueError("ordered condition fire does not match its original timer")
|
|
124
|
+
wait.fired_sequence = sequence
|
|
125
|
+
elif kind in ("ConditionWaitSatisfied", "ConditionWaitTimedOut"):
|
|
126
|
+
satisfied = kind == "ConditionWaitSatisfied"
|
|
127
|
+
receipt = positive_sequence(payload.get("input_receipt_sequence"))
|
|
128
|
+
if (not marked(payload) or wait.settled is not None or sequence is None
|
|
129
|
+
or sequence <= (wait.fired_sequence or wait.opening_sequence)
|
|
130
|
+
or payload.get("timer_fired_sequence") != wait.fired_sequence
|
|
131
|
+
or (receipt is not None and receipt >= sequence)
|
|
132
|
+
or (not satisfied and (wait.fired_sequence is None or receipt is not None))
|
|
133
|
+
or (satisfied and wait.fired_sequence is not None
|
|
134
|
+
and (receipt is None or receipt >= wait.fired_sequence))):
|
|
135
|
+
raise ValueError("ordered condition outcome does not match its original input boundary")
|
|
136
|
+
wait.settled = satisfied
|
|
137
|
+
wait.satisfying_receipt = receipt
|
|
138
|
+
if any(wait.scheduled_sequence is None for wait in waits.values()):
|
|
139
|
+
raise ValueError("ordered condition is missing its original timer schedule")
|
|
140
|
+
return History(waits, frozenset(applied_signals), update_receipts)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""Worker protocol contract for targeted continue-as-new."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import re
|
|
6
|
+
from collections.abc import Mapping
|
|
7
|
+
from typing import Literal, TypeAlias, TypeGuard
|
|
8
|
+
|
|
9
|
+
ContinueAsNewTargetBuild: TypeAlias = Literal["inherited", "promoted"]
|
|
10
|
+
|
|
11
|
+
CAPABILITY = "continue_as_new_target_build"
|
|
12
|
+
WORKER_PROTOCOL = "1.21"
|
|
13
|
+
PROMOTED_BUILD_UNAVAILABLE = "promoted_build_unavailable"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def valid_target(value: object) -> TypeGuard[ContinueAsNewTargetBuild]:
|
|
17
|
+
return isinstance(value, str) and value in ("inherited", "promoted")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def registration_supports_target(ack: object, worker_id: str, namespace: str | None, task_queue: str) -> bool:
|
|
21
|
+
if (
|
|
22
|
+
not isinstance(ack, Mapping)
|
|
23
|
+
or namespace is None
|
|
24
|
+
or ack.get("registered") is not True
|
|
25
|
+
or ack.get("worker_id") != worker_id
|
|
26
|
+
or ack.get("namespace") != namespace
|
|
27
|
+
or ack.get("task_queue") != task_queue
|
|
28
|
+
):
|
|
29
|
+
return False
|
|
30
|
+
capabilities = ack.get("server_capabilities")
|
|
31
|
+
if not isinstance(capabilities, Mapping) or capabilities.get(CAPABILITY) is not True:
|
|
32
|
+
return False
|
|
33
|
+
protocol = ack.get("protocol_version")
|
|
34
|
+
match = re.fullmatch(r"1\.([0-9]{1,4})", protocol) if isinstance(protocol, str) else None
|
|
35
|
+
return match is not None and int(match[1]) >= 21
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Worker side of deadline-triggered timeout cleanup (server#1201, workflow#863).
|
|
2
|
+
|
|
3
|
+
A worker that delivers cooperative cancellation advertises ``timeout_cleanup``
|
|
4
|
+
version 1, so the Server admits starts that reserve cleanup time on its queue.
|
|
5
|
+
When the engine's timeout request reaches workflow code as
|
|
6
|
+
:class:`~durable_workflow.errors.WorkflowTimeoutCleanupRequested` and the
|
|
7
|
+
workflow lets that exception escape, uncaught or re-raised, the
|
|
8
|
+
``fail_workflow`` command carries ``failure.interruption: "timeout_cleanup"``.
|
|
9
|
+
The Server then records the cleanup as completed, and the run still closes as
|
|
10
|
+
timed out. Any other failure, including one that wraps the interruption, is an
|
|
11
|
+
ordinary failure, which the Server records as failed cleanup. The marker never
|
|
12
|
+
starts cleanup; the Server accepts it only while the run's own engine timeout
|
|
13
|
+
request is active.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from collections.abc import Sequence
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from .cancellation import CancellationContext
|
|
22
|
+
from .errors import WorkflowTimeoutCleanupRequested
|
|
23
|
+
|
|
24
|
+
CAPABILITY = "timeout_cleanup"
|
|
25
|
+
INTERRUPTION = "timeout_cleanup"
|
|
26
|
+
MINIMUM_PROTOCOL_VERSION = "1.20"
|
|
27
|
+
VERSION = 1
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def manifest_entry() -> dict[str, Any]:
|
|
31
|
+
"""The registration ``capability_manifest`` entry native Server admits."""
|
|
32
|
+
return {"supported": True, "minimum_protocol_version": MINIMUM_PROTOCOL_VERSION, "version": VERSION}
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def failure_interruption(
|
|
36
|
+
failure: BaseException, *, delivered: Sequence[BaseException], run_id: str,
|
|
37
|
+
) -> str | None:
|
|
38
|
+
"""The portable marker for an escaped timeout interruption, else ``None``.
|
|
39
|
+
|
|
40
|
+
Only the exception object the runtime raised for this run's root request
|
|
41
|
+
with ``cause: "timeout"`` qualifies. An exception the application
|
|
42
|
+
constructs, a different exception raised from or wrapping the delivered
|
|
43
|
+
one, an ordinary or explicit ``cause: "cancellation"`` request and a
|
|
44
|
+
descendant or scoped request are not marked. The type alone never decides.
|
|
45
|
+
"""
|
|
46
|
+
if not isinstance(failure, WorkflowTimeoutCleanupRequested):
|
|
47
|
+
return None
|
|
48
|
+
if not any(failure is candidate for candidate in delivered):
|
|
49
|
+
return None
|
|
50
|
+
context = failure.context
|
|
51
|
+
if (
|
|
52
|
+
not isinstance(context, CancellationContext)
|
|
53
|
+
or not context.is_timeout
|
|
54
|
+
or context.scope_origin is not None
|
|
55
|
+
or failure.request_id is None
|
|
56
|
+
or failure.request_id != context.request_id
|
|
57
|
+
or context.request_id != context.root_request_id
|
|
58
|
+
or context.parent_request_id is not None
|
|
59
|
+
or not run_id
|
|
60
|
+
or context.root_workflow_run_id != run_id
|
|
61
|
+
):
|
|
62
|
+
return None
|
|
63
|
+
return INTERRUPTION
|
|
@@ -10,7 +10,7 @@ from typing import TYPE_CHECKING, Any
|
|
|
10
10
|
|
|
11
11
|
from ._activity_checkpoint import ActivityHeartbeatCheckpoint, _HeartbeatResume, claim_resume
|
|
12
12
|
from ._activity_lease import current_activity_authority
|
|
13
|
-
from .errors import ActivityCancelled, ActivityWorkerLost
|
|
13
|
+
from .errors import ActivityCancelled, ActivityHeartbeatUnavailable, ActivityWorkerLost
|
|
14
14
|
|
|
15
15
|
if TYPE_CHECKING:
|
|
16
16
|
from .client import Client
|
|
@@ -160,6 +160,8 @@ class ActivityContext:
|
|
|
160
160
|
|
|
161
161
|
The request runs on the worker's event loop using the original attempt
|
|
162
162
|
and client. Async handlers must use ``await heartbeat()`` instead.
|
|
163
|
+
It raises the same errors as :meth:`heartbeat`, including
|
|
164
|
+
:class:`~durable_workflow.errors.ActivityHeartbeatUnavailable`.
|
|
163
165
|
"""
|
|
164
166
|
loop = self._event_loop
|
|
165
167
|
if loop is None or not loop.is_running():
|
|
@@ -193,6 +195,12 @@ class ActivityContext:
|
|
|
193
195
|
Raises :class:`~durable_workflow.errors.ActivityWorkerLost`
|
|
194
196
|
with the original Server reason when the attempt cannot continue,
|
|
195
197
|
including an elapsed deadline, closed attempt or closed run.
|
|
198
|
+
|
|
199
|
+
Raises :class:`~durable_workflow.errors.ActivityHeartbeatUnavailable`
|
|
200
|
+
when a transient outage, such as a Server failover, outlasts the
|
|
201
|
+
client's transport retries. The heartbeat is not retried further, so
|
|
202
|
+
the activity can choose to keep working and heartbeat again later,
|
|
203
|
+
waiting at least its ``retry_after`` when set.
|
|
196
204
|
"""
|
|
197
205
|
self._raise_if_cannot_continue()
|
|
198
206
|
if self._heartbeat_callback is not None:
|
|
@@ -202,12 +210,22 @@ class ActivityContext:
|
|
|
202
210
|
self._cancel_requested = True
|
|
203
211
|
raise
|
|
204
212
|
return
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
213
|
+
try:
|
|
214
|
+
resp = await self._client.heartbeat_activity_task(
|
|
215
|
+
task_id=self._info.task_id,
|
|
216
|
+
activity_attempt_id=self._info.activity_attempt_id,
|
|
217
|
+
lease_owner=self._info.worker_id,
|
|
218
|
+
details=details,
|
|
219
|
+
)
|
|
220
|
+
except Exception as error:
|
|
221
|
+
# The worker's classification; imported here because worker imports this module.
|
|
222
|
+
from .worker import _transient_runtime_error
|
|
223
|
+
|
|
224
|
+
# Not retried here: the activity decides whether to keep working
|
|
225
|
+
# through an outage. Definitive refusals keep their own errors.
|
|
226
|
+
if _transient_runtime_error(error):
|
|
227
|
+
raise ActivityHeartbeatUnavailable(self._info.task_id, error) from error
|
|
228
|
+
raise
|
|
211
229
|
if isinstance(resp, dict) and resp.get("cancel_requested"):
|
|
212
230
|
self._cancel_requested = True
|
|
213
231
|
raise ActivityCancelled()
|
|
@@ -42,7 +42,7 @@ from urllib.parse import quote, unquote, urlencode, urlsplit
|
|
|
42
42
|
|
|
43
43
|
import httpx
|
|
44
44
|
|
|
45
|
-
from . import serializer
|
|
45
|
+
from . import _continue_as_new, serializer
|
|
46
46
|
from ._activity_checkpoint import capture_poll as _capture_activity_checkpoint
|
|
47
47
|
from ._activity_lease import ActivityLeaseAuthority, current_activity_authority
|
|
48
48
|
from ._cancellation_scope import CancellationScopeOpenReceipt, scope_identity
|
|
@@ -73,6 +73,8 @@ from ._typed_values import decode_payload_value, to_payload_values, validate_ann
|
|
|
73
73
|
from .errors import (
|
|
74
74
|
REQUEST_ID_AMBIGUOUS,
|
|
75
75
|
REQUEST_ID_CONFLICT,
|
|
76
|
+
ContinueAsNewTargetUnsupported,
|
|
77
|
+
DurableWorkflowError,
|
|
76
78
|
ExternalPayloadIntegrityMismatch,
|
|
77
79
|
ExternalPayloadOversized,
|
|
78
80
|
ExternalPayloadUnavailable,
|
|
@@ -103,7 +105,7 @@ from .external_storage import (
|
|
|
103
105
|
)
|
|
104
106
|
from .metrics import CLIENT_REQUEST_DURATION_SECONDS, CLIENT_REQUESTS, NOOP_METRICS, MetricsRecorder
|
|
105
107
|
from .nexus import NexusOperationResult, nexus_request_payload
|
|
106
|
-
from .retry_policy import TransportRetryPolicy
|
|
108
|
+
from .retry_policy import TransportRetryPolicy, response_retry_after
|
|
107
109
|
from .telemetry import ExecutionTelemetry, current_execution_telemetry
|
|
108
110
|
from .telemetry_carrier import supported as observability_supported
|
|
109
111
|
from .worker_session import WorkerSessionOptions
|
|
@@ -2005,6 +2007,7 @@ class Client:
|
|
|
2005
2007
|
self._cluster_info: dict[str, Any] | None = None
|
|
2006
2008
|
self._cluster_info_lock = asyncio.Lock()
|
|
2007
2009
|
self._capabilities_digest = ServerCapabilitiesDigest()
|
|
2010
|
+
self._continue_as_new_target_workers: set[tuple[str, str]] = set()
|
|
2008
2011
|
self._runtime_external_payload_transport_cache: (
|
|
2009
2012
|
_RuntimeExternalPayloadTransport | None
|
|
2010
2013
|
) = None
|
|
@@ -2023,6 +2026,7 @@ class Client:
|
|
|
2023
2026
|
Safe to call multiple times.
|
|
2024
2027
|
"""
|
|
2025
2028
|
self._workflow_payload_observers.clear()
|
|
2029
|
+
self._continue_as_new_target_workers.clear()
|
|
2026
2030
|
await self._http.aclose()
|
|
2027
2031
|
|
|
2028
2032
|
async def __aenter__(self) -> Client:
|
|
@@ -2208,6 +2212,7 @@ class Client:
|
|
|
2208
2212
|
context: str = "",
|
|
2209
2213
|
retry: bool = True,
|
|
2210
2214
|
raise_for_status: Callable[..., None] = _raise_for_status,
|
|
2215
|
+
worker_protocol_version: str | None = None,
|
|
2211
2216
|
) -> Any:
|
|
2212
2217
|
if worker and discovery:
|
|
2213
2218
|
raise ValueError("a request cannot be both worker-plane and cluster discovery")
|
|
@@ -2269,6 +2274,8 @@ class Client:
|
|
|
2269
2274
|
if worker and activity_authority is not None and activity_authority.governs(self, self.namespace, path):
|
|
2270
2275
|
request_timeout = min(request_timeout, activity_authority.remaining())
|
|
2271
2276
|
headers = self._discovery_headers() if discovery else self._headers(worker=worker)
|
|
2277
|
+
if worker and worker_protocol_version is not None:
|
|
2278
|
+
headers["X-Durable-Workflow-Protocol-Version"] = worker_protocol_version
|
|
2272
2279
|
if capabilities_digest is not None:
|
|
2273
2280
|
headers[CAPABILITIES_DIGEST_HEADER] = ServerCapabilitiesDigest.header(capabilities_digest)
|
|
2274
2281
|
if progress_poll:
|
|
@@ -2318,14 +2325,20 @@ class Client:
|
|
|
2318
2325
|
# The HTTP error is the answer; an unusable digest in it
|
|
2319
2326
|
# never replaces it. Ask for full capabilities next time.
|
|
2320
2327
|
self._capabilities_digest.forget()
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2328
|
+
retry_after = response_retry_after(exc)
|
|
2329
|
+
try:
|
|
2330
|
+
# The typed completion-size refusal carries the limit; the
|
|
2331
|
+
# size is the encoded request body this client sent.
|
|
2332
|
+
if raise_for_status is _raise_for_status:
|
|
2333
|
+
raise_for_status(
|
|
2334
|
+
exc.response.status_code, body, context=context,
|
|
2335
|
+
request_bytes=_request_body_bytes(exc.request),
|
|
2336
|
+
)
|
|
2337
|
+
raise_for_status(exc.response.status_code, body, context=context)
|
|
2338
|
+
except DurableWorkflowError as typed:
|
|
2339
|
+
if retry_after is not None:
|
|
2340
|
+
typed.retry_after = retry_after
|
|
2341
|
+
raise
|
|
2329
2342
|
raise # unreachable, but keeps type checker happy
|
|
2330
2343
|
|
|
2331
2344
|
try:
|
|
@@ -4101,6 +4114,7 @@ class Client:
|
|
|
4101
4114
|
|
|
4102
4115
|
async def deregister_worker(self, worker_id: str) -> dict[str, Any]:
|
|
4103
4116
|
"""Remove a stale or retired worker from the server roster."""
|
|
4117
|
+
self._continue_as_new_target_workers.discard((self.namespace, worker_id))
|
|
4104
4118
|
data = await self._request("DELETE", f"/workers/{quote(worker_id, safe='')}", context=worker_id)
|
|
4105
4119
|
if not isinstance(data, dict):
|
|
4106
4120
|
raise ServerError(
|
|
@@ -6177,7 +6191,12 @@ class Client:
|
|
|
6177
6191
|
body["process_metrics"] = process_metrics
|
|
6178
6192
|
if heartbeat_interval_seconds is not None:
|
|
6179
6193
|
body["heartbeat_interval_seconds"] = heartbeat_interval_seconds
|
|
6180
|
-
|
|
6194
|
+
session = (self.namespace, worker_id)
|
|
6195
|
+
self._continue_as_new_target_workers.discard(session)
|
|
6196
|
+
ack = await self._request("POST", "/worker/register", worker=True, json=body)
|
|
6197
|
+
if _continue_as_new.registration_supports_target(ack, worker_id, self.namespace, task_queue):
|
|
6198
|
+
self._continue_as_new_target_workers.add(session)
|
|
6199
|
+
return ack
|
|
6181
6200
|
|
|
6182
6201
|
async def create_worker_session(
|
|
6183
6202
|
self, worker_id: str, options: WorkerSessionOptions
|
|
@@ -6228,6 +6247,7 @@ class Client:
|
|
|
6228
6247
|
not isinstance(registration_token, str) or re.fullmatch(r"[a-f0-9]{32}", registration_token) is None
|
|
6229
6248
|
):
|
|
6230
6249
|
raise ValueError("registration_token must contain exactly 32 lowercase hexadecimal characters")
|
|
6250
|
+
self._continue_as_new_target_workers.discard((self.namespace, worker_id))
|
|
6231
6251
|
fenced = registration_token is not None
|
|
6232
6252
|
try:
|
|
6233
6253
|
data = await self._request(
|
|
@@ -6444,6 +6464,18 @@ class Client:
|
|
|
6444
6464
|
failure_type="WorkflowTaskWaitingForHistory",
|
|
6445
6465
|
)
|
|
6446
6466
|
|
|
6467
|
+
supports_target = (self.namespace, lease_owner) in self._continue_as_new_target_workers
|
|
6468
|
+
continuation_protocol = None
|
|
6469
|
+
for command in commands:
|
|
6470
|
+
is_continuation = command.get("type") == "continue_as_new"
|
|
6471
|
+
if "target_build" in command:
|
|
6472
|
+
if not is_continuation or not _continue_as_new.valid_target(command["target_build"]):
|
|
6473
|
+
raise ValueError("invalid_target_build: use the exact inherited or promoted continuation target")
|
|
6474
|
+
if not supports_target:
|
|
6475
|
+
raise ContinueAsNewTargetUnsupported()
|
|
6476
|
+
if is_continuation and supports_target:
|
|
6477
|
+
continuation_protocol = _continue_as_new.WORKER_PROTOCOL
|
|
6478
|
+
|
|
6447
6479
|
body: dict[str, Any] = {
|
|
6448
6480
|
"lease_owner": lease_owner,
|
|
6449
6481
|
"workflow_task_attempt": workflow_task_attempt,
|
|
@@ -6462,6 +6494,7 @@ class Client:
|
|
|
6462
6494
|
return await self._request(
|
|
6463
6495
|
"POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body,
|
|
6464
6496
|
context="task_completion",
|
|
6497
|
+
worker_protocol_version=continuation_protocol,
|
|
6465
6498
|
)
|
|
6466
6499
|
|
|
6467
6500
|
async def fail_workflow_task(
|
|
@@ -6482,6 +6515,11 @@ class Client:
|
|
|
6482
6515
|
The runtime may block incompatible replay until compatible code and
|
|
6483
6516
|
a supported repair are available instead of automatically retrying it.
|
|
6484
6517
|
"""
|
|
6518
|
+
continuation_protocol = None
|
|
6519
|
+
if failure_reason == _continue_as_new.PROMOTED_BUILD_UNAVAILABLE:
|
|
6520
|
+
if (self.namespace, lease_owner) not in self._continue_as_new_target_workers:
|
|
6521
|
+
raise ContinueAsNewTargetUnsupported()
|
|
6522
|
+
continuation_protocol = _continue_as_new.WORKER_PROTOCOL
|
|
6485
6523
|
failure: dict[str, Any] = {"message": message}
|
|
6486
6524
|
if failure_type is not None:
|
|
6487
6525
|
failure["type"] = failure_type
|
|
@@ -6495,7 +6533,8 @@ class Client:
|
|
|
6495
6533
|
"failure": failure,
|
|
6496
6534
|
}
|
|
6497
6535
|
return await self._request(
|
|
6498
|
-
"POST", f"/worker/workflow-tasks/{task_id}/fail", worker=True, json=body
|
|
6536
|
+
"POST", f"/worker/workflow-tasks/{task_id}/fail", worker=True, json=body,
|
|
6537
|
+
worker_protocol_version=continuation_protocol,
|
|
6499
6538
|
)
|
|
6500
6539
|
|
|
6501
6540
|
async def heartbeat_workflow_task(
|
|
@@ -26,6 +26,20 @@ from .cancellation import CancellationContext, ScopedCancellationContext
|
|
|
26
26
|
class DurableWorkflowError(Exception):
|
|
27
27
|
"""Base class for every exception raised by the SDK."""
|
|
28
28
|
|
|
29
|
+
#: Seconds the Server asked the client to wait before retrying, parsed
|
|
30
|
+
#: from the ``Retry-After`` header of the HTTP response this error was
|
|
31
|
+
#: raised for (delta-seconds or HTTP-date). ``None`` when there was none.
|
|
32
|
+
retry_after: float | None = None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ContinueAsNewTargetUnsupported(DurableWorkflowError):
|
|
36
|
+
"""The current worker registration cannot send a continue-as-new target."""
|
|
37
|
+
|
|
38
|
+
reason = "unsupported_target_build"
|
|
39
|
+
|
|
40
|
+
def __init__(self) -> None:
|
|
41
|
+
super().__init__(f"{self.reason}: the Server did not advertise build selection for this worker session")
|
|
42
|
+
|
|
29
43
|
|
|
30
44
|
class ActivityHeartbeatResumeUnavailable(DurableWorkflowError):
|
|
31
45
|
"""This claim did not supply the supported heartbeat-resume contract."""
|
|
@@ -350,6 +364,47 @@ class ServerError(DurableWorkflowError):
|
|
|
350
364
|
)
|
|
351
365
|
|
|
352
366
|
|
|
367
|
+
class ActivityHeartbeatUnavailable(ServerError):
|
|
368
|
+
"""An activity heartbeat could not reach the Server because of a transient outage.
|
|
369
|
+
|
|
370
|
+
:meth:`~durable_workflow.ActivityContext.heartbeat` and
|
|
371
|
+
:meth:`~durable_workflow.ActivityContext.heartbeat_sync` raise this after
|
|
372
|
+
the client's own transport retries are used up, for example during a
|
|
373
|
+
Server or database failover. It is raised only for failures that may
|
|
374
|
+
succeed unchanged once the Server recovers: a refused, reset or timed-out
|
|
375
|
+
connection; a 500, 502, 503 or 504 without a protocol ``reason`` or with
|
|
376
|
+
the generic ``server_error`` reason; a 503 ``storage_unavailable`` or
|
|
377
|
+
``backend_unavailable``; and a 5xx or 429 that says ``retryable: true``.
|
|
378
|
+
|
|
379
|
+
The heartbeat was not confirmed, but the attempt has not lost its
|
|
380
|
+
authority. Activity code may keep working and heartbeat again later,
|
|
381
|
+
waiting at least ``retry_after`` when it is set. A cancellation or lost
|
|
382
|
+
attempt still raises :class:`~durable_workflow.errors.ActivityCancelled`
|
|
383
|
+
or :class:`~durable_workflow.errors.ActivityWorkerLost`, and other
|
|
384
|
+
refusals keep their own errors.
|
|
385
|
+
|
|
386
|
+
It subclasses :class:`~durable_workflow.errors.ServerError`, so existing
|
|
387
|
+
``except ServerError`` handlers still catch it. ``status`` and ``body``
|
|
388
|
+
are those of the HTTP response, or ``0`` and ``None`` when no response
|
|
389
|
+
arrived. ``cause`` (also ``__cause__``) is the underlying error, and
|
|
390
|
+
``retry_after`` is the Server's ``Retry-After`` in seconds, or ``None``
|
|
391
|
+
when it sent none.
|
|
392
|
+
"""
|
|
393
|
+
|
|
394
|
+
def __init__(self, task_id: str, cause: BaseException) -> None:
|
|
395
|
+
if isinstance(cause, ServerError):
|
|
396
|
+
status, body = cause.status, cause.body
|
|
397
|
+
else:
|
|
398
|
+
status, body = 0, None
|
|
399
|
+
super().__init__(status, body)
|
|
400
|
+
detail = f"server returned {status}: {body!r}" if status else f"{type(cause).__name__}: {cause}"
|
|
401
|
+
self.args = (f"activity task {task_id!r} heartbeat not delivered; the Server is unavailable ({detail})",)
|
|
402
|
+
self.task_id = task_id
|
|
403
|
+
self.cause = cause
|
|
404
|
+
retry_after = getattr(cause, "retry_after", None)
|
|
405
|
+
self.retry_after = float(retry_after) if isinstance(retry_after, (int, float)) else None
|
|
406
|
+
|
|
407
|
+
|
|
353
408
|
WORKFLOW_TASK_COMPLETION_BYTES = "workflow_task_completion_bytes"
|
|
354
409
|
|
|
355
410
|
|