cadence-python-client 0.2.2__tar.gz → 0.3.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.
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.cursorrules +1 -1
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.github/workflows/ci_checks.yml +9 -4
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/Makefile +15 -9
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/PKG-INFO +54 -61
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/README.md +50 -54
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/rpc/error.py +24 -24
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/rpc/retry.py +17 -13
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/rpc/yarpc.py +7 -8
- cadence_python_client-0.3.0/cadence/_internal/workflow/context.py +305 -0
- cadence_python_client-0.3.0/cadence/_internal/workflow/memo.py +40 -0
- cadence_python_client-0.3.0/cadence/_internal/workflow/statemachine/child_workflow_execution_state_machine.py +184 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/decision_manager.py +78 -13
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/event_dispatcher.py +30 -5
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/nondeterminism.py +88 -0
- cadence_python_client-0.3.0/cadence/_internal/workflow/statemachine/signal_external_workflow_state_machine.py +74 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/workflow_engine.py +26 -2
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/workflow_instance.py +33 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/common_pb2.py +13 -31
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/common_pb2.pyi +2 -31
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/schedule_pb2.py +8 -8
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/schedule_pb2.pyi +6 -2
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_domain_pb2.py +32 -32
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_domain_pb2.pyi +4 -2
- cadence_python_client-0.3.0/cadence/api/v1/tasklist_pb2.py +78 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/tasklist_pb2.pyi +4 -2
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/client.py +317 -3
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/cadence_tool.py +6 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/error.py +39 -0
- cadence_python_client-0.3.0/cadence/query.py +103 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_decision_task_handler.py +114 -15
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/workflow.py +227 -8
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence_python_client.egg-info/PKG-INFO +54 -61
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence_python_client.egg-info/SOURCES.txt +14 -1
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence_python_client.egg-info/requires.txt +1 -4
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/pyproject.toml +5 -6
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/rpc/test_error.py +7 -5
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/rpc/test_retry.py +7 -5
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/statemachine/test_child_workflow_execution_state_machine.py +331 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/statemachine/test_decision_manager.py +535 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/statemachine/test_nondeterminism.py +90 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/statemachine/test_signal_external_workflow_state_machine.py +101 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/test_context_child_workflow.py +452 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/test_context_signal_child_workflow.py +256 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/test_memo.py +53 -0
- cadence_python_client-0.3.0/tests/cadence/_internal/workflow/test_query_handling.py +545 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_retry_policy.py +15 -16
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_waiter.py +4 -2
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/test_client.py +26 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/test_client_workflow.py +26 -0
- cadence_python_client-0.3.0/tests/cadence/test_schedule.py +350 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_decision_task_handler.py +40 -9
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_decision_task_handler_integration.py +5 -5
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_task_handler_integration.py +50 -15
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/docker-compose.yml +1 -1
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/nondeterminism/test_nondeterministic_workflows.py +8 -9
- cadence_python_client-0.3.0/tests/integration_tests/test_schedule.py +183 -0
- cadence_python_client-0.3.0/tests/integration_tests/workflow/test_child_workflow.py +231 -0
- cadence_python_client-0.3.0/tests/integration_tests/workflow/test_query.py +435 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_retry_policy.py +2 -2
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_signals.py +2 -1
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/uv.lock +17 -173
- cadence_python_client-0.2.2/cadence/_internal/workflow/context.py +0 -148
- cadence_python_client-0.2.2/cadence/api/v1/tasklist_pb2.py +0 -78
- cadence_python_client-0.2.2/scripts/dev.py +0 -187
- cadence_python_client-0.2.2/tests/cadence/_internal/workflow/statemachine/test_decision_manager.py +0 -190
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.github/dco.yml +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.github/pull_request_template.md +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.github/workflows/python-publish.yml +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.github/workflows/semantic-pr.yml +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.gitignore +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/.gitmodules +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/CONTRIBUTING.md +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/LICENSE +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/NOTICE +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/activity/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/activity/_activity_executor.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/activity/_context.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/activity/_definition.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/activity/_heartbeat.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/fn_signature.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/rpc/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/active_cluster_selection_policy.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/decision_events_iterator.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/deterministic_event_loop.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/history_event_iterator.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/retry_policy.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/activity_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/cancellation.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/completion_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/decision_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/statemachine/timer_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/_internal/workflow/waiter.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/activity.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/common_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/decision_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/decision_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/decision_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/domain_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/domain_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/domain_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/error_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/error_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/error_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/history_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/history_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/history_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/query_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/query_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/query_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/schedule_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_domain_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_meta_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_meta_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_meta_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_schedule_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_schedule_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_schedule_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_visibility_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_visibility_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_visibility_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_worker_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_worker_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_worker_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_workflow_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_workflow_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/service_workflow_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/tasklist_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/visibility_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/visibility_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/visibility_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/workflow_pb2.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/workflow_pb2.pyi +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/api/v1/workflow_pb2_grpc.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/README.md +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/cadence_agent_runner.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/cadence_handoff.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/cadence_model.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/cadence_registry.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/images/cadence-web-agent-run.jpg +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/openai_activities.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/contrib/openai/pydantic_data_converter.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/data_converter.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/metrics/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/metrics/constants.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/metrics/metrics.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/metrics/prometheus.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/sample/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/sample/client_example.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/sample/grpc_usage_example.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/sample/simple_usage_example.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/signal.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/__init__.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_activity.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_base_task_handler.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_decision.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_poller.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_registry.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_types.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence/worker/_worker.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence_python_client.egg-info/dependency_links.txt +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/cadence_python_client.egg-info/top_level.txt +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/scripts/fix_pyi_imports.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/scripts/generate_proto.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/setup.cfg +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/activity/test_activity_executor.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/activity/test_heartbeat.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/test_fn_signature.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/statemachine/test_activity_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/statemachine/test_timer_state_machine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_context_retry_policy.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_decision_events_iterator.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_deterministic_event_loop.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_history_event_iterator.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_signal_handling.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/_internal/workflow/test_workflow_engine.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/common_activities.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/data_converter_test.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/metrics/test_metrics.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/metrics/test_prometheus.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/test_activity.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_base_task_handler.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_decision_worker_integration.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_poller.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_registry.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/cadence/worker/test_worker.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/conftest.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/conftest.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/helper.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/nondeterminism/success.json +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/test_client.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_activities.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_continue_as_new.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_heartbeat.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_serialization.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_timer.py +0 -0
- {cadence_python_client-0.2.2 → cadence_python_client-0.3.0}/tests/integration_tests/workflow/test_workflows.py +0 -0
|
@@ -32,7 +32,7 @@ pip install -e ".[dev]"
|
|
|
32
32
|
|
|
33
33
|
## Code Generation
|
|
34
34
|
- Use `uv run python scripts/generate_proto.py` for protobuf generation
|
|
35
|
-
- Use `
|
|
35
|
+
- Use `make` targets for development tasks
|
|
36
36
|
|
|
37
37
|
## Code Quality
|
|
38
38
|
- **ALWAYS run linter and type checker after making code changes**
|
|
@@ -54,7 +54,7 @@ jobs:
|
|
|
54
54
|
uv sync --extra dev --extra openai
|
|
55
55
|
- name: Run mypy type checker
|
|
56
56
|
run: |
|
|
57
|
-
uv run mypy cadence/
|
|
57
|
+
uv run mypy cadence/ tests/
|
|
58
58
|
|
|
59
59
|
test:
|
|
60
60
|
name: Unit Tests
|
|
@@ -74,7 +74,12 @@ jobs:
|
|
|
74
74
|
uv sync --extra dev
|
|
75
75
|
- name: Run unit tests
|
|
76
76
|
run: |
|
|
77
|
-
uv run pytest -
|
|
77
|
+
uv run pytest --integration-tests --cov --cov-branch --cov-report=xml
|
|
78
|
+
- name: Upload coverage reports to Codecov
|
|
79
|
+
uses: codecov/codecov-action@v5
|
|
80
|
+
with:
|
|
81
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
82
|
+
slug: cadence-workflow/cadence-python-client
|
|
78
83
|
|
|
79
84
|
integration_test:
|
|
80
85
|
name: Integration Tests
|
|
@@ -92,6 +97,6 @@ jobs:
|
|
|
92
97
|
- name: Install dependencies
|
|
93
98
|
run: |
|
|
94
99
|
uv sync --extra dev
|
|
95
|
-
- name: Run
|
|
100
|
+
- name: Run integration tests
|
|
96
101
|
run: |
|
|
97
|
-
uv run pytest -v --integration-tests
|
|
102
|
+
uv run pytest -v tests/integration_tests --integration-tests
|
|
@@ -33,7 +33,11 @@ test:
|
|
|
33
33
|
# Run integration tests
|
|
34
34
|
integration-test:
|
|
35
35
|
@echo "Running integration tests..."
|
|
36
|
-
uv run pytest -v --integration-tests
|
|
36
|
+
uv run pytest -v tests/integration_tests --integration-tests
|
|
37
|
+
|
|
38
|
+
integration-test-keep:
|
|
39
|
+
@echo "Running integration tests with cadence alive..."
|
|
40
|
+
uv run pytest -v tests/integration_tests --integration-tests --keep-cadence-alive
|
|
37
41
|
|
|
38
42
|
# Clean generated files and caches
|
|
39
43
|
clean:
|
|
@@ -41,15 +45,17 @@ clean:
|
|
|
41
45
|
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
42
46
|
find . -type f -name "*.pyc" -delete 2>/dev/null || true
|
|
43
47
|
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
|
|
48
|
+
rm -rf .mypy_cache
|
|
44
49
|
|
|
45
50
|
# Show help
|
|
46
51
|
help:
|
|
47
52
|
@echo "Available targets:"
|
|
48
|
-
@echo " make pr
|
|
49
|
-
@echo " make install
|
|
50
|
-
@echo " make lint
|
|
51
|
-
@echo " make type-check
|
|
52
|
-
@echo " make test
|
|
53
|
-
@echo " make integration-test
|
|
54
|
-
@echo " make
|
|
55
|
-
@echo " make
|
|
53
|
+
@echo " make pr - Run all PR checks (recommended before submitting PR)"
|
|
54
|
+
@echo " make install - Install dependencies"
|
|
55
|
+
@echo " make lint - Run Ruff linter"
|
|
56
|
+
@echo " make type-check - Run mypy type checker"
|
|
57
|
+
@echo " make test - Run unit tests"
|
|
58
|
+
@echo " make integration-test - Run integration tests"
|
|
59
|
+
@echo " make integration-test-keep - Run integration tests with cadence alive"
|
|
60
|
+
@echo " make clean - Remove generated files and caches"
|
|
61
|
+
@echo " make help - Show this help message"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadence-python-client
|
|
3
|
-
Version: 0.
|
|
4
|
-
Summary: Python
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Python SDK for authoring Cadence workflows and activities
|
|
5
5
|
Author: Cadence
|
|
6
6
|
License: Apache-2.0
|
|
7
7
|
Project-URL: Homepage, https://cadenceworkflow.io/
|
|
@@ -9,7 +9,7 @@ Project-URL: Documentation, https://cadenceworkflow.io/docs/get-started
|
|
|
9
9
|
Project-URL: Repository, https://github.com/cadence-workflow/cadence-python-client
|
|
10
10
|
Project-URL: Bug Tracker, https://github.com/cadence-workflow/cadence-python-client/issues
|
|
11
11
|
Keywords: workflow,orchestration,distributed,async,cadence
|
|
12
|
-
Classifier: Development Status ::
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
13
|
Classifier: Intended Audience :: Developers
|
|
14
14
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
15
|
Classifier: Operating System :: OS Independent
|
|
@@ -31,14 +31,11 @@ Requires-Dist: typing-extensions>=4.0.0
|
|
|
31
31
|
Requires-Dist: prometheus-client>=0.21.0
|
|
32
32
|
Provides-Extra: dev
|
|
33
33
|
Requires-Dist: grpcio-tools>=1.73.1; extra == "dev"
|
|
34
|
+
Requires-Dist: grpc-stubs>=1.53.0.6; extra == "dev"
|
|
34
35
|
Requires-Dist: pytest>=8.4.1; extra == "dev"
|
|
35
36
|
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
36
37
|
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
37
|
-
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
38
|
-
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
39
|
-
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
40
38
|
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
41
|
-
Requires-Dist: pre-commit>=3.0.0; extra == "dev"
|
|
42
39
|
Requires-Dist: pytest-docker>=3.2.3; extra == "dev"
|
|
43
40
|
Requires-Dist: opentelemetry-instrumentation-grpc==0.60b1; extra == "dev"
|
|
44
41
|
Requires-Dist: opentelemetry-sdk>=1.39.1; extra == "dev"
|
|
@@ -56,22 +53,33 @@ Requires-Dist: openai>=0.27.10; extra == "openai"
|
|
|
56
53
|
Requires-Dist: openai-agents>=0.12.5; extra == "openai"
|
|
57
54
|
Dynamic: license-file
|
|
58
55
|
|
|
59
|
-
# Python
|
|
56
|
+
# Cadence Python SDK
|
|
60
57
|
|
|
61
58
|
[Cadence](https://github.com/uber/cadence) is a distributed, scalable, durable, and highly available orchestration engine we developed at Uber Engineering to execute asynchronous long-running business logic in a scalable and resilient way.
|
|
62
59
|
|
|
63
60
|
If you'd like to propose a new feature, first join the [CNCF Slack workspace](https://communityinviter.com/apps/cloud-native/cncf) in the **#cadence-users** channel to start a discussion.
|
|
64
61
|
|
|
65
|
-
|
|
62
|
+
The Cadence Python SDK is the framework for authoring workflows and activities using the Python programming language.
|
|
66
63
|
|
|
67
|
-
##
|
|
68
|
-
**This SDK is currently an early work-in-progress (WIP) and is NOT ready for production use.**
|
|
64
|
+
## Installation
|
|
69
65
|
|
|
70
|
-
|
|
71
|
-
- It has not been published to any package repository (PyPI, etc.)
|
|
72
|
-
- APIs and interfaces are subject to change without notice
|
|
66
|
+
Install from [PyPI](https://pypi.org/project/cadence-python-client/):
|
|
73
67
|
|
|
74
|
-
|
|
68
|
+
```bash
|
|
69
|
+
pip install cadence-python-client
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Or with `uv`:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
uv add cadence-python-client
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
The core package supports Python `>=3.11,<3.14`.
|
|
79
|
+
|
|
80
|
+
The SDK is ready for production use using PYPI. To build from source, clone the repository and install the development dependencies.
|
|
81
|
+
|
|
82
|
+
Clone the repository if you want to develop locally:
|
|
75
83
|
|
|
76
84
|
```bash
|
|
77
85
|
git clone https://github.com/cadence-workflow/cadence-python-client.git
|
|
@@ -103,8 +111,7 @@ cd cadence-python-client
|
|
|
103
111
|
|
|
104
112
|
3. **Create virtual environment and install dependencies:**
|
|
105
113
|
```bash
|
|
106
|
-
uv
|
|
107
|
-
uv pip install -e ".[dev]"
|
|
114
|
+
uv sync --all-extras
|
|
108
115
|
```
|
|
109
116
|
|
|
110
117
|
Or if you prefer traditional pip:
|
|
@@ -116,70 +123,56 @@ cd cadence-python-client
|
|
|
116
123
|
|
|
117
124
|
### Generate Protobuf and gRPC Files
|
|
118
125
|
|
|
119
|
-
Run the generation script
|
|
126
|
+
Run the generation script only if you change files under `idls/proto/`:
|
|
127
|
+
|
|
120
128
|
```bash
|
|
121
|
-
#
|
|
122
|
-
|
|
123
|
-
uv run python scripts/generate_proto.py
|
|
129
|
+
# Recommended
|
|
130
|
+
make generate
|
|
124
131
|
|
|
125
|
-
# Or
|
|
126
|
-
python scripts/generate_proto.py
|
|
132
|
+
# Or run the script directly
|
|
133
|
+
uv run python scripts/generate_proto.py
|
|
127
134
|
```
|
|
128
135
|
|
|
129
136
|
This will:
|
|
130
|
-
- Download protoc 29.1 binary
|
|
131
|
-
- Install grpcio-tools if needed
|
|
132
137
|
- Generate Python protobuf files in `cadence/api/v1/`
|
|
133
138
|
- Generate gRPC service files in `cadence/api/v1/`
|
|
134
|
-
-
|
|
139
|
+
- Refresh the package imports for the generated modules
|
|
135
140
|
|
|
136
141
|
### Test
|
|
137
142
|
|
|
138
|
-
|
|
139
|
-
```bash
|
|
140
|
-
# Using uv (recommended)
|
|
141
|
-
uv run python cadence/sample/simple_usage_example.py
|
|
142
|
-
uv run python cadence/sample/grpc_usage_example.py
|
|
143
|
+
Run the main checks:
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
```bash
|
|
146
|
+
make lint
|
|
147
|
+
make type-check
|
|
148
|
+
make test
|
|
147
149
|
```
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
The project includes a development script that provides convenient commands for common tasks:
|
|
151
|
+
Run integration tests with Docker:
|
|
152
152
|
|
|
153
153
|
```bash
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
# Run tests
|
|
158
|
-
uv run python scripts/dev.py test
|
|
159
|
-
|
|
160
|
-
# Run tests with coverage
|
|
161
|
-
uv run python scripts/dev.py test-cov
|
|
162
|
-
|
|
163
|
-
# Run linting
|
|
164
|
-
uv run python scripts/dev.py lint
|
|
165
|
-
|
|
166
|
-
# Format code
|
|
167
|
-
uv run python scripts/dev.py format
|
|
154
|
+
make integration-test
|
|
155
|
+
```
|
|
168
156
|
|
|
169
|
-
|
|
170
|
-
uv run python scripts/dev.py install
|
|
157
|
+
You can also verify the generated files manually:
|
|
171
158
|
|
|
172
|
-
|
|
173
|
-
uv run python
|
|
159
|
+
```bash
|
|
160
|
+
uv run python cadence/sample/simple_usage_example.py
|
|
161
|
+
uv run python cadence/sample/grpc_usage_example.py
|
|
162
|
+
```
|
|
174
163
|
|
|
175
|
-
|
|
176
|
-
uv run python scripts/dev.py build
|
|
164
|
+
### Development Commands
|
|
177
165
|
|
|
178
|
-
|
|
179
|
-
uv run python scripts/dev.py clean
|
|
166
|
+
The current repository workflow is centered on `make` targets:
|
|
180
167
|
|
|
181
|
-
|
|
182
|
-
|
|
168
|
+
```bash
|
|
169
|
+
make install
|
|
170
|
+
make generate
|
|
171
|
+
make lint
|
|
172
|
+
make type-check
|
|
173
|
+
make test
|
|
174
|
+
make integration-test
|
|
175
|
+
make pr
|
|
183
176
|
```
|
|
184
177
|
|
|
185
178
|
## License
|
|
@@ -1,19 +1,30 @@
|
|
|
1
|
-
# Python
|
|
1
|
+
# Cadence Python SDK
|
|
2
2
|
|
|
3
3
|
[Cadence](https://github.com/uber/cadence) is a distributed, scalable, durable, and highly available orchestration engine we developed at Uber Engineering to execute asynchronous long-running business logic in a scalable and resilient way.
|
|
4
4
|
|
|
5
5
|
If you'd like to propose a new feature, first join the [CNCF Slack workspace](https://communityinviter.com/apps/cloud-native/cncf) in the **#cadence-users** channel to start a discussion.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The Cadence Python SDK is the framework for authoring workflows and activities using the Python programming language.
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
**This SDK is currently an early work-in-progress (WIP) and is NOT ready for production use.**
|
|
9
|
+
## Installation
|
|
11
10
|
|
|
12
|
-
|
|
13
|
-
- It has not been published to any package repository (PyPI, etc.)
|
|
14
|
-
- APIs and interfaces are subject to change without notice
|
|
11
|
+
Install from [PyPI](https://pypi.org/project/cadence-python-client/):
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
```bash
|
|
14
|
+
pip install cadence-python-client
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Or with `uv`:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
uv add cadence-python-client
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The core package supports Python `>=3.11,<3.14`.
|
|
24
|
+
|
|
25
|
+
The SDK is ready for production use using PYPI. To build from source, clone the repository and install the development dependencies.
|
|
26
|
+
|
|
27
|
+
Clone the repository if you want to develop locally:
|
|
17
28
|
|
|
18
29
|
```bash
|
|
19
30
|
git clone https://github.com/cadence-workflow/cadence-python-client.git
|
|
@@ -45,8 +56,7 @@ cd cadence-python-client
|
|
|
45
56
|
|
|
46
57
|
3. **Create virtual environment and install dependencies:**
|
|
47
58
|
```bash
|
|
48
|
-
uv
|
|
49
|
-
uv pip install -e ".[dev]"
|
|
59
|
+
uv sync --all-extras
|
|
50
60
|
```
|
|
51
61
|
|
|
52
62
|
Or if you prefer traditional pip:
|
|
@@ -58,70 +68,56 @@ cd cadence-python-client
|
|
|
58
68
|
|
|
59
69
|
### Generate Protobuf and gRPC Files
|
|
60
70
|
|
|
61
|
-
Run the generation script
|
|
71
|
+
Run the generation script only if you change files under `idls/proto/`:
|
|
72
|
+
|
|
62
73
|
```bash
|
|
63
|
-
#
|
|
64
|
-
|
|
65
|
-
uv run python scripts/generate_proto.py
|
|
74
|
+
# Recommended
|
|
75
|
+
make generate
|
|
66
76
|
|
|
67
|
-
# Or
|
|
68
|
-
python scripts/generate_proto.py
|
|
77
|
+
# Or run the script directly
|
|
78
|
+
uv run python scripts/generate_proto.py
|
|
69
79
|
```
|
|
70
80
|
|
|
71
81
|
This will:
|
|
72
|
-
- Download protoc 29.1 binary
|
|
73
|
-
- Install grpcio-tools if needed
|
|
74
82
|
- Generate Python protobuf files in `cadence/api/v1/`
|
|
75
83
|
- Generate gRPC service files in `cadence/api/v1/`
|
|
76
|
-
-
|
|
84
|
+
- Refresh the package imports for the generated modules
|
|
77
85
|
|
|
78
86
|
### Test
|
|
79
87
|
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
# Using uv (recommended)
|
|
83
|
-
uv run python cadence/sample/simple_usage_example.py
|
|
84
|
-
uv run python cadence/sample/grpc_usage_example.py
|
|
88
|
+
Run the main checks:
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
```bash
|
|
91
|
+
make lint
|
|
92
|
+
make type-check
|
|
93
|
+
make test
|
|
89
94
|
```
|
|
90
95
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
The project includes a development script that provides convenient commands for common tasks:
|
|
96
|
+
Run integration tests with Docker:
|
|
94
97
|
|
|
95
98
|
```bash
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
# Run tests
|
|
100
|
-
uv run python scripts/dev.py test
|
|
101
|
-
|
|
102
|
-
# Run tests with coverage
|
|
103
|
-
uv run python scripts/dev.py test-cov
|
|
104
|
-
|
|
105
|
-
# Run linting
|
|
106
|
-
uv run python scripts/dev.py lint
|
|
107
|
-
|
|
108
|
-
# Format code
|
|
109
|
-
uv run python scripts/dev.py format
|
|
99
|
+
make integration-test
|
|
100
|
+
```
|
|
110
101
|
|
|
111
|
-
|
|
112
|
-
uv run python scripts/dev.py install
|
|
102
|
+
You can also verify the generated files manually:
|
|
113
103
|
|
|
114
|
-
|
|
115
|
-
uv run python
|
|
104
|
+
```bash
|
|
105
|
+
uv run python cadence/sample/simple_usage_example.py
|
|
106
|
+
uv run python cadence/sample/grpc_usage_example.py
|
|
107
|
+
```
|
|
116
108
|
|
|
117
|
-
|
|
118
|
-
uv run python scripts/dev.py build
|
|
109
|
+
### Development Commands
|
|
119
110
|
|
|
120
|
-
|
|
121
|
-
uv run python scripts/dev.py clean
|
|
111
|
+
The current repository workflow is centered on `make` targets:
|
|
122
112
|
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
```bash
|
|
114
|
+
make install
|
|
115
|
+
make generate
|
|
116
|
+
make lint
|
|
117
|
+
make type-check
|
|
118
|
+
make test
|
|
119
|
+
make integration-test
|
|
120
|
+
make pr
|
|
125
121
|
```
|
|
126
122
|
|
|
127
123
|
## License
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
from typing import Callable, Any, Optional, Generator, TypeVar
|
|
1
|
+
from typing import Callable, Any, Optional, Generator, TypeVar, cast
|
|
2
2
|
|
|
3
3
|
import grpc
|
|
4
|
-
from google.rpc.status_pb2 import Status
|
|
4
|
+
from google.rpc.status_pb2 import Status
|
|
5
5
|
from grpc.aio import (
|
|
6
6
|
UnaryUnaryClientInterceptor,
|
|
7
7
|
ClientCallDetails,
|
|
@@ -9,7 +9,7 @@ from grpc.aio import (
|
|
|
9
9
|
UnaryUnaryCall,
|
|
10
10
|
Metadata,
|
|
11
11
|
)
|
|
12
|
-
from grpc_status.rpc_status import from_call
|
|
12
|
+
from grpc_status.rpc_status import from_call
|
|
13
13
|
|
|
14
14
|
from cadence.api.v1 import error_pb2
|
|
15
15
|
from cadence import error
|
|
@@ -46,22 +46,22 @@ class CadenceErrorUnaryUnaryCall(UnaryUnaryCall[RequestType, ResponseType]):
|
|
|
46
46
|
return await self._wrapped.code()
|
|
47
47
|
|
|
48
48
|
async def details(self) -> str:
|
|
49
|
-
return await self._wrapped.details()
|
|
49
|
+
return await self._wrapped.details()
|
|
50
50
|
|
|
51
51
|
async def wait_for_connection(self) -> None:
|
|
52
52
|
await self._wrapped.wait_for_connection()
|
|
53
53
|
|
|
54
54
|
def cancelled(self) -> bool:
|
|
55
|
-
return self._wrapped.cancelled()
|
|
55
|
+
return self._wrapped.cancelled()
|
|
56
56
|
|
|
57
57
|
def done(self) -> bool:
|
|
58
|
-
return self._wrapped.done()
|
|
58
|
+
return self._wrapped.done()
|
|
59
59
|
|
|
60
60
|
def time_remaining(self) -> Optional[float]:
|
|
61
|
-
return self._wrapped.time_remaining()
|
|
61
|
+
return self._wrapped.time_remaining()
|
|
62
62
|
|
|
63
63
|
def cancel(self) -> bool:
|
|
64
|
-
return self._wrapped.cancel()
|
|
64
|
+
return self._wrapped.cancel()
|
|
65
65
|
|
|
66
66
|
def add_done_callback(self, callback: DoneCallbackType) -> None:
|
|
67
67
|
self._wrapped.add_done_callback(callback)
|
|
@@ -79,16 +79,18 @@ class CadenceErrorInterceptor(UnaryUnaryClientInterceptor):
|
|
|
79
79
|
|
|
80
80
|
|
|
81
81
|
def map_error(e: AioRpcError) -> error.CadenceRpcError:
|
|
82
|
-
|
|
82
|
+
# AioRpcError implements the grpc.Call interface but doesn't inherit from it in the type stubs
|
|
83
|
+
status: Status | None = from_call(cast(grpc.Call, e))
|
|
84
|
+
message = e.details() or ""
|
|
83
85
|
if not status or not status.details:
|
|
84
|
-
return error.CadenceRpcError(
|
|
86
|
+
return error.CadenceRpcError(message, e.code())
|
|
85
87
|
|
|
86
88
|
details = status.details[0]
|
|
87
89
|
if details.Is(error_pb2.WorkflowExecutionAlreadyStartedError.DESCRIPTOR):
|
|
88
90
|
already_started = error_pb2.WorkflowExecutionAlreadyStartedError()
|
|
89
91
|
details.Unpack(already_started)
|
|
90
92
|
return error.WorkflowExecutionAlreadyStartedError(
|
|
91
|
-
|
|
93
|
+
message,
|
|
92
94
|
e.code(),
|
|
93
95
|
already_started.start_request_id,
|
|
94
96
|
already_started.run_id,
|
|
@@ -97,19 +99,19 @@ def map_error(e: AioRpcError) -> error.CadenceRpcError:
|
|
|
97
99
|
not_exists = error_pb2.EntityNotExistsError()
|
|
98
100
|
details.Unpack(not_exists)
|
|
99
101
|
return error.EntityNotExistsError(
|
|
100
|
-
|
|
102
|
+
message,
|
|
101
103
|
e.code(),
|
|
102
104
|
not_exists.current_cluster,
|
|
103
105
|
not_exists.active_cluster,
|
|
104
106
|
list(not_exists.active_clusters),
|
|
105
107
|
)
|
|
106
108
|
elif details.Is(error_pb2.WorkflowExecutionAlreadyCompletedError.DESCRIPTOR):
|
|
107
|
-
return error.WorkflowExecutionAlreadyCompletedError(
|
|
109
|
+
return error.WorkflowExecutionAlreadyCompletedError(message, e.code())
|
|
108
110
|
elif details.Is(error_pb2.DomainNotActiveError.DESCRIPTOR):
|
|
109
111
|
not_active = error_pb2.DomainNotActiveError()
|
|
110
112
|
details.Unpack(not_active)
|
|
111
113
|
return error.DomainNotActiveError(
|
|
112
|
-
|
|
114
|
+
message,
|
|
113
115
|
e.code(),
|
|
114
116
|
not_active.domain,
|
|
115
117
|
not_active.current_cluster,
|
|
@@ -120,7 +122,7 @@ def map_error(e: AioRpcError) -> error.CadenceRpcError:
|
|
|
120
122
|
not_supported = error_pb2.ClientVersionNotSupportedError()
|
|
121
123
|
details.Unpack(not_supported)
|
|
122
124
|
return error.ClientVersionNotSupportedError(
|
|
123
|
-
|
|
125
|
+
message,
|
|
124
126
|
e.code(),
|
|
125
127
|
not_supported.feature_version,
|
|
126
128
|
not_supported.client_impl,
|
|
@@ -129,20 +131,18 @@ def map_error(e: AioRpcError) -> error.CadenceRpcError:
|
|
|
129
131
|
elif details.Is(error_pb2.FeatureNotEnabledError.DESCRIPTOR):
|
|
130
132
|
not_enabled = error_pb2.FeatureNotEnabledError()
|
|
131
133
|
details.Unpack(not_enabled)
|
|
132
|
-
return error.FeatureNotEnabledError(
|
|
133
|
-
e.details(), e.code(), not_enabled.feature_flag
|
|
134
|
-
)
|
|
134
|
+
return error.FeatureNotEnabledError(message, e.code(), not_enabled.feature_flag)
|
|
135
135
|
elif details.Is(error_pb2.CancellationAlreadyRequestedError.DESCRIPTOR):
|
|
136
|
-
return error.CancellationAlreadyRequestedError(
|
|
136
|
+
return error.CancellationAlreadyRequestedError(message, e.code())
|
|
137
137
|
elif details.Is(error_pb2.DomainAlreadyExistsError.DESCRIPTOR):
|
|
138
|
-
return error.DomainAlreadyExistsError(
|
|
138
|
+
return error.DomainAlreadyExistsError(message, e.code())
|
|
139
139
|
elif details.Is(error_pb2.LimitExceededError.DESCRIPTOR):
|
|
140
|
-
return error.LimitExceededError(
|
|
140
|
+
return error.LimitExceededError(message, e.code())
|
|
141
141
|
elif details.Is(error_pb2.QueryFailedError.DESCRIPTOR):
|
|
142
|
-
return error.QueryFailedError(
|
|
142
|
+
return error.QueryFailedError(message, e.code())
|
|
143
143
|
elif details.Is(error_pb2.ServiceBusyError.DESCRIPTOR):
|
|
144
144
|
service_busy = error_pb2.ServiceBusyError()
|
|
145
145
|
details.Unpack(service_busy)
|
|
146
|
-
return error.ServiceBusyError(
|
|
146
|
+
return error.ServiceBusyError(message, e.code(), service_busy.reason)
|
|
147
147
|
else:
|
|
148
|
-
return error.CadenceRpcError(
|
|
148
|
+
return error.CadenceRpcError(message, e.code())
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import asyncio
|
|
2
2
|
from dataclasses import dataclass
|
|
3
|
-
from typing import Callable, Any
|
|
3
|
+
from typing import Callable, Any, cast
|
|
4
4
|
|
|
5
5
|
from grpc import StatusCode
|
|
6
6
|
from grpc.aio import UnaryUnaryClientInterceptor, ClientCallDetails
|
|
@@ -59,19 +59,23 @@ class RetryInterceptor(UnaryUnaryClientInterceptor):
|
|
|
59
59
|
request: Any,
|
|
60
60
|
) -> Any:
|
|
61
61
|
loop = asyncio.get_running_loop()
|
|
62
|
-
expiration_interval =
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
expiration_interval = (
|
|
63
|
+
client_call_details.timeout
|
|
64
|
+
if client_call_details.timeout is not None
|
|
65
|
+
else float("inf")
|
|
66
|
+
)
|
|
65
67
|
start_time = loop.time()
|
|
66
68
|
deadline = start_time + expiration_interval
|
|
67
69
|
|
|
68
70
|
attempts = 0
|
|
69
71
|
while True:
|
|
70
72
|
remaining = deadline - loop.time()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
call_details = ClientCallDetails(
|
|
74
|
+
method=client_call_details.method,
|
|
75
|
+
timeout=remaining,
|
|
76
|
+
metadata=client_call_details.metadata,
|
|
77
|
+
credentials=client_call_details.credentials,
|
|
78
|
+
wait_for_ready=client_call_details.wait_for_ready,
|
|
75
79
|
)
|
|
76
80
|
rpc_call = await continuation(call_details, request)
|
|
77
81
|
try:
|
|
@@ -98,11 +102,11 @@ class RetryInterceptor(UnaryUnaryClientInterceptor):
|
|
|
98
102
|
|
|
99
103
|
|
|
100
104
|
def is_retryable(err: CadenceRpcError, call_details: ClientCallDetails) -> bool:
|
|
101
|
-
# Handle requests to the passive side, matching the Go and Java Clients
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
):
|
|
105
|
+
# Handle requests to the passive side, matching the Go and Java Clients.
|
|
106
|
+
# grpc-stubs types method as str, but grpcio corrected it to bytes in v1.75.0
|
|
107
|
+
# (grpc/grpc#39405). Cast to bytes to match the actual runtime type.
|
|
108
|
+
method = cast(bytes, call_details.method)
|
|
109
|
+
if method == GET_WORKFLOW_HISTORY and isinstance(err, EntityNotExistsError):
|
|
106
110
|
return (
|
|
107
111
|
err.active_cluster is not None
|
|
108
112
|
and err.current_cluster is not None
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Callable
|
|
1
|
+
from typing import Any, Callable
|
|
2
2
|
|
|
3
3
|
from grpc.aio import Metadata
|
|
4
4
|
from grpc.aio import UnaryUnaryClientInterceptor, ClientCallDetails
|
|
@@ -38,11 +38,10 @@ class YarpcMetadataInterceptor(UnaryUnaryClientInterceptor):
|
|
|
38
38
|
else:
|
|
39
39
|
metadata += self._metadata
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
client_call_details.
|
|
46
|
-
|
|
47
|
-
),
|
|
41
|
+
return ClientCallDetails(
|
|
42
|
+
method=client_call_details.method,
|
|
43
|
+
timeout=client_call_details.timeout or 60.0,
|
|
44
|
+
metadata=metadata,
|
|
45
|
+
credentials=client_call_details.credentials,
|
|
46
|
+
wait_for_ready=client_call_details.wait_for_ready,
|
|
48
47
|
)
|