durable-workflow 2.17.1__tar.gz → 2.18.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.17.1/src/durable_workflow.egg-info → durable_workflow-2.18.0}/PKG-INFO +2 -1
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/README.md +1 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/pyproject.toml +3 -3
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/__init__.py +8 -0
- durable_workflow-2.18.0/src/durable_workflow/_activity_checkpoint.py +131 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/activity.py +31 -1
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/cancellation.py +24 -4
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/client.py +19 -6
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/errors.py +106 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/replay_clock.py +13 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/worker.py +25 -5
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/workflow.py +261 -7
- {durable_workflow-2.17.1 → durable_workflow-2.18.0/src/durable_workflow.egg-info}/PKG-INFO +2 -1
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow.egg-info/SOURCES.txt +23 -0
- durable_workflow-2.18.0/tests/test_activity_acceptance_authority.py +122 -0
- durable_workflow-2.18.0/tests/test_activity_acceptance_consumer.py +174 -0
- durable_workflow-2.18.0/tests/test_activity_acceptance_entry.py +121 -0
- durable_workflow-2.18.0/tests/test_activity_checkpoint.py +249 -0
- durable_workflow-2.18.0/tests/test_activity_exponential_retry.py +133 -0
- durable_workflow-2.18.0/tests/test_activity_install_inventory.py +152 -0
- durable_workflow-2.18.0/tests/test_activity_retry_cap_cell.py +125 -0
- durable_workflow-2.18.0/tests/test_cancellation_cause.py +227 -0
- durable_workflow-2.18.0/tests/test_checkpointed_batch_example.py +174 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_client.py +32 -0
- durable_workflow-2.18.0/tests/test_command_keys_acceptance.py +167 -0
- durable_workflow-2.18.0/tests/test_command_keys_captured_inputs.py +181 -0
- durable_workflow-2.18.0/tests/test_command_keys_container_ownership.py +108 -0
- durable_workflow-2.18.0/tests/test_command_keys_workspace.py +180 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_completion_size_limit.py +86 -1
- durable_workflow-2.18.0/tests/test_local_activity_backoff.py +99 -0
- durable_workflow-2.18.0/tests/test_native_timer_redrive_cell.py +345 -0
- durable_workflow-2.18.0/tests/test_native_timer_redrive_clock.py +144 -0
- durable_workflow-2.18.0/tests/test_parallel_group_policy.py +397 -0
- durable_workflow-2.18.0/tests/test_physical_command_key_readback.py +209 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_portal_source_split.py +114 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_publish_workflow_isolation.py +3 -1
- durable_workflow-2.18.0/tests/test_published_activity_acceptance.py +708 -0
- durable_workflow-2.18.0/tests/test_published_pagination_evidence.py +167 -0
- durable_workflow-2.18.0/tests/test_release_promotion.py +294 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_replay_regression_corpus.py +44 -8
- durable_workflow-2.18.0/tests/test_retry_cap_download.py +71 -0
- durable_workflow-2.18.0/tests/test_retry_cap_workflow.py +51 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker.py +4 -0
- durable_workflow-2.17.1/tests/test_local_activity_backoff.py +0 -49
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/LICENSE +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/setup.cfg +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_activity_lease.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_activity_process.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_avro.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_cancellation_scope.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_cancellation_scope_history.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_condition_fingerprint.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_cooperative_cancellation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_failure_reporting.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_metric_routes.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_poll_transport.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_prepared_local_activity.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_query_task_authority.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_sticky_workflow_cache.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/_typed_values.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/auth_composition.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/external_storage.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/external_task_input.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/external_task_result.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/history_bundle_verify.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/interceptors.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/invocable.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/metrics.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/nexus.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/py.typed +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/python_conformance.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/replay_clock_math.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/replay_conformance.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/replay_verify.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/retry_policy.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/serializer.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/server_compatibility.json +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/sync.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/telemetry.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/telemetry_carrier.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/testing.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/worker_session.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/worker_status.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow/workflow_updates_conformance.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow.egg-info/dependency_links.txt +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow.egg-info/entry_points.txt +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow.egg-info/requires.txt +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/src/durable_workflow.egg-info/top_level.txt +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_cancellation_policies.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_context.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_heartbeat_authority.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_identity.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_lease_authority.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_lease_renewal.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_lease_worker.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_process.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_retry_info.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_activity_run_closed_refusal.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_auth_composition.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_avro_value_benchmark.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_avro_value_protocol.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_business_replay_clock.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_business_replay_clock_child.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_business_replay_clock_parallel.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_business_replay_clock_redrive.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_business_replay_clock_sequence_claims.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_context.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_remaining_time.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_scope_admission.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_scope_authoring.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_scope_boundary.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cancellation_scope_opening.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_child_workflow_policies.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_ci_checkout.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_ci_integration_endpoint.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_client_iterators.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_client_telemetry.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_client_timeouts.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_codec_regression_corpus.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_committed_cancellation_scope_descendants.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_committed_cancellation_scope_groups.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_committed_cancellation_scope_history.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_committed_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_condition_fingerprint.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_condition_occurrence_id.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_condition_replay_drift.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_control_plane_parity_fixtures.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cooperative_cancellation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cooperative_cancellation_client.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cooperative_cancellation_worker.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_cooperative_remote_worker.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_docs_release_channel.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_docstring_cross_references.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_durable_selection.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_empty_callback_failure.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_errors.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_external_storage.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_external_task_input.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_external_task_result.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_failure_reporting.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_generator_lifecycle.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_golden_history_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_history_bundle_pruned.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_history_bundle_schema2.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_history_bundle_verify.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_history_event_contract.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_invocable.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_local_failure_reporting.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_message_streams.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_metric_routes.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_metrics.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_nexus_durable_wait.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_nexus_namespace.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_nexus_wire.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_order_processing_example.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_parallel_completion_order_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_parallel_saga_authoring.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_patch_history.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_pending_operation_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_poll_failure_backoff.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_poll_transport.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_prepared_local_activity_client.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_prepared_local_activity_groups.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_prepared_local_activity_policies.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_prepared_local_activity_worker.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_public_boundary_scanner.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_pypi_project_surface.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_python_conformance.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_queries.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_query_task_authority.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_query_timeout_retry.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_readme_quickstart.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_redrive_call_ledger.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_redrive_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_redrive_successor_evidence.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_registration_ambiguity.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_release_metadata.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_replay_clock.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_replay_conformance.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_replay_verify.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_retry_policy.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_run_activities.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_run_cancellation_scope_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_run_closed_settlement_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_runtime_external_payload_transport.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_schedules.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_scoped_run_cancellation_context.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sdk_metrics_contract.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_search_attribute_replay_identity.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_serializer.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_signals.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sleep.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_standalone_activity_client.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_static_credential_validation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sticky_execution.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sticky_history_suffix.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_storage_admission.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sync.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_sync_activities.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_telemetry.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_telemetry_carrier.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_testing_failures.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_testing_harness.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_testing_nexus.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_threaded_heartbeat_example.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_tls_trust.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_transport_diagnostics.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_typed_values.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_typed_workflow_values.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_update_outcome.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_update_signal_condition_replay.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_updates.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_wait_condition.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_deregistration.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_observation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_session.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_startup_buffered.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_startup_raw.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_startup_read_budget.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_startup_snapshot.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_status.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_worker_telemetry_wire.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_entry_arguments.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_entrypoint_validation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_handler_validation.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_identity.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_result_timeout.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_streams.py +0 -0
- {durable_workflow-2.17.1 → durable_workflow-2.18.0}/tests/test_workflow_updates_conformance.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: durable-workflow
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.18.0
|
|
4
4
|
Summary: Python client and worker SDK for Durable Workflow Cloud and self-hosted Server
|
|
5
5
|
Author: Durable Workflow Contributors
|
|
6
6
|
License-Expression: MIT
|
|
@@ -146,6 +146,7 @@ for the complete cross-SDK contract.
|
|
|
146
146
|
- [Python SDK guide](https://durable-workflow.com/docs/2.0/polyglot/python/)
|
|
147
147
|
- [Complete SDK reference](docs/sdk-reference.md)
|
|
148
148
|
- [Runnable examples](examples/)
|
|
149
|
+
- [Checkpointed batch source example](examples/CHECKPOINTED_BATCH.md) (SDK 2.18.0 accessor; synthetic provider)
|
|
149
150
|
- [Separate workflow and activity worker processes](docs/guides/separate-workers.md)
|
|
150
151
|
- [Symmetric SDK playground](https://github.com/durable-workflow/sample-app#symmetric-sdk-playground)
|
|
151
152
|
|
|
@@ -99,6 +99,7 @@ for the complete cross-SDK contract.
|
|
|
99
99
|
- [Python SDK guide](https://durable-workflow.com/docs/2.0/polyglot/python/)
|
|
100
100
|
- [Complete SDK reference](docs/sdk-reference.md)
|
|
101
101
|
- [Runnable examples](examples/)
|
|
102
|
+
- [Checkpointed batch source example](examples/CHECKPOINTED_BATCH.md) (SDK 2.18.0 accessor; synthetic provider)
|
|
102
103
|
- [Separate workflow and activity worker processes](docs/guides/separate-workers.md)
|
|
103
104
|
- [Symmetric SDK playground](https://github.com/durable-workflow/sample-app#symmetric-sdk-playground)
|
|
104
105
|
|
|
@@ -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.18.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.18.0"
|
|
83
|
+
registry-version = "2.18.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"
|
|
@@ -7,6 +7,7 @@ except PackageNotFoundError: # source checkout without installed metadata
|
|
|
7
7
|
__version__ = "0.0.0+unknown"
|
|
8
8
|
|
|
9
9
|
from . import activity, sync, testing, workflow
|
|
10
|
+
from ._activity_checkpoint import ActivityHeartbeatCheckpoint
|
|
10
11
|
from .activity import ActivityContext, ActivityInfo, ActivityRetryInfo
|
|
11
12
|
from .auth_composition import (
|
|
12
13
|
AUTH_COMPOSITION_CONTRACT_SCHEMA,
|
|
@@ -70,6 +71,7 @@ from .client import (
|
|
|
70
71
|
from .errors import (
|
|
71
72
|
ActivityCancelled,
|
|
72
73
|
ActivityFailed,
|
|
74
|
+
ActivityHeartbeatResumeUnavailable,
|
|
73
75
|
ChildWorkflowCancelled,
|
|
74
76
|
ChildWorkflowFailed,
|
|
75
77
|
ChildWorkflowTerminated,
|
|
@@ -117,8 +119,10 @@ from .errors import (
|
|
|
117
119
|
WorkflowNotFound,
|
|
118
120
|
WorkflowPayloadDecodeError,
|
|
119
121
|
WorkflowTaskCompletionTooLarge,
|
|
122
|
+
WorkflowTaskHistoryLimitExceeded,
|
|
120
123
|
WorkflowTerminated,
|
|
121
124
|
WorkflowTimedOut,
|
|
125
|
+
WorkflowTimeoutCleanupRequested,
|
|
122
126
|
)
|
|
123
127
|
from .external_storage import (
|
|
124
128
|
EXTERNAL_PAYLOAD_REFERENCE_SCHEMA,
|
|
@@ -259,6 +263,8 @@ __all__ = [
|
|
|
259
263
|
"ActivityHandler",
|
|
260
264
|
"ActivityInfo",
|
|
261
265
|
"ActivityRetryInfo",
|
|
266
|
+
"ActivityHeartbeatCheckpoint",
|
|
267
|
+
"ActivityHeartbeatResumeUnavailable",
|
|
262
268
|
"ActivityInterceptorContext",
|
|
263
269
|
"ActivityRetryPolicy",
|
|
264
270
|
"BridgeAdapterOutcome",
|
|
@@ -426,8 +432,10 @@ __all__ = [
|
|
|
426
432
|
"WorkflowFailed",
|
|
427
433
|
"WorkflowNotFound",
|
|
428
434
|
"WorkflowTaskCompletionTooLarge",
|
|
435
|
+
"WorkflowTaskHistoryLimitExceeded",
|
|
429
436
|
"WorkflowTerminated",
|
|
430
437
|
"WorkflowTimedOut",
|
|
438
|
+
"WorkflowTimeoutCleanupRequested",
|
|
431
439
|
"EXTERNAL_TASK_INPUT_CONTRACT_SCHEMA",
|
|
432
440
|
"EXTERNAL_TASK_INPUT_MEDIA_TYPE",
|
|
433
441
|
"EXTERNAL_TASK_INPUT_SCHEMA",
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"""Immutable heartbeat-resume metadata captured from one negotiated poll."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import re
|
|
7
|
+
from collections.abc import Mapping
|
|
8
|
+
from dataclasses import dataclass, field
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from ._typed_values import decode_payload_value, validate_annotation
|
|
13
|
+
from .errors import ActivityHeartbeatResumeUnavailable
|
|
14
|
+
|
|
15
|
+
_IDENTITY = ("task_id", "activity_execution_id", "activity_attempt_id", "workflow_id", "run_id", "namespace")
|
|
16
|
+
_TIMESTAMP = re.compile(
|
|
17
|
+
r"[0-9]{4}-[0-9]{2}-[0-9]{2}T(?:[01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]"
|
|
18
|
+
r"(?:\.[0-9]{1,9})?(?:Z|[+-](?:[01][0-9]|2[0-3]):[0-5][0-9])"
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _invalid() -> ValueError:
|
|
23
|
+
return ValueError("activity_heartbeat_resume v1 claim has an invalid checkpoint")
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True, init=False)
|
|
27
|
+
class ActivityHeartbeatCheckpoint:
|
|
28
|
+
"""The acknowledged snapshot received with this claim, never a pending write.
|
|
29
|
+
|
|
30
|
+
``contract_version`` describes the negotiated wire contract. Server v1
|
|
31
|
+
supplies no checkpoint write sequence. Acknowledgement does not commit an
|
|
32
|
+
external business effect atomically.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
acknowledged_at: str
|
|
36
|
+
contract_version: int = field(default=1, init=False)
|
|
37
|
+
_details_json: str = field(repr=False)
|
|
38
|
+
|
|
39
|
+
def __init__(self, details: Any, acknowledged_at: str) -> None:
|
|
40
|
+
if details is None or not isinstance(acknowledged_at, str) or not _TIMESTAMP.fullmatch(acknowledged_at):
|
|
41
|
+
raise _invalid()
|
|
42
|
+
try:
|
|
43
|
+
# Python 3.10's parser accepts fewer fractional forms. Validate the
|
|
44
|
+
# calendar/offset separately and retain the original precision.
|
|
45
|
+
calendar = re.sub(r"\.\d+(?=Z|[+-])", "", acknowledged_at)
|
|
46
|
+
datetime.fromisoformat(calendar.replace("Z", "+00:00"))
|
|
47
|
+
encoded = json.dumps(details, allow_nan=False)
|
|
48
|
+
except (ValueError, TypeError, OverflowError, RecursionError):
|
|
49
|
+
raise _invalid() from None
|
|
50
|
+
object.__setattr__(self, "acknowledged_at", acknowledged_at)
|
|
51
|
+
object.__setattr__(self, "_details_json", encoded)
|
|
52
|
+
|
|
53
|
+
def details(self, *, result_type: Any = None) -> Any:
|
|
54
|
+
"""Return an independent copy, optionally decoded using SDK typed values."""
|
|
55
|
+
value = json.loads(self._details_json)
|
|
56
|
+
if result_type is None:
|
|
57
|
+
return value
|
|
58
|
+
validate_annotation(result_type, "checkpoint")
|
|
59
|
+
return decode_payload_value(value, result_type, "checkpoint")
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
class _HeartbeatResume:
|
|
64
|
+
available: bool = False
|
|
65
|
+
checkpoint: ActivityHeartbeatCheckpoint | None = None
|
|
66
|
+
identity: tuple[Any, ...] = ()
|
|
67
|
+
|
|
68
|
+
def get(self) -> ActivityHeartbeatCheckpoint | None:
|
|
69
|
+
if not self.available:
|
|
70
|
+
raise ActivityHeartbeatResumeUnavailable()
|
|
71
|
+
return self.checkpoint
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class _ActivityTask(dict[str, Any]):
|
|
75
|
+
"""Keep poll metadata outside the task's unchanged public wire dictionary."""
|
|
76
|
+
|
|
77
|
+
def __init__(self, task: Mapping[str, Any], resume: _HeartbeatResume) -> None:
|
|
78
|
+
super().__init__(task)
|
|
79
|
+
self.heartbeat_resume = resume
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def _identity(task: Mapping[str, Any]) -> tuple[Any, ...]:
|
|
83
|
+
values = tuple(task.get(name) for name in _IDENTITY)
|
|
84
|
+
attempt = task.get("attempt_number")
|
|
85
|
+
if (any(not isinstance(value, str) or not value.strip() for value in values)
|
|
86
|
+
or type(attempt) is not int or attempt < 1):
|
|
87
|
+
raise _invalid()
|
|
88
|
+
return (*values, attempt, task.get("lease_owner"), task.get("activity_type"), task.get("task_queue"))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def capture_poll(data: Mapping[str, Any], namespace: str, worker_id: str, task_queue: str | None = None) -> Any:
|
|
92
|
+
task = data.get("task")
|
|
93
|
+
capabilities = data.get("server_capabilities")
|
|
94
|
+
capability = capabilities.get("activity_heartbeat_resume") if isinstance(capabilities, Mapping) else None
|
|
95
|
+
if (not isinstance(task, dict) or not isinstance(capability, Mapping)
|
|
96
|
+
or capability.get("supported") is not True or type(capability.get("version")) is not int
|
|
97
|
+
or capability["version"] != 1):
|
|
98
|
+
return task
|
|
99
|
+
if "last_heartbeat_details" not in task and "last_heartbeat_at" not in task:
|
|
100
|
+
return task
|
|
101
|
+
identity = _identity(task)
|
|
102
|
+
if task["namespace"] != namespace or task.get("lease_owner") != worker_id:
|
|
103
|
+
raise _invalid()
|
|
104
|
+
if task_queue is not None and "task_queue" in task and task["task_queue"] != task_queue:
|
|
105
|
+
raise _invalid()
|
|
106
|
+
if "last_heartbeat_details" not in task or "last_heartbeat_at" not in task:
|
|
107
|
+
raise _invalid()
|
|
108
|
+
details, at = task["last_heartbeat_details"], task["last_heartbeat_at"]
|
|
109
|
+
if details is None and at is None:
|
|
110
|
+
checkpoint = None
|
|
111
|
+
elif details is not None and task["attempt_number"] > 1:
|
|
112
|
+
checkpoint = ActivityHeartbeatCheckpoint(details, at)
|
|
113
|
+
else:
|
|
114
|
+
raise _invalid()
|
|
115
|
+
return _ActivityTask(task, _HeartbeatResume(True, checkpoint, identity))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def claim_resume(
|
|
119
|
+
task: Mapping[str, Any], namespace: str | None, task_id: str, attempt_id: str, attempt: int, worker_id: str,
|
|
120
|
+
activity_type: str, task_queue: str,
|
|
121
|
+
) -> _HeartbeatResume:
|
|
122
|
+
if not isinstance(task, _ActivityTask):
|
|
123
|
+
return _HeartbeatResume()
|
|
124
|
+
resume = task.heartbeat_resume
|
|
125
|
+
if (resume.identity != _identity(task) or task.get("namespace") != namespace
|
|
126
|
+
or task.get("task_id") != task_id or task.get("activity_attempt_id") != attempt_id
|
|
127
|
+
or type(attempt) is not int or task.get("attempt_number") != attempt
|
|
128
|
+
or task.get("lease_owner") != worker_id or task.get("activity_type") != activity_type
|
|
129
|
+
or "task_queue" in task and task["task_queue"] != task_queue):
|
|
130
|
+
raise _invalid()
|
|
131
|
+
return resume
|
|
@@ -8,6 +8,7 @@ from collections.abc import Awaitable, Callable, Mapping
|
|
|
8
8
|
from dataclasses import InitVar, dataclass, field
|
|
9
9
|
from typing import TYPE_CHECKING, Any
|
|
10
10
|
|
|
11
|
+
from ._activity_checkpoint import ActivityHeartbeatCheckpoint, _HeartbeatResume, claim_resume
|
|
11
12
|
from ._activity_lease import current_activity_authority
|
|
12
13
|
from .errors import ActivityCancelled, ActivityLeaseAuthorityLost
|
|
13
14
|
|
|
@@ -79,14 +80,20 @@ class ActivityInfo:
|
|
|
79
80
|
task_queue: str
|
|
80
81
|
worker_id: str
|
|
81
82
|
task_metadata: InitVar[Mapping[str, Any] | None] = None
|
|
83
|
+
task_namespace: InitVar[str | None] = None
|
|
82
84
|
retry_info: ActivityRetryInfo = field(init=False)
|
|
85
|
+
_heartbeat_resume: _HeartbeatResume = field(init=False, repr=False)
|
|
83
86
|
workflow_id: str | None = field(init=False)
|
|
84
87
|
run_id: str | None = field(init=False)
|
|
85
88
|
activity_execution_id: str | None = field(init=False)
|
|
86
89
|
|
|
87
|
-
def __post_init__(self, task_metadata: Mapping[str, Any] | None) -> None:
|
|
90
|
+
def __post_init__(self, task_metadata: Mapping[str, Any] | None, task_namespace: str | None) -> None:
|
|
88
91
|
task = task_metadata if task_metadata is not None else {}
|
|
89
92
|
object.__setattr__(self, "retry_info", ActivityRetryInfo.from_task(self.attempt_number, task))
|
|
93
|
+
object.__setattr__(self, "_heartbeat_resume", claim_resume(
|
|
94
|
+
task, task_namespace, self.task_id, self.activity_attempt_id, self.attempt_number, self.worker_id,
|
|
95
|
+
self.activity_type, self.task_queue,
|
|
96
|
+
))
|
|
90
97
|
for name in ("workflow_id", "run_id"):
|
|
91
98
|
value = task.get(name)
|
|
92
99
|
object.__setattr__(self, name, value if isinstance(value, str) and value else None)
|
|
@@ -125,6 +132,29 @@ class ActivityContext:
|
|
|
125
132
|
"""``True`` once the server has signalled that the owning workflow cancelled this activity."""
|
|
126
133
|
return self._cancel_requested
|
|
127
134
|
|
|
135
|
+
def heartbeat_resume_version(self) -> int | None:
|
|
136
|
+
"""The received contract version, or ``None`` when unavailable."""
|
|
137
|
+
return 1 if self._info._heartbeat_resume.available else None
|
|
138
|
+
|
|
139
|
+
def last_heartbeat_checkpoint(self) -> ActivityHeartbeatCheckpoint | None:
|
|
140
|
+
"""Return the received snapshot, or ``None`` for supported empty state.
|
|
141
|
+
|
|
142
|
+
Raises ActivityHeartbeatResumeUnavailable for older or nonparticipating
|
|
143
|
+
claims, inline local activities and Server-free tests. Heartbeat writes
|
|
144
|
+
never change this snapshot, including rejected or uncertain writes.
|
|
145
|
+
"""
|
|
146
|
+
return self._info._heartbeat_resume.get()
|
|
147
|
+
|
|
148
|
+
def last_heartbeat_details(self, *, result_type: Any = None) -> Any:
|
|
149
|
+
"""Read acknowledged details, optionally decoded to an application type."""
|
|
150
|
+
checkpoint = self.last_heartbeat_checkpoint()
|
|
151
|
+
return checkpoint.details(result_type=result_type) if checkpoint is not None else None
|
|
152
|
+
|
|
153
|
+
def last_heartbeat_at(self) -> str | None:
|
|
154
|
+
"""The original RFC3339 acknowledgement time without losing precision."""
|
|
155
|
+
checkpoint = self.last_heartbeat_checkpoint()
|
|
156
|
+
return checkpoint.acknowledged_at if checkpoint is not None else None
|
|
157
|
+
|
|
128
158
|
def heartbeat_sync(self, details: dict[str, Any] | None = None) -> None:
|
|
129
159
|
"""Heartbeat from a synchronous activity thread and check attempt authority.
|
|
130
160
|
|
|
@@ -68,6 +68,14 @@ def _text(snapshot: Mapping[str, Any], key: str) -> str:
|
|
|
68
68
|
return value
|
|
69
69
|
|
|
70
70
|
|
|
71
|
+
CANCELLATION_CAUSE = "cancellation"
|
|
72
|
+
TIMEOUT_CAUSE = "timeout"
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
def _format_timestamp(value: datetime) -> str:
|
|
76
|
+
return value.isoformat(timespec="microseconds").replace("+00:00", "Z")
|
|
77
|
+
|
|
78
|
+
|
|
71
79
|
def _timestamp(value: str) -> datetime:
|
|
72
80
|
if not re.fullmatch(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})", value):
|
|
73
81
|
raise ValueError("cancellation timestamp requires an ISO date, time and timezone")
|
|
@@ -112,6 +120,8 @@ class CancellationContext:
|
|
|
112
120
|
lineage: tuple[CancellationLineage, ...]
|
|
113
121
|
_replay_clock: Callable[[], datetime] | None = field(default=None, repr=False, compare=False)
|
|
114
122
|
scope_origin: ScopedCancellationContext | None = None
|
|
123
|
+
cause: str | None = None
|
|
124
|
+
"""``"timeout"`` for a timeout-cleanup request, else ``None`` or ``"cancellation"`` (ordinary)."""
|
|
115
125
|
|
|
116
126
|
def __post_init__(self) -> None:
|
|
117
127
|
object.__setattr__(self, "requester", MappingProxyType(dict(self.requester)))
|
|
@@ -122,6 +132,11 @@ class CancellationContext:
|
|
|
122
132
|
"""The original immutable cleanup deadline."""
|
|
123
133
|
return self.cleanup_deadline_at
|
|
124
134
|
|
|
135
|
+
@property
|
|
136
|
+
def is_timeout(self) -> bool:
|
|
137
|
+
"""Whether the run's work deadline passed and this request opens its timeout cleanup."""
|
|
138
|
+
return self.cause == TIMEOUT_CAUSE
|
|
139
|
+
|
|
125
140
|
def remaining(self) -> float:
|
|
126
141
|
"""Seconds left at the consumed replay boundary, clamped to zero.
|
|
127
142
|
|
|
@@ -194,10 +209,13 @@ class CancellationContext:
|
|
|
194
209
|
raise ValueError("cancellation deadline must follow the original request")
|
|
195
210
|
if scope_origin is not None:
|
|
196
211
|
_assert_scope_origin(snapshot, scope_origin, normalized, normalized_requester, requested_at, deadline)
|
|
212
|
+
cause = snapshot.get("cause")
|
|
213
|
+
if cause is not None and cause not in (CANCELLATION_CAUSE, TIMEOUT_CAUSE):
|
|
214
|
+
raise ValueError("cancellation cause must be cancellation or timeout")
|
|
197
215
|
return cls(
|
|
198
216
|
request_id, root_request_id, root_instance_id, root_run_id, parent_request_id,
|
|
199
217
|
reason, normalized_requester, _text(snapshot, "source"), requested_at, deadline, tuple(normalized),
|
|
200
|
-
scope_origin=scope_origin,
|
|
218
|
+
scope_origin=scope_origin, cause=cause,
|
|
201
219
|
)
|
|
202
220
|
|
|
203
221
|
def to_dict(self) -> dict[str, Any]:
|
|
@@ -213,10 +231,12 @@ class CancellationContext:
|
|
|
213
231
|
"reason": self.reason,
|
|
214
232
|
"requester": dict(self.requester),
|
|
215
233
|
"source": self.source,
|
|
216
|
-
"requested_at": self.requested_at
|
|
217
|
-
"cleanup_deadline_at": self.cleanup_deadline_at
|
|
234
|
+
"requested_at": _format_timestamp(self.requested_at),
|
|
235
|
+
"cleanup_deadline_at": _format_timestamp(self.cleanup_deadline_at),
|
|
218
236
|
"lineage": [entry.to_dict() for entry in self.lineage],
|
|
219
237
|
}
|
|
238
|
+
if self.cause is not None:
|
|
239
|
+
snapshot["cause"] = self.cause
|
|
220
240
|
if self.scope_origin is not None:
|
|
221
241
|
snapshot["scope_origin"] = self.scope_origin.to_dict()
|
|
222
242
|
snapshot["scope_authority_deadline_at"] = snapshot["cleanup_deadline_at"]
|
|
@@ -239,7 +259,7 @@ class ScopedCancellationLineage:
|
|
|
239
259
|
"workflow_instance_id": self.workflow_instance_id,
|
|
240
260
|
"workflow_run_id": self.workflow_run_id,
|
|
241
261
|
"scope_id": self.scope_id,
|
|
242
|
-
"cleanup_deadline_at": self.cleanup_deadline_at
|
|
262
|
+
"cleanup_deadline_at": _format_timestamp(self.cleanup_deadline_at),
|
|
243
263
|
}
|
|
244
264
|
|
|
245
265
|
|
|
@@ -22,6 +22,7 @@ import asyncio
|
|
|
22
22
|
import contextlib
|
|
23
23
|
import copy
|
|
24
24
|
import hashlib
|
|
25
|
+
import json
|
|
25
26
|
import json as json_module
|
|
26
27
|
import math
|
|
27
28
|
import os
|
|
@@ -40,6 +41,7 @@ from urllib.parse import quote, unquote, urlencode, urlsplit
|
|
|
40
41
|
import httpx
|
|
41
42
|
|
|
42
43
|
from . import serializer
|
|
44
|
+
from ._activity_checkpoint import capture_poll as _capture_activity_checkpoint
|
|
43
45
|
from ._activity_lease import ActivityLeaseAuthority, current_activity_authority
|
|
44
46
|
from ._cancellation_scope import CancellationScopeOpenReceipt, scope_identity
|
|
45
47
|
from ._cancellation_scope_history import (
|
|
@@ -4966,11 +4968,14 @@ class Client:
|
|
|
4966
4968
|
async def query_workflow(
|
|
4967
4969
|
self, workflow_id: str, query_name: str, *, args: list[Any] | None = None
|
|
4968
4970
|
) -> Any:
|
|
4969
|
-
"""Execute a named read-only query
|
|
4971
|
+
"""Execute a named read-only query and return the Server's receipt.
|
|
4970
4972
|
|
|
4971
4973
|
Queries are synchronous and non-mutating. The server runs the named
|
|
4972
|
-
query handler inside the workflow process
|
|
4973
|
-
|
|
4974
|
+
query handler inside the workflow process. The returned ``dict``
|
|
4975
|
+
includes workflow/run identities and ``query_name``; its ``result``
|
|
4976
|
+
member holds the decoded handler value, which may be ``None``.
|
|
4977
|
+
Read ``receipt["result"]`` to obtain that value.
|
|
4978
|
+
Raises :class:`~durable_workflow.errors.QueryFailed` if the
|
|
4974
4979
|
query was rejected, the handler errored, or the original query timed
|
|
4975
4980
|
out. A canonical query timeout is surfaced without automatically
|
|
4976
4981
|
admitting another query.
|
|
@@ -6131,7 +6136,8 @@ class Client:
|
|
|
6131
6136
|
if sticky_cache is not None:
|
|
6132
6137
|
body["sticky_cache"] = sticky_cache
|
|
6133
6138
|
return await self._request(
|
|
6134
|
-
"POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body
|
|
6139
|
+
"POST", f"/worker/workflow-tasks/{task_id}/complete", worker=True, json=body,
|
|
6140
|
+
context="task_completion",
|
|
6135
6141
|
)
|
|
6136
6142
|
|
|
6137
6143
|
async def fail_workflow_task(
|
|
@@ -6609,7 +6615,6 @@ class Client:
|
|
|
6609
6615
|
body: dict[str, Any] = {
|
|
6610
6616
|
"lease_owner": lease_owner,
|
|
6611
6617
|
"query_task_attempt": query_task_attempt,
|
|
6612
|
-
"result": result,
|
|
6613
6618
|
"result_envelope": self._payload_envelope(
|
|
6614
6619
|
result,
|
|
6615
6620
|
codec=codec,
|
|
@@ -6621,6 +6626,14 @@ class Client:
|
|
|
6621
6626
|
external_storage_threshold_bytes=external_storage_threshold_bytes,
|
|
6622
6627
|
),
|
|
6623
6628
|
}
|
|
6629
|
+
# The envelope is authoritative. The optional plain projection must
|
|
6630
|
+
# not impose a JSON-only restriction on valid Avro values such as bytes.
|
|
6631
|
+
try:
|
|
6632
|
+
json.dumps(result, allow_nan=False)
|
|
6633
|
+
except (TypeError, ValueError):
|
|
6634
|
+
pass
|
|
6635
|
+
else:
|
|
6636
|
+
body["result"] = result
|
|
6624
6637
|
return await self._request(
|
|
6625
6638
|
"POST", f"/worker/query-tasks/{query_task_id}/complete", worker=True, json=body
|
|
6626
6639
|
)
|
|
@@ -6771,7 +6784,7 @@ class Client:
|
|
|
6771
6784
|
except httpx.TimeoutException:
|
|
6772
6785
|
continue
|
|
6773
6786
|
|
|
6774
|
-
return (data or {}
|
|
6787
|
+
return _capture_activity_checkpoint(data or {}, self.namespace, worker_id, task_queue)
|
|
6775
6788
|
|
|
6776
6789
|
return None
|
|
6777
6790
|
|
|
@@ -27,6 +27,13 @@ class DurableWorkflowError(Exception):
|
|
|
27
27
|
"""Base class for every exception raised by the SDK."""
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
class ActivityHeartbeatResumeUnavailable(DurableWorkflowError):
|
|
31
|
+
"""This claim did not supply the supported heartbeat-resume contract."""
|
|
32
|
+
|
|
33
|
+
def __init__(self) -> None:
|
|
34
|
+
super().__init__("activity_heartbeat_resume v1 is unavailable for this claim")
|
|
35
|
+
|
|
36
|
+
|
|
30
37
|
class ReplayClockUnavailable(DurableWorkflowError):
|
|
31
38
|
"""The current execution has no proved business replay-time boundary."""
|
|
32
39
|
|
|
@@ -355,6 +362,71 @@ class WorkflowTaskCompletionTooLarge(ServerError):
|
|
|
355
362
|
)
|
|
356
363
|
|
|
357
364
|
|
|
365
|
+
HISTORY_TRANSACTION_REFUSALS = frozenset({"history_transaction_limit_exceeded", "completion_budget_exceeded"})
|
|
366
|
+
_HISTORY_TRANSACTION_UNITS = {
|
|
367
|
+
"history_transaction_size": "history events",
|
|
368
|
+
"history_transaction_bytes": "history bytes",
|
|
369
|
+
"history_transaction_rows": "rows",
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
class WorkflowTaskHistoryLimitExceeded(WorkflowTaskCompletionTooLarge):
|
|
374
|
+
"""The Server refused a completion over its history-transaction budget.
|
|
375
|
+
|
|
376
|
+
A workflow-task completion is recorded in one history transaction, bounded
|
|
377
|
+
by the Server's ``history_transaction_size`` (events),
|
|
378
|
+
``history_transaction_bytes`` and ``history_transaction_rows`` structural
|
|
379
|
+
limits. A completion past one of them is refused with ``409`` and reason
|
|
380
|
+
``history_transaction_limit_exceeded`` (or ``completion_budget_exceeded``
|
|
381
|
+
from the early local-activity count) before anything is recorded. Native
|
|
382
|
+
Server releases after 3.12.0 also name ``limit_kind``, the measured
|
|
383
|
+
``current_value`` and the ``configured_limit`` (.github#228).
|
|
384
|
+
|
|
385
|
+
Replaying the task produces the same commands, so like
|
|
386
|
+
:class:`WorkflowTaskCompletionTooLarge` this is not retryable: the worker
|
|
387
|
+
fails the run once with a ``structural_limit`` failure instead of
|
|
388
|
+
reporting a workflow-task failure, which would block replay.
|
|
389
|
+
|
|
390
|
+
:attr:`limit_kind` is the Server's limit kind, or the refusal reason when
|
|
391
|
+
the Server named none. :attr:`limit` is the configured limit and
|
|
392
|
+
:attr:`size` the Server's measured value, in that limit's unit, when
|
|
393
|
+
reported.
|
|
394
|
+
"""
|
|
395
|
+
|
|
396
|
+
def __init__(self, status: int, body: object, *, size: int | None = None) -> None:
|
|
397
|
+
ServerError.__init__(self, status, body)
|
|
398
|
+
fields = body if isinstance(body, dict) else {}
|
|
399
|
+
kind = fields.get("limit_kind")
|
|
400
|
+
limit = fields.get("configured_limit")
|
|
401
|
+
current = fields.get("current_value")
|
|
402
|
+
message = fields.get("message")
|
|
403
|
+
self.limit_kind = kind if isinstance(kind, str) and kind else str(self.reason() or "history_transaction_limit")
|
|
404
|
+
self.limit = limit if type(limit) is int else None
|
|
405
|
+
self.size = current if type(current) is int else None
|
|
406
|
+
self.server_message = message if isinstance(message, str) and message else None
|
|
407
|
+
self.args = (self.structural_limit_message(),)
|
|
408
|
+
|
|
409
|
+
@staticmethod
|
|
410
|
+
def matches(status: int, body: object) -> bool:
|
|
411
|
+
"""Whether a response is a history-transaction budget refusal."""
|
|
412
|
+
return (
|
|
413
|
+
status == 409
|
|
414
|
+
and isinstance(body, dict)
|
|
415
|
+
and body.get("reason") in HISTORY_TRANSACTION_REFUSALS
|
|
416
|
+
and body.get("recorded") is not True
|
|
417
|
+
)
|
|
418
|
+
|
|
419
|
+
def structural_limit_message(self) -> str:
|
|
420
|
+
unit = _HISTORY_TRANSACTION_UNITS.get(self.limit_kind, "units")
|
|
421
|
+
size = f"{self.size} {unit}" if self.size is not None else "more than the limit allows"
|
|
422
|
+
limit = f"the server limit of {self.limit} {unit}" if self.limit is not None else "the server limit"
|
|
423
|
+
return (
|
|
424
|
+
f"Structural limit exceeded: {self.limit_kind}: the workflow task completion would write {size} "
|
|
425
|
+
f"in one history transaction, over {limit}. Split the fan-out into smaller batches, move work into "
|
|
426
|
+
"child workflows, or continue-as-new; offload large payloads with external payload storage."
|
|
427
|
+
)
|
|
428
|
+
|
|
429
|
+
|
|
358
430
|
class NexusOperationFailed(DurableWorkflowError):
|
|
359
431
|
"""A Nexus service operation completed with a typed service failure."""
|
|
360
432
|
|
|
@@ -970,6 +1042,38 @@ class WorkflowCancelled(BaseException):
|
|
|
970
1042
|
self.context = context
|
|
971
1043
|
|
|
972
1044
|
|
|
1045
|
+
class WorkflowTimeoutCleanupRequested(WorkflowCancelled):
|
|
1046
|
+
"""The run's work deadline passed and its timeout cleanup has started.
|
|
1047
|
+
|
|
1048
|
+
Raised at the authored call, like a cooperative cancellation request, when a
|
|
1049
|
+
run that opted in to timeout cleanup reaches its work deadline. It is a
|
|
1050
|
+
:class:`WorkflowCancelled`, so existing ``except WorkflowCancelled:``
|
|
1051
|
+
handlers (saga compensation, cleanup) run unchanged. The run still ends
|
|
1052
|
+
timed out, whatever the cleanup returns.
|
|
1053
|
+
|
|
1054
|
+
Like :class:`WorkflowCancelled` it is :class:`BaseException`-rooted, and it
|
|
1055
|
+
is not an :class:`asyncio.CancelledError`. ``context.cause`` is
|
|
1056
|
+
``"timeout"``; test ``cause`` rather than the type when telling the two
|
|
1057
|
+
apart, since ``cause`` is the cross-SDK discriminator. ``context.cleanup_deadline_at``
|
|
1058
|
+
is the cleanup deadline. Experimental.
|
|
1059
|
+
"""
|
|
1060
|
+
|
|
1061
|
+
def __init__(
|
|
1062
|
+
self, message: str = "workflow work deadline passed: timeout cleanup requested", *,
|
|
1063
|
+
request_id: str | None = None, context: CancellationContext | ScopedCancellationContext | None = None,
|
|
1064
|
+
) -> None:
|
|
1065
|
+
super().__init__(message, request_id=request_id, context=context)
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
def _cancellation_requested(
|
|
1069
|
+
message: str, *, request_id: str | None, context: CancellationContext | ScopedCancellationContext | None,
|
|
1070
|
+
) -> WorkflowCancelled:
|
|
1071
|
+
"""The exception for a delivered run request: the timeout subtype when timeout cleanup requested it."""
|
|
1072
|
+
if isinstance(context, CancellationContext) and context.is_timeout:
|
|
1073
|
+
return WorkflowTimeoutCleanupRequested(request_id=request_id, context=context)
|
|
1074
|
+
return WorkflowCancelled(message, request_id=request_id, context=context)
|
|
1075
|
+
|
|
1076
|
+
|
|
973
1077
|
class ActivityCancelled(BaseException):
|
|
974
1078
|
"""An in-flight activity was cancelled.
|
|
975
1079
|
|
|
@@ -1041,6 +1145,8 @@ def _raise_for_status(
|
|
|
1041
1145
|
|
|
1042
1146
|
if WorkflowTaskCompletionTooLarge.matches(status, body):
|
|
1043
1147
|
raise WorkflowTaskCompletionTooLarge(status, body, size=request_bytes)
|
|
1148
|
+
if context == "task_completion" and WorkflowTaskHistoryLimitExceeded.matches(status, body):
|
|
1149
|
+
raise WorkflowTaskHistoryLimitExceeded(status, body)
|
|
1044
1150
|
|
|
1045
1151
|
reason = body.get("reason") if isinstance(body, dict) else None
|
|
1046
1152
|
message = body.get("message", "") if isinstance(body, dict) else str(body)
|
|
@@ -343,6 +343,19 @@ class BusinessReplayClock:
|
|
|
343
343
|
events.append(event)
|
|
344
344
|
self._pending = (None, _activity_group_time(events, failed_member))
|
|
345
345
|
|
|
346
|
+
def observe_propagated_activity_failure(self, member: _GroupMember, *, reconstruction: bool) -> None:
|
|
347
|
+
"""Use only the qualified first-recorded failure of an explicit group."""
|
|
348
|
+
self._pending = (None, None)
|
|
349
|
+
if reconstruction:
|
|
350
|
+
return
|
|
351
|
+
event = self._activity_group_boundary(member)
|
|
352
|
+
if event is None or _kind(event) == "ActivityCompleted":
|
|
353
|
+
return
|
|
354
|
+
time = _group_event_time(event)
|
|
355
|
+
milliseconds = canonical_milliseconds(time) if time is not None else None
|
|
356
|
+
if milliseconds is not None:
|
|
357
|
+
self._pending = (member[0], from_canonical_milliseconds(milliseconds))
|
|
358
|
+
|
|
346
359
|
def _activity_group_boundary(self, member: _GroupMember) -> Mapping[str, Any] | None:
|
|
347
360
|
index, sequence, activity_type, path = member
|
|
348
361
|
indices = self._by_sequence.get(sequence, [])
|
|
@@ -151,7 +151,7 @@ TYPED_SEARCH_ATTRIBUTES_CAPABILITY = "typed_search_attributes"
|
|
|
151
151
|
DURABLE_SELECTION_CAPABILITY = "durable_selection"
|
|
152
152
|
LOCAL_ACTIVITIES_CAPABILITY = "local_activities"
|
|
153
153
|
|
|
154
|
-
#
|
|
154
|
+
# Base capabilities implemented by every high-level Python worker. Keep this
|
|
155
155
|
# advertisement explicit: worker capabilities are not inferred from runtime,
|
|
156
156
|
# SDK, or protocol-version metadata.
|
|
157
157
|
_WORKFLOW_COMMAND_CAPABILITIES = (
|
|
@@ -160,6 +160,7 @@ _WORKFLOW_COMMAND_CAPABILITIES = (
|
|
|
160
160
|
DURABLE_SELECTION_CAPABILITY,
|
|
161
161
|
LOCAL_ACTIVITIES_CAPABILITY,
|
|
162
162
|
"workflow_entry_arguments_validation",
|
|
163
|
+
"activity_heartbeat_resume",
|
|
163
164
|
)
|
|
164
165
|
|
|
165
166
|
_WORKFLOW_WORK_TASK_KINDS = ("workflow", "update_validation")
|
|
@@ -2410,6 +2411,23 @@ class Worker:
|
|
|
2410
2411
|
reference = store_external_payload(storage, data, codec=envelope["codec"])
|
|
2411
2412
|
return {"codec": envelope["codec"], "external_storage": reference.to_dict()}
|
|
2412
2413
|
|
|
2414
|
+
async def _wait_local_retry_backoff(self, task: dict[str, Any], seconds: float) -> None:
|
|
2415
|
+
"""Wait a local retry backoff while keeping the workflow task leased.
|
|
2416
|
+
|
|
2417
|
+
A backoff, such as the generated 60-second default cap, can be as long
|
|
2418
|
+
as the Server's workflow-task lease (60 seconds by default on native
|
|
2419
|
+
Server). Renew at the cooperative lease observer's cadence so the
|
|
2420
|
+
Server never reclaims the claim and reruns the local activity from its
|
|
2421
|
+
first attempt (.github#219). The full backoff is never shortened.
|
|
2422
|
+
"""
|
|
2423
|
+
remaining = float(seconds)
|
|
2424
|
+
while remaining > 0:
|
|
2425
|
+
step = min(remaining, 5.0, self._heartbeat_interval)
|
|
2426
|
+
await asyncio.sleep(step)
|
|
2427
|
+
remaining -= step
|
|
2428
|
+
if remaining > 0:
|
|
2429
|
+
await self._renew_local_workflow_lease(task)
|
|
2430
|
+
|
|
2413
2431
|
async def _execute_cooperative_local_callable(
|
|
2414
2432
|
self, task: dict[str, Any], command: RecordLocalActivity, handler: Callable[..., Any],
|
|
2415
2433
|
attempt_state: dict[str, Any],
|
|
@@ -2700,7 +2718,7 @@ class Worker:
|
|
|
2700
2718
|
attempts.append(attempt_report)
|
|
2701
2719
|
if retry:
|
|
2702
2720
|
if backoff_seconds:
|
|
2703
|
-
await
|
|
2721
|
+
await self._wait_local_retry_backoff(task, backoff_seconds)
|
|
2704
2722
|
continue
|
|
2705
2723
|
return terminal_failure(
|
|
2706
2724
|
status, message, exception_type,
|
|
@@ -3118,12 +3136,13 @@ class Worker:
|
|
|
3118
3136
|
the typed error is raised again with the follow-up's error as its
|
|
3119
3137
|
cause, so the caller never reports a workflow-task failure (``/fail``)
|
|
3120
3138
|
on this path: the Server would retry the task into the same 413 or
|
|
3121
|
-
block replay.
|
|
3139
|
+
block replay. A history-transaction budget refusal
|
|
3140
|
+
(:class:`WorkflowTaskHistoryLimitExceeded`, a 409) takes this path too.
|
|
3122
3141
|
"""
|
|
3123
3142
|
message = error.structural_limit_message()
|
|
3124
3143
|
log.error(
|
|
3125
|
-
"workflow task %s completion refused by the server: %s (limit_kind=%s,
|
|
3126
|
-
"limit=%s
|
|
3144
|
+
"workflow task %s completion refused by the server: %s (limit_kind=%s, measured=%s, "
|
|
3145
|
+
"limit=%s); failing the run instead of resending it",
|
|
3127
3146
|
task_id,
|
|
3128
3147
|
message,
|
|
3129
3148
|
error.limit_kind,
|
|
@@ -3416,6 +3435,7 @@ class Worker:
|
|
|
3416
3435
|
task_queue=self.task_queue,
|
|
3417
3436
|
worker_id=self.worker_id,
|
|
3418
3437
|
task_metadata=task,
|
|
3438
|
+
task_namespace=getattr(self.client, "namespace", None),
|
|
3419
3439
|
),
|
|
3420
3440
|
client=self.client,
|
|
3421
3441
|
)
|