temporalio 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +130 -0
- data/bridge/Cargo.lock +2865 -0
- data/bridge/Cargo.toml +26 -0
- data/bridge/sdk-core/ARCHITECTURE.md +76 -0
- data/bridge/sdk-core/Cargo.lock +2606 -0
- data/bridge/sdk-core/Cargo.toml +2 -0
- data/bridge/sdk-core/LICENSE.txt +23 -0
- data/bridge/sdk-core/README.md +107 -0
- data/bridge/sdk-core/arch_docs/diagrams/README.md +10 -0
- data/bridge/sdk-core/arch_docs/diagrams/sticky_queues.puml +40 -0
- data/bridge/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
- data/bridge/sdk-core/arch_docs/sticky_queues.md +51 -0
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +24 -0
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- data/bridge/sdk-core/bridge-ffi/build.rs +25 -0
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +249 -0
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +825 -0
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +211 -0
- data/bridge/sdk-core/client/Cargo.toml +40 -0
- data/bridge/sdk-core/client/LICENSE.txt +23 -0
- data/bridge/sdk-core/client/src/lib.rs +1294 -0
- data/bridge/sdk-core/client/src/metrics.rs +165 -0
- data/bridge/sdk-core/client/src/raw.rs +931 -0
- data/bridge/sdk-core/client/src/retry.rs +674 -0
- data/bridge/sdk-core/client/src/workflow_handle/mod.rs +185 -0
- data/bridge/sdk-core/core/Cargo.toml +116 -0
- data/bridge/sdk-core/core/LICENSE.txt +23 -0
- data/bridge/sdk-core/core/benches/workflow_replay.rs +73 -0
- data/bridge/sdk-core/core/src/abstractions.rs +166 -0
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +911 -0
- data/bridge/sdk-core/core/src/core_tests/child_workflows.rs +221 -0
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +107 -0
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +515 -0
- data/bridge/sdk-core/core/src/core_tests/mod.rs +100 -0
- data/bridge/sdk-core/core/src/core_tests/queries.rs +736 -0
- data/bridge/sdk-core/core/src/core_tests/replay_flag.rs +65 -0
- data/bridge/sdk-core/core/src/core_tests/workers.rs +259 -0
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +124 -0
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +2070 -0
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +515 -0
- data/bridge/sdk-core/core/src/lib.rs +175 -0
- data/bridge/sdk-core/core/src/log_export.rs +62 -0
- data/bridge/sdk-core/core/src/pollers/mod.rs +54 -0
- data/bridge/sdk-core/core/src/pollers/poll_buffer.rs +297 -0
- data/bridge/sdk-core/core/src/protosext/mod.rs +428 -0
- data/bridge/sdk-core/core/src/replay/mod.rs +71 -0
- data/bridge/sdk-core/core/src/retry_logic.rs +202 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +383 -0
- data/bridge/sdk-core/core/src/telemetry/mod.rs +412 -0
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +77 -0
- data/bridge/sdk-core/core/src/test_help/mod.rs +875 -0
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +580 -0
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +1042 -0
- data/bridge/sdk-core/core/src/worker/activities.rs +464 -0
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +87 -0
- data/bridge/sdk-core/core/src/worker/client.rs +347 -0
- data/bridge/sdk-core/core/src/worker/mod.rs +566 -0
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +37 -0
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +110 -0
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +458 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +911 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +298 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +171 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +860 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +140 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +161 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +133 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +1448 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +342 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +127 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +712 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +71 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +443 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +439 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +169 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +246 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +96 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +1184 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +277 -0
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +647 -0
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +1143 -0
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +145 -0
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +940 -0
- data/bridge/sdk-core/core-api/Cargo.toml +31 -0
- data/bridge/sdk-core/core-api/LICENSE.txt +23 -0
- data/bridge/sdk-core/core-api/src/errors.rs +95 -0
- data/bridge/sdk-core/core-api/src/lib.rs +151 -0
- data/bridge/sdk-core/core-api/src/worker.rs +135 -0
- data/bridge/sdk-core/etc/deps.svg +187 -0
- data/bridge/sdk-core/etc/dynamic-config.yaml +2 -0
- data/bridge/sdk-core/etc/otel-collector-config.yaml +36 -0
- data/bridge/sdk-core/etc/prometheus.yaml +6 -0
- data/bridge/sdk-core/fsm/Cargo.toml +18 -0
- data/bridge/sdk-core/fsm/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/README.md +3 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +27 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +647 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +8 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.rs +18 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +12 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dynamic_dest_pass.rs +41 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.rs +14 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.stderr +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_arg_pass.rs +32 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_pass.rs +31 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/medium_complex_pass.rs +46 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.rs +29 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +12 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/simple_pass.rs +32 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.rs +18 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.rs +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.rs +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/Cargo.toml +14 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +249 -0
- data/bridge/sdk-core/fsm/src/lib.rs +2 -0
- data/bridge/sdk-core/histories/fail_wf_task.bin +0 -0
- data/bridge/sdk-core/histories/timer_workflow_history.bin +0 -0
- data/bridge/sdk-core/integ-with-otel.sh +7 -0
- data/bridge/sdk-core/protos/api_upstream/README.md +9 -0
- data/bridge/sdk-core/protos/api_upstream/api-linter.yaml +40 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +12 -0
- data/bridge/sdk-core/protos/api_upstream/dependencies/gogoproto/gogo.proto +141 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +86 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +259 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +112 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +46 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +57 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +55 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +168 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +97 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +51 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +50 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +41 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +59 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +51 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +122 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +108 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +114 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +56 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +751 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +97 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +161 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +99 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +61 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +55 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +108 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +46 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +59 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +145 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +1124 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +401 -0
- data/bridge/sdk-core/protos/grpc/health/v1/health.proto +63 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +79 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +210 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +77 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +15 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +30 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +261 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +297 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +29 -0
- data/bridge/sdk-core/protos/testsrv_upstream/api-linter.yaml +38 -0
- data/bridge/sdk-core/protos/testsrv_upstream/buf.yaml +13 -0
- data/bridge/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +141 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +63 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +90 -0
- data/bridge/sdk-core/rustfmt.toml +1 -0
- data/bridge/sdk-core/sdk/Cargo.toml +47 -0
- data/bridge/sdk-core/sdk/LICENSE.txt +23 -0
- data/bridge/sdk-core/sdk/src/activity_context.rs +230 -0
- data/bridge/sdk-core/sdk/src/app_data.rs +37 -0
- data/bridge/sdk-core/sdk/src/conversions.rs +8 -0
- data/bridge/sdk-core/sdk/src/interceptors.rs +17 -0
- data/bridge/sdk-core/sdk/src/lib.rs +792 -0
- data/bridge/sdk-core/sdk/src/payload_converter.rs +11 -0
- data/bridge/sdk-core/sdk/src/workflow_context/options.rs +295 -0
- data/bridge/sdk-core/sdk/src/workflow_context.rs +683 -0
- data/bridge/sdk-core/sdk/src/workflow_future.rs +503 -0
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +30 -0
- data/bridge/sdk-core/sdk-core-protos/LICENSE.txt +23 -0
- data/bridge/sdk-core/sdk-core-protos/build.rs +108 -0
- data/bridge/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +497 -0
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +230 -0
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +1910 -0
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- data/bridge/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- data/bridge/sdk-core/test-utils/Cargo.toml +35 -0
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +1579 -0
- data/bridge/sdk-core/test-utils/src/histfetch.rs +28 -0
- data/bridge/sdk-core/test-utils/src/lib.rs +598 -0
- data/bridge/sdk-core/tests/integ_tests/client_tests.rs +36 -0
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +128 -0
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +218 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +146 -0
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +437 -0
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +93 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +878 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +59 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +58 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +50 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +60 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +54 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +634 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +113 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +137 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +93 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +167 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +99 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +131 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +75 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +587 -0
- data/bridge/sdk-core/tests/load_tests.rs +191 -0
- data/bridge/sdk-core/tests/main.rs +111 -0
- data/bridge/sdk-core/tests/runner.rs +93 -0
- data/bridge/src/connection.rs +167 -0
- data/bridge/src/lib.rs +180 -0
- data/bridge/src/runtime.rs +47 -0
- data/bridge/src/worker.rs +73 -0
- data/ext/Rakefile +9 -0
- data/lib/bridge.so +0 -0
- data/lib/gen/dependencies/gogoproto/gogo_pb.rb +14 -0
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +48 -0
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +67 -0
- data/lib/gen/temporal/api/command/v1/message_pb.rb +166 -0
- data/lib/gen/temporal/api/common/v1/message_pb.rb +69 -0
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +32 -0
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +26 -0
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +37 -0
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +41 -0
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +67 -0
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +71 -0
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +37 -0
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +31 -0
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +24 -0
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +28 -0
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +30 -0
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +28 -0
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +89 -0
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +84 -0
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +83 -0
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +40 -0
- data/lib/gen/temporal/api/history/v1/message_pb.rb +489 -0
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +63 -0
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +125 -0
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +20 -0
- data/lib/gen/temporal/api/query/v1/message_pb.rb +38 -0
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +37 -0
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +128 -0
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +73 -0
- data/lib/gen/temporal/api/update/v1/message_pb.rb +26 -0
- data/lib/gen/temporal/api/version/v1/message_pb.rb +41 -0
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +110 -0
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +771 -0
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +20 -0
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +58 -0
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +57 -0
- data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +222 -0
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +57 -0
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +22 -0
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +34 -0
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +27 -0
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +164 -0
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +192 -0
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +34 -0
- data/lib/temporal/bridge.rb +14 -0
- data/lib/temporal/client/implementation.rb +339 -0
- data/lib/temporal/client/workflow_handle.rb +243 -0
- data/lib/temporal/client.rb +144 -0
- data/lib/temporal/connection.rb +736 -0
- data/lib/temporal/data_converter.rb +150 -0
- data/lib/temporal/error/failure.rb +194 -0
- data/lib/temporal/error/workflow_failure.rb +17 -0
- data/lib/temporal/errors.rb +22 -0
- data/lib/temporal/failure_converter/base.rb +26 -0
- data/lib/temporal/failure_converter/basic.rb +313 -0
- data/lib/temporal/failure_converter.rb +8 -0
- data/lib/temporal/interceptor/chain.rb +27 -0
- data/lib/temporal/interceptor/client.rb +102 -0
- data/lib/temporal/payload_codec/base.rb +32 -0
- data/lib/temporal/payload_converter/base.rb +24 -0
- data/lib/temporal/payload_converter/bytes.rb +26 -0
- data/lib/temporal/payload_converter/composite.rb +47 -0
- data/lib/temporal/payload_converter/encoding_base.rb +35 -0
- data/lib/temporal/payload_converter/json.rb +25 -0
- data/lib/temporal/payload_converter/nil.rb +25 -0
- data/lib/temporal/payload_converter.rb +14 -0
- data/lib/temporal/retry_policy.rb +82 -0
- data/lib/temporal/retry_state.rb +35 -0
- data/lib/temporal/runtime.rb +22 -0
- data/lib/temporal/timeout_type.rb +29 -0
- data/lib/temporal/version.rb +1 -1
- data/lib/temporal/workflow/execution_info.rb +54 -0
- data/lib/temporal/workflow/execution_status.rb +36 -0
- data/lib/temporal/workflow/id_reuse_policy.rb +36 -0
- data/lib/temporal/workflow/query_reject_condition.rb +33 -0
- data/lib/temporal.rb +4 -0
- data/lib/temporalio.rb +3 -1
- data/lib/thermite_patch.rb +23 -0
- data/temporalio.gemspec +41 -0
- metadata +543 -9
- data/temporal.gemspec +0 -20
@@ -0,0 +1,31 @@
|
|
1
|
+
[package]
|
2
|
+
name = "temporal-sdk-core-api"
|
3
|
+
version = "0.1.0"
|
4
|
+
edition = "2021"
|
5
|
+
authors = ["Spencer Judge <spencer@temporal.io>"]
|
6
|
+
license-file = "LICENSE.txt"
|
7
|
+
description = "Interface definitions for the Temporal Core SDK"
|
8
|
+
homepage = "https://temporal.io/"
|
9
|
+
repository = "https://github.com/temporalio/sdk-core"
|
10
|
+
keywords = ["temporal", "workflow"]
|
11
|
+
categories = ["development-tools"]
|
12
|
+
|
13
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
14
|
+
|
15
|
+
[dependencies]
|
16
|
+
anyhow = "1.0"
|
17
|
+
async-trait = "0.1"
|
18
|
+
derive_builder = "0.11"
|
19
|
+
log = "0.4"
|
20
|
+
opentelemetry = "0.18"
|
21
|
+
prost-types = "0.11"
|
22
|
+
thiserror = "1.0"
|
23
|
+
tonic = "0.8"
|
24
|
+
|
25
|
+
[dependencies.temporal-sdk-core-protos]
|
26
|
+
path = "../sdk-core-protos"
|
27
|
+
version = "0.1"
|
28
|
+
|
29
|
+
[dependencies.temporal-client]
|
30
|
+
path = "../client"
|
31
|
+
version = "0.1"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Temporal Core SDK
|
2
|
+
|
3
|
+
The MIT License
|
4
|
+
|
5
|
+
Copyright (c) 2021 Temporal Technologies, Inc. All Rights Reserved
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in all
|
15
|
+
copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
23
|
+
SOFTWARE.
|
@@ -0,0 +1,95 @@
|
|
1
|
+
//! Error types exposed by public APIs
|
2
|
+
|
3
|
+
use prost_types::TimestampError;
|
4
|
+
use temporal_sdk_core_protos::coresdk::{
|
5
|
+
activity_result::ActivityExecutionResult,
|
6
|
+
workflow_activation::remove_from_cache::EvictionReason,
|
7
|
+
};
|
8
|
+
|
9
|
+
/// Errors thrown by [crate::Worker::poll_workflow_activation]
|
10
|
+
#[derive(thiserror::Error, Debug)]
|
11
|
+
pub enum PollWfError {
|
12
|
+
/// [crate::Worker::shutdown] was called, and there are no more replay tasks to be handled. Lang
|
13
|
+
/// must call [crate::Worker::complete_workflow_activation] for any remaining tasks, and then may
|
14
|
+
/// exit.
|
15
|
+
#[error("Core is shut down and there are no more workflow replay tasks")]
|
16
|
+
ShutDown,
|
17
|
+
/// Unhandled error when calling the temporal server. Core will attempt to retry any non-fatal
|
18
|
+
/// errors, so lang should consider this fatal.
|
19
|
+
#[error("Unhandled grpc error when workflow polling: {0:?}")]
|
20
|
+
TonicError(#[from] tonic::Status),
|
21
|
+
/// Unhandled error when completing a workflow during a poll -- this can happen when there is no
|
22
|
+
/// work for lang to perform, but the server sent us a workflow task (EX: An activity completed
|
23
|
+
/// even though we already cancelled it)
|
24
|
+
#[error("Unhandled error when auto-completing workflow task: {0:?}")]
|
25
|
+
AutocompleteError(#[from] CompleteWfError),
|
26
|
+
}
|
27
|
+
|
28
|
+
/// Errors thrown by [crate::Worker::poll_activity_task]
|
29
|
+
#[derive(thiserror::Error, Debug)]
|
30
|
+
pub enum PollActivityError {
|
31
|
+
/// [crate::Worker::shutdown] was called, we will no longer fetch new activity tasks. Lang must
|
32
|
+
/// ensure it is finished with any workflow replay, see [PollWfError::ShutDown]
|
33
|
+
#[error("Core is shut down")]
|
34
|
+
ShutDown,
|
35
|
+
/// Unhandled error when calling the temporal server. Core will attempt to retry any non-fatal
|
36
|
+
/// errors, so lang should consider this fatal.
|
37
|
+
#[error("Unhandled grpc error when activity polling: {0:?}")]
|
38
|
+
TonicError(#[from] tonic::Status),
|
39
|
+
}
|
40
|
+
|
41
|
+
/// Errors thrown by [crate::Worker::complete_workflow_activation]
|
42
|
+
#[derive(thiserror::Error, Debug)]
|
43
|
+
#[allow(clippy::large_enum_variant)]
|
44
|
+
pub enum CompleteWfError {
|
45
|
+
/// Lang SDK sent us a malformed workflow completion. This likely means a bug in the lang sdk.
|
46
|
+
#[error("Lang SDK sent us a malformed workflow completion for run ({run_id}): {reason}")]
|
47
|
+
MalformedWorkflowCompletion {
|
48
|
+
/// Reason the completion was malformed
|
49
|
+
reason: String,
|
50
|
+
/// The run associated with the completion
|
51
|
+
run_id: String,
|
52
|
+
},
|
53
|
+
}
|
54
|
+
|
55
|
+
/// Errors thrown by [crate::Worker::complete_activity_task]
|
56
|
+
#[derive(thiserror::Error, Debug)]
|
57
|
+
pub enum CompleteActivityError {
|
58
|
+
/// Lang SDK sent us a malformed activity completion. This likely means a bug in the lang sdk.
|
59
|
+
#[error("Lang SDK sent us a malformed activity completion ({reason}): {completion:?}")]
|
60
|
+
MalformedActivityCompletion {
|
61
|
+
/// Reason the completion was malformed
|
62
|
+
reason: String,
|
63
|
+
/// The completion, which may not be included to avoid unnecessary copies.
|
64
|
+
completion: Option<ActivityExecutionResult>,
|
65
|
+
},
|
66
|
+
}
|
67
|
+
|
68
|
+
/// Errors thrown inside of workflow machines
|
69
|
+
#[derive(thiserror::Error, Debug)]
|
70
|
+
pub enum WFMachinesError {
|
71
|
+
#[error("Nondeterminism error: {0}")]
|
72
|
+
Nondeterminism(String),
|
73
|
+
#[error("Fatal error in workflow machines: {0}")]
|
74
|
+
Fatal(String),
|
75
|
+
|
76
|
+
#[error("Unrecoverable network error while fetching history: {0}")]
|
77
|
+
HistoryFetchingError(tonic::Status),
|
78
|
+
}
|
79
|
+
|
80
|
+
impl WFMachinesError {
|
81
|
+
pub fn evict_reason(&self) -> EvictionReason {
|
82
|
+
match self {
|
83
|
+
WFMachinesError::Nondeterminism(_) => EvictionReason::Nondeterminism,
|
84
|
+
WFMachinesError::Fatal(_) | WFMachinesError::HistoryFetchingError(_) => {
|
85
|
+
EvictionReason::Fatal
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
}
|
90
|
+
|
91
|
+
impl From<TimestampError> for WFMachinesError {
|
92
|
+
fn from(_: TimestampError) -> Self {
|
93
|
+
Self::Fatal("Could not decode timestamp".to_string())
|
94
|
+
}
|
95
|
+
}
|
@@ -0,0 +1,151 @@
|
|
1
|
+
pub mod errors;
|
2
|
+
pub mod worker;
|
3
|
+
|
4
|
+
use crate::{
|
5
|
+
errors::{CompleteActivityError, CompleteWfError, PollActivityError, PollWfError},
|
6
|
+
worker::WorkerConfig,
|
7
|
+
};
|
8
|
+
use log::Level;
|
9
|
+
use opentelemetry::metrics::Meter;
|
10
|
+
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
11
|
+
use temporal_sdk_core_protos::coresdk::{
|
12
|
+
activity_task::ActivityTask, workflow_activation::WorkflowActivation,
|
13
|
+
workflow_completion::WorkflowActivationCompletion, ActivityHeartbeat, ActivityTaskCompletion,
|
14
|
+
};
|
15
|
+
|
16
|
+
/// This trait is the primary way by which language specific SDKs interact with the core SDK.
|
17
|
+
/// It represents one worker, which has a (potentially shared) client for connecting to the service
|
18
|
+
/// and is bound to a specific task queue.
|
19
|
+
#[async_trait::async_trait]
|
20
|
+
pub trait Worker: Send + Sync {
|
21
|
+
/// Ask the worker for some work, returning a [WorkflowActivation]. It is then the language
|
22
|
+
/// SDK's responsibility to call the appropriate workflow code with the provided inputs. Blocks
|
23
|
+
/// indefinitely until such work is available or [Worker::shutdown] is called.
|
24
|
+
///
|
25
|
+
/// It is important to understand that all activations must be responded to. There can only
|
26
|
+
/// be one outstanding activation for a particular run of a workflow at any time. If an
|
27
|
+
/// activation is not responded to, it will cause that workflow to become stuck forever.
|
28
|
+
///
|
29
|
+
/// Activations that contain only a `remove_from_cache` job should not cause the workflow code
|
30
|
+
/// to be invoked and may be responded to with an empty command list. Eviction jobs may also
|
31
|
+
/// appear with other jobs, but will always appear last in the job list. In this case it is
|
32
|
+
/// expected that the workflow code will be invoked, and the response produced as normal, but
|
33
|
+
/// the caller should evict the run after doing so.
|
34
|
+
///
|
35
|
+
/// It is rarely a good idea to call poll concurrently. It handles polling the server
|
36
|
+
/// concurrently internally.
|
37
|
+
async fn poll_workflow_activation(&self) -> Result<WorkflowActivation, PollWfError>;
|
38
|
+
|
39
|
+
/// Ask the worker for some work, returning an [ActivityTask]. It is then the language SDK's
|
40
|
+
/// responsibility to call the appropriate activity code with the provided inputs. Blocks
|
41
|
+
/// indefinitely until such work is available or [Worker::shutdown] is called.
|
42
|
+
///
|
43
|
+
/// The returned activation is guaranteed to be for the same task queue / worker which was
|
44
|
+
/// provided as the `task_queue` argument.
|
45
|
+
///
|
46
|
+
/// It is rarely a good idea to call poll concurrently. It handles polling the server
|
47
|
+
/// concurrently internally.
|
48
|
+
async fn poll_activity_task(&self) -> Result<ActivityTask, PollActivityError>;
|
49
|
+
|
50
|
+
/// Tell the worker that a workflow activation has completed. May be freely called concurrently.
|
51
|
+
async fn complete_workflow_activation(
|
52
|
+
&self,
|
53
|
+
completion: WorkflowActivationCompletion,
|
54
|
+
) -> Result<(), CompleteWfError>;
|
55
|
+
|
56
|
+
/// Tell the worker that an activity has finished executing. May be freely called concurrently.
|
57
|
+
async fn complete_activity_task(
|
58
|
+
&self,
|
59
|
+
completion: ActivityTaskCompletion,
|
60
|
+
) -> Result<(), CompleteActivityError>;
|
61
|
+
|
62
|
+
/// Notify the Temporal service that an activity is still alive. Long running activities that
|
63
|
+
/// take longer than `activity_heartbeat_timeout` to finish must call this function in order to
|
64
|
+
/// report progress, otherwise the activity will timeout and a new attempt will be scheduled.
|
65
|
+
///
|
66
|
+
/// The first heartbeat request will be sent immediately, subsequent rapid calls to this
|
67
|
+
/// function will result in heartbeat requests being aggregated and the last one received during
|
68
|
+
/// the aggregation period will be sent to the server, where that period is defined as half the
|
69
|
+
/// heartbeat timeout.
|
70
|
+
///
|
71
|
+
/// Unlike Java/Go SDKs we do not return cancellation status as part of heartbeat response and
|
72
|
+
/// instead send it as a separate activity task to the lang, decoupling heartbeat and
|
73
|
+
/// cancellation processing.
|
74
|
+
///
|
75
|
+
/// For now activity still need to send heartbeats if they want to receive cancellation
|
76
|
+
/// requests. In the future we will change this and will dispatch cancellations more
|
77
|
+
/// proactively. Note that this function does not block on the server call and returns
|
78
|
+
/// immediately. Underlying validation errors are swallowed and logged, this has been agreed to
|
79
|
+
/// be optimal behavior for the user as we don't want to break activity execution due to badly
|
80
|
+
/// configured heartbeat options.
|
81
|
+
fn record_activity_heartbeat(&self, details: ActivityHeartbeat);
|
82
|
+
|
83
|
+
/// Request that a workflow be evicted by its run id. This will generate a workflow activation
|
84
|
+
/// with the eviction job inside it to be eventually returned by
|
85
|
+
/// [Worker::poll_workflow_activation]. If the workflow had any existing outstanding activations,
|
86
|
+
/// such activations are invalidated and subsequent completions of them will do nothing and log
|
87
|
+
/// a warning.
|
88
|
+
fn request_workflow_eviction(&self, run_id: &str);
|
89
|
+
|
90
|
+
/// Return this worker's config
|
91
|
+
fn get_config(&self) -> &WorkerConfig;
|
92
|
+
|
93
|
+
/// Initiate shutdown. See [Worker::shutdown], this is just a sync version that starts the
|
94
|
+
/// process. You can then wait on `shutdown` or [Worker::finalize_shutdown].
|
95
|
+
fn initiate_shutdown(&self);
|
96
|
+
|
97
|
+
/// Initiates async shutdown procedure, eventually ceases all polling of the server and shuts
|
98
|
+
/// down this worker. [Worker::poll_workflow_activation] should be called until it
|
99
|
+
/// returns [PollWfError::ShutDown] to ensure that any workflows which are still undergoing
|
100
|
+
/// replay have an opportunity to finish. This means that the lang sdk will need to call
|
101
|
+
/// [Worker::complete_workflow_activation] for those workflows until they are done. At that point,
|
102
|
+
/// the lang SDK can end the process, or drop the [Worker] instance, which will close the
|
103
|
+
/// connection.
|
104
|
+
async fn shutdown(&self);
|
105
|
+
|
106
|
+
/// Completes shutdown and frees all resources. You should avoid simply dropping workers, as
|
107
|
+
/// this does not allow async tasks to report any panics that may have occurred cleanly.
|
108
|
+
///
|
109
|
+
/// This should be called only after [Worker::shutdown] has resolved.
|
110
|
+
async fn finalize_shutdown(self);
|
111
|
+
}
|
112
|
+
|
113
|
+
/// Should be backed by a process-wide singleton who is responsible for telemetry and logging
|
114
|
+
/// management.
|
115
|
+
pub trait CoreTelemetry {
|
116
|
+
/// Core buffers logs that should be shuttled over to lang so that they may be rendered with
|
117
|
+
/// the user's desired logging library. Use this function to grab the most recent buffered logs
|
118
|
+
/// since the last time it was called. A fixed number of such logs are retained at maximum, with
|
119
|
+
/// the oldest being dropped when full.
|
120
|
+
///
|
121
|
+
/// Returns the list of logs from oldest to newest. Returns an empty vec if the feature is not
|
122
|
+
/// configured.
|
123
|
+
fn fetch_buffered_logs(&self) -> Vec<CoreLog>;
|
124
|
+
|
125
|
+
/// If metrics gathering is enabled, returns the OTel meter for core telemetry, which can be
|
126
|
+
/// used to create metrics instruments, or passed to things that create/record metrics (ex:
|
127
|
+
/// clients).
|
128
|
+
fn get_metric_meter(&self) -> Option<&Meter>;
|
129
|
+
}
|
130
|
+
|
131
|
+
/// A log line (which ultimately came from a tracing event) exported from Core->Lang
|
132
|
+
#[derive(Debug)]
|
133
|
+
pub struct CoreLog {
|
134
|
+
/// Log message
|
135
|
+
pub message: String,
|
136
|
+
/// Time log was generated (not when it was exported to lang)
|
137
|
+
pub timestamp: SystemTime,
|
138
|
+
/// Message level
|
139
|
+
pub level: Level,
|
140
|
+
// KV pairs aren't meaningfully exposed yet to the log interface by tracing
|
141
|
+
}
|
142
|
+
|
143
|
+
impl CoreLog {
|
144
|
+
/// Return timestamp as ms since epoch
|
145
|
+
pub fn millis_since_epoch(&self) -> u128 {
|
146
|
+
self.timestamp
|
147
|
+
.duration_since(UNIX_EPOCH)
|
148
|
+
.unwrap_or(Duration::ZERO)
|
149
|
+
.as_millis()
|
150
|
+
}
|
151
|
+
}
|
@@ -0,0 +1,135 @@
|
|
1
|
+
use std::time::Duration;
|
2
|
+
|
3
|
+
/// Defines per-worker configuration options
|
4
|
+
#[derive(Debug, Clone, derive_builder::Builder)]
|
5
|
+
#[builder(setter(into), build_fn(validate = "Self::validate"))]
|
6
|
+
#[non_exhaustive]
|
7
|
+
pub struct WorkerConfig {
|
8
|
+
/// The Temporal service namespace this worker is bound to
|
9
|
+
pub namespace: String,
|
10
|
+
/// What task queue will this worker poll from? This task queue name will be used for both
|
11
|
+
/// workflow and activity polling.
|
12
|
+
pub task_queue: String,
|
13
|
+
/// A string that should be unique to the set of code this worker uses. IE: All the workflow,
|
14
|
+
/// activity, interceptor, and data converter code.
|
15
|
+
pub worker_build_id: String,
|
16
|
+
/// A human-readable string that can identify this worker. Using something like sdk version
|
17
|
+
/// and host name is a good default. If set, overrides the identity set (if any) on the client
|
18
|
+
/// used by this worker.
|
19
|
+
#[builder(default)]
|
20
|
+
pub client_identity_override: Option<String>,
|
21
|
+
/// If set nonzero, workflows will be cached and sticky task queues will be used, meaning that
|
22
|
+
/// history updates are applied incrementally to suspended instances of workflow execution.
|
23
|
+
/// Workflows are evicted according to a least-recently-used policy one the cache maximum is
|
24
|
+
/// reached. Workflows may also be explicitly evicted at any time, or as a result of errors
|
25
|
+
/// or failures.
|
26
|
+
#[builder(default = "0")]
|
27
|
+
pub max_cached_workflows: usize,
|
28
|
+
/// The maximum allowed number of workflow tasks that will ever be given to this worker at one
|
29
|
+
/// time. Note that one workflow task may require multiple activations - so the WFT counts as
|
30
|
+
/// "outstanding" until all activations it requires have been completed.
|
31
|
+
///
|
32
|
+
/// Cannot be larger than `max_cached_workflows`.
|
33
|
+
#[builder(default = "100")]
|
34
|
+
pub max_outstanding_workflow_tasks: usize,
|
35
|
+
/// The maximum number of activity tasks that will ever be given to this worker concurrently
|
36
|
+
#[builder(default = "100")]
|
37
|
+
pub max_outstanding_activities: usize,
|
38
|
+
/// The maximum number of local activity tasks that will ever be given to this worker
|
39
|
+
/// concurrently
|
40
|
+
#[builder(default = "100")]
|
41
|
+
pub max_outstanding_local_activities: usize,
|
42
|
+
/// Maximum number of concurrent poll workflow task requests we will perform at a time on this
|
43
|
+
/// worker's task queue. See also [WorkerConfig::nonsticky_to_sticky_poll_ratio]. Must be at
|
44
|
+
/// least 1.
|
45
|
+
#[builder(default = "5")]
|
46
|
+
pub max_concurrent_wft_polls: usize,
|
47
|
+
/// [WorkerConfig::max_concurrent_wft_polls] * this number = the number of max pollers that will
|
48
|
+
/// be allowed for the nonsticky queue when sticky tasks are enabled. If both defaults are used,
|
49
|
+
/// the sticky queue will allow 4 max pollers while the nonsticky queue will allow one. The
|
50
|
+
/// minimum for either poller is 1, so if `max_concurrent_wft_polls` is 1 and sticky queues are
|
51
|
+
/// enabled, there will be 2 concurrent polls.
|
52
|
+
#[builder(default = "0.2")]
|
53
|
+
pub nonsticky_to_sticky_poll_ratio: f32,
|
54
|
+
/// Maximum number of concurrent poll activity task requests we will perform at a time on this
|
55
|
+
/// worker's task queue
|
56
|
+
#[builder(default = "5")]
|
57
|
+
pub max_concurrent_at_polls: usize,
|
58
|
+
/// If set to true this worker will only handle workflow tasks and local activities, it will not
|
59
|
+
/// poll for activity tasks.
|
60
|
+
#[builder(default = "false")]
|
61
|
+
pub no_remote_activities: bool,
|
62
|
+
/// How long a workflow task is allowed to sit on the sticky queue before it is timed out
|
63
|
+
/// and moved to the non-sticky queue where it may be picked up by any worker.
|
64
|
+
#[builder(default = "Duration::from_secs(10)")]
|
65
|
+
pub sticky_queue_schedule_to_start_timeout: Duration,
|
66
|
+
|
67
|
+
/// Longest interval for throttling activity heartbeats
|
68
|
+
#[builder(default = "Duration::from_secs(60)")]
|
69
|
+
pub max_heartbeat_throttle_interval: Duration,
|
70
|
+
|
71
|
+
/// Default interval for throttling activity heartbeats in case
|
72
|
+
/// `ActivityOptions.heartbeat_timeout` is unset.
|
73
|
+
/// When the timeout *is* set in the `ActivityOptions`, throttling is set to
|
74
|
+
/// `heartbeat_timeout * 0.8`.
|
75
|
+
#[builder(default = "Duration::from_secs(30)")]
|
76
|
+
pub default_heartbeat_throttle_interval: Duration,
|
77
|
+
|
78
|
+
/// Sets the maximum number of activities per second the task queue will dispatch, controlled
|
79
|
+
/// server-side. Note that this only takes effect upon an activity poll request. If multiple
|
80
|
+
/// workers on the same queue have different values set, they will thrash with the last poller
|
81
|
+
/// winning.
|
82
|
+
#[builder(default)]
|
83
|
+
pub max_task_queue_activities_per_second: Option<f64>,
|
84
|
+
|
85
|
+
/// Limits the number of activities per second that this worker will process. The worker will
|
86
|
+
/// not poll for new activities if by doing so it might receive and execute an activity which
|
87
|
+
/// would cause it to exceed this limit. Negative, zero, or NaN values will cause building
|
88
|
+
/// the options to fail.
|
89
|
+
#[builder(default)]
|
90
|
+
pub max_worker_activities_per_second: Option<f64>,
|
91
|
+
|
92
|
+
/// # UNDER DEVELOPMENT
|
93
|
+
/// If set to true this worker will opt-in to the whole-worker versioning feature.
|
94
|
+
/// `worker_build_id` will be used as the version.
|
95
|
+
/// todo: link to feature docs
|
96
|
+
#[builder(default = "false")]
|
97
|
+
pub use_worker_versioning: bool,
|
98
|
+
}
|
99
|
+
|
100
|
+
impl WorkerConfig {
|
101
|
+
pub fn max_nonsticky_polls(&self) -> usize {
|
102
|
+
((self.max_concurrent_wft_polls as f32 * self.nonsticky_to_sticky_poll_ratio) as usize)
|
103
|
+
.max(1)
|
104
|
+
}
|
105
|
+
pub fn max_sticky_polls(&self) -> usize {
|
106
|
+
self.max_concurrent_wft_polls
|
107
|
+
.saturating_sub(self.max_nonsticky_polls())
|
108
|
+
.max(1)
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
impl WorkerConfigBuilder {
|
113
|
+
fn validate(&self) -> Result<(), String> {
|
114
|
+
if self.max_concurrent_wft_polls == Some(0) {
|
115
|
+
return Err("`max_concurrent_wft_polls` must be at least 1".to_owned());
|
116
|
+
}
|
117
|
+
if self.max_cached_workflows > Some(0)
|
118
|
+
&& self.max_outstanding_workflow_tasks > self.max_cached_workflows
|
119
|
+
{
|
120
|
+
return Err(
|
121
|
+
"Maximum concurrent workflow tasks cannot exceed the maximum number of cached \
|
122
|
+
workflows"
|
123
|
+
.to_owned(),
|
124
|
+
);
|
125
|
+
}
|
126
|
+
if let Some(Some(ref x)) = self.max_worker_activities_per_second {
|
127
|
+
if !x.is_normal() || x.is_sign_negative() {
|
128
|
+
return Err(
|
129
|
+
"`max_worker_activities_per_second` must be positive and nonzero".to_owned(),
|
130
|
+
);
|
131
|
+
}
|
132
|
+
}
|
133
|
+
Ok(())
|
134
|
+
}
|
135
|
+
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
4
|
+
<!-- Generated by graphviz version 2.43.0 (0)
|
5
|
+
-->
|
6
|
+
<!-- Title: %3 Pages: 1 -->
|
7
|
+
<svg width="525pt" height="476pt"
|
8
|
+
viewBox="0.00 0.00 524.50 476.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
9
|
+
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 472)">
|
10
|
+
<title>%3</title>
|
11
|
+
<polygon fill="white" stroke="transparent" points="-4,4 -4,-472 520.5,-472 520.5,4 -4,4"/>
|
12
|
+
<!-- 0 -->
|
13
|
+
<g id="node1" class="node">
|
14
|
+
<title>0</title>
|
15
|
+
<polygon fill="none" stroke="black" points="173,-468 0,-468 0,-432 173,-432 173,-468"/>
|
16
|
+
<text text-anchor="middle" x="86.5" y="-446.3" font-family="Times,serif" font-size="14.00">temporal-sdk-core-bridge-ffi</text>
|
17
|
+
</g>
|
18
|
+
<!-- 1 -->
|
19
|
+
<g id="node2" class="node">
|
20
|
+
<title>1</title>
|
21
|
+
<polygon fill="none" stroke="black" points="369.5,-396 253.5,-396 253.5,-360 369.5,-360 369.5,-396"/>
|
22
|
+
<text text-anchor="middle" x="311.5" y="-374.3" font-family="Times,serif" font-size="14.00">temporal-sdk-core</text>
|
23
|
+
</g>
|
24
|
+
<!-- 0->1 -->
|
25
|
+
<g id="edge1" class="edge">
|
26
|
+
<title>0->1</title>
|
27
|
+
<path fill="none" stroke="black" d="M141.25,-431.97C173.1,-422.06 213.42,-409.51 246.83,-399.12"/>
|
28
|
+
<polygon fill="black" stroke="black" points="247.99,-402.42 256.5,-396.11 245.91,-395.74 247.99,-402.42"/>
|
29
|
+
</g>
|
30
|
+
<!-- 6 -->
|
31
|
+
<g id="node5" class="node">
|
32
|
+
<title>6</title>
|
33
|
+
<polygon fill="none" stroke="black" points="401,-36 246,-36 246,0 401,0 401,-36"/>
|
34
|
+
<text text-anchor="middle" x="323.5" y="-14.3" font-family="Times,serif" font-size="14.00">temporal-sdk-core-protos</text>
|
35
|
+
</g>
|
36
|
+
<!-- 0->6 -->
|
37
|
+
<g id="edge3" class="edge">
|
38
|
+
<title>0->6</title>
|
39
|
+
<path fill="none" stroke="black" d="M78.81,-431.91C67.71,-405.62 48.5,-353.45 48.5,-307 48.5,-307 48.5,-307 48.5,-161 48.5,-75.33 155.16,-41.29 235.63,-27.8"/>
|
40
|
+
<polygon fill="black" stroke="black" points="236.47,-31.21 245.8,-26.18 235.37,-24.3 236.47,-31.21"/>
|
41
|
+
</g>
|
42
|
+
<!-- 7 -->
|
43
|
+
<g id="node6" class="node">
|
44
|
+
<title>7</title>
|
45
|
+
<polygon fill="none" stroke="black" points="266,-180 129,-180 129,-144 266,-144 266,-180"/>
|
46
|
+
<text text-anchor="middle" x="197.5" y="-158.3" font-family="Times,serif" font-size="14.00">temporal-sdk-core-api</text>
|
47
|
+
</g>
|
48
|
+
<!-- 0->7 -->
|
49
|
+
<g id="edge2" class="edge">
|
50
|
+
<title>0->7</title>
|
51
|
+
<path fill="none" stroke="black" d="M85.71,-431.86C84.92,-401.65 85.97,-337.48 105.5,-288 120.88,-249.04 151.5,-211.31 173.18,-187.68"/>
|
52
|
+
<polygon fill="black" stroke="black" points="175.88,-189.92 180.16,-180.23 170.77,-185.14 175.88,-189.92"/>
|
53
|
+
</g>
|
54
|
+
<!-- 2 -->
|
55
|
+
<g id="node3" class="node">
|
56
|
+
<title>2</title>
|
57
|
+
<polygon fill="none" stroke="black" points="172.5,-324 114.5,-324 114.5,-288 172.5,-288 172.5,-324"/>
|
58
|
+
<text text-anchor="middle" x="143.5" y="-302.3" font-family="Times,serif" font-size="14.00">rustfsm</text>
|
59
|
+
</g>
|
60
|
+
<!-- 1->2 -->
|
61
|
+
<g id="edge4" class="edge">
|
62
|
+
<title>1->2</title>
|
63
|
+
<path fill="none" stroke="black" d="M270.4,-359.88C243.41,-348.63 208.34,-334.02 181.91,-323"/>
|
64
|
+
<polygon fill="black" stroke="black" points="183.17,-319.74 172.59,-319.12 180.47,-326.2 183.17,-319.74"/>
|
65
|
+
</g>
|
66
|
+
<!-- 5 -->
|
67
|
+
<g id="node4" class="node">
|
68
|
+
<title>5</title>
|
69
|
+
<polygon fill="none" stroke="black" points="412.5,-108 312.5,-108 312.5,-72 412.5,-72 412.5,-108"/>
|
70
|
+
<text text-anchor="middle" x="362.5" y="-86.3" font-family="Times,serif" font-size="14.00">temporal-client</text>
|
71
|
+
</g>
|
72
|
+
<!-- 1->5 -->
|
73
|
+
<g id="edge5" class="edge">
|
74
|
+
<title>1->5</title>
|
75
|
+
<path fill="none" stroke="black" d="M369.63,-361.71C391.38,-353.54 414.82,-341.45 431.5,-324 455.23,-299.18 453.17,-285.75 459.5,-252 462.45,-236.27 464.68,-231.14 459.5,-216 445.69,-175.67 412.97,-138.29 389.35,-115.12"/>
|
76
|
+
<polygon fill="black" stroke="black" points="391.67,-112.5 382.03,-108.11 386.83,-117.55 391.67,-112.5"/>
|
77
|
+
</g>
|
78
|
+
<!-- 1->6 -->
|
79
|
+
<g id="edge8" class="edge">
|
80
|
+
<title>1->6</title>
|
81
|
+
<path fill="none" stroke="black" d="M369.7,-363.34C430.3,-345.24 516.5,-306.87 516.5,-235 516.5,-235 516.5,-235 516.5,-161 516.5,-98.28 449.55,-60.18 394.51,-39.46"/>
|
82
|
+
<polygon fill="black" stroke="black" points="395.69,-36.16 385.1,-36.04 393.3,-42.74 395.69,-36.16"/>
|
83
|
+
</g>
|
84
|
+
<!-- 1->7 -->
|
85
|
+
<g id="edge7" class="edge">
|
86
|
+
<title>1->7</title>
|
87
|
+
<path fill="none" stroke="black" d="M264.03,-359.96C247.39,-351.64 230.2,-339.91 219.5,-324 192.37,-283.65 191.8,-224.66 194.32,-190.41"/>
|
88
|
+
<polygon fill="black" stroke="black" points="197.83,-190.49 195.22,-180.22 190.86,-189.87 197.83,-190.49"/>
|
89
|
+
</g>
|
90
|
+
<!-- 8 -->
|
91
|
+
<g id="node7" class="node">
|
92
|
+
<title>8</title>
|
93
|
+
<polygon fill="none" stroke="black" points="450,-252 361,-252 361,-216 450,-216 450,-252"/>
|
94
|
+
<text text-anchor="middle" x="405.5" y="-230.3" font-family="Times,serif" font-size="14.00">temporal-sdk</text>
|
95
|
+
</g>
|
96
|
+
<!-- 1->8 -->
|
97
|
+
<g id="edge6" class="edge">
|
98
|
+
<title>1->8</title>
|
99
|
+
<path fill="none" stroke="blue" d="M354.05,-359.78C369.82,-351.61 386.07,-340.02 395.5,-324 406.38,-305.52 405.76,-280.93 404.34,-262.27"/>
|
100
|
+
<polygon fill="blue" stroke="blue" points="407.81,-261.75 403.49,-252.07 400.83,-262.32 407.81,-261.75"/>
|
101
|
+
</g>
|
102
|
+
<!-- 9 -->
|
103
|
+
<g id="node8" class="node">
|
104
|
+
<title>9</title>
|
105
|
+
<polygon fill="none" stroke="black" points="395,-324 228,-324 228,-288 395,-288 395,-324"/>
|
106
|
+
<text text-anchor="middle" x="311.5" y="-302.3" font-family="Times,serif" font-size="14.00">temporal-sdk-core-test-utils</text>
|
107
|
+
</g>
|
108
|
+
<!-- 1->9 -->
|
109
|
+
<g id="edge9" class="edge">
|
110
|
+
<title>1->9</title>
|
111
|
+
<path fill="none" stroke="blue" d="M305.58,-359.7C304.79,-351.98 304.56,-342.71 304.9,-334.11"/>
|
112
|
+
<polygon fill="blue" stroke="blue" points="308.4,-334.32 305.6,-324.1 301.42,-333.84 308.4,-334.32"/>
|
113
|
+
</g>
|
114
|
+
<!-- 5->6 -->
|
115
|
+
<g id="edge10" class="edge">
|
116
|
+
<title>5->6</title>
|
117
|
+
<path fill="none" stroke="black" d="M352.86,-71.7C348.37,-63.64 342.94,-53.89 337.98,-44.98"/>
|
118
|
+
<polygon fill="black" stroke="black" points="340.95,-43.14 333.03,-36.1 334.84,-46.54 340.95,-43.14"/>
|
119
|
+
</g>
|
120
|
+
<!-- 7->5 -->
|
121
|
+
<g id="edge11" class="edge">
|
122
|
+
<title>7->5</title>
|
123
|
+
<path fill="none" stroke="black" d="M237.86,-143.88C260.52,-134.26 288.97,-122.19 312.97,-112.01"/>
|
124
|
+
<polygon fill="black" stroke="black" points="314.43,-115.2 322.27,-108.07 311.69,-108.75 314.43,-115.2"/>
|
125
|
+
</g>
|
126
|
+
<!-- 7->6 -->
|
127
|
+
<g id="edge12" class="edge">
|
128
|
+
<title>7->6</title>
|
129
|
+
<path fill="none" stroke="black" d="M210.74,-143.85C225.01,-125.62 248.63,-96.14 270.5,-72 279.24,-62.36 289.24,-52.16 298.18,-43.31"/>
|
130
|
+
<polygon fill="black" stroke="black" points="300.7,-45.74 305.39,-36.24 295.8,-40.75 300.7,-45.74"/>
|
131
|
+
</g>
|
132
|
+
<!-- 8->1 -->
|
133
|
+
<g id="edge14" class="edge">
|
134
|
+
<title>8->1</title>
|
135
|
+
<path fill="none" stroke="black" d="M416.59,-252.07C423.07,-271.04 426.51,-301.89 413.5,-324 405.57,-337.47 392.82,-347.8 378.95,-355.62"/>
|
136
|
+
<polygon fill="black" stroke="black" points="376.99,-352.69 369.71,-360.39 380.2,-358.91 376.99,-352.69"/>
|
137
|
+
</g>
|
138
|
+
<!-- 8->5 -->
|
139
|
+
<g id="edge13" class="edge">
|
140
|
+
<title>8->5</title>
|
141
|
+
<path fill="none" stroke="black" d="M400.31,-215.87C392.95,-191.56 379.4,-146.82 370.68,-118.01"/>
|
142
|
+
<polygon fill="black" stroke="black" points="373.95,-116.75 367.71,-108.19 367.25,-118.77 373.95,-116.75"/>
|
143
|
+
</g>
|
144
|
+
<!-- 8->6 -->
|
145
|
+
<g id="edge16" class="edge">
|
146
|
+
<title>8->6</title>
|
147
|
+
<path fill="none" stroke="black" d="M413.59,-215.56C426.78,-184.32 448.83,-117.84 421.5,-72 413.54,-58.64 400.91,-48.45 387.34,-40.75"/>
|
148
|
+
<polygon fill="black" stroke="black" points="388.8,-37.56 378.32,-36.04 385.56,-43.77 388.8,-37.56"/>
|
149
|
+
</g>
|
150
|
+
<!-- 8->7 -->
|
151
|
+
<g id="edge15" class="edge">
|
152
|
+
<title>8->7</title>
|
153
|
+
<path fill="none" stroke="black" d="M360.88,-217.98C330.78,-207.86 290.71,-194.37 257.79,-183.29"/>
|
154
|
+
<polygon fill="black" stroke="black" points="258.86,-179.96 248.26,-180.08 256.62,-186.59 258.86,-179.96"/>
|
155
|
+
</g>
|
156
|
+
<!-- 9->1 -->
|
157
|
+
<g id="edge19" class="edge">
|
158
|
+
<title>9->1</title>
|
159
|
+
<path fill="none" stroke="black" d="M317.4,-324.1C318.2,-331.79 318.44,-341.05 318.1,-349.67"/>
|
160
|
+
<polygon fill="black" stroke="black" points="314.61,-349.48 317.42,-359.7 321.59,-349.96 314.61,-349.48"/>
|
161
|
+
</g>
|
162
|
+
<!-- 9->5 -->
|
163
|
+
<g id="edge17" class="edge">
|
164
|
+
<title>9->5</title>
|
165
|
+
<path fill="none" stroke="black" d="M315.59,-287.85C324.43,-250.75 345.39,-162.81 356.04,-118.1"/>
|
166
|
+
<polygon fill="black" stroke="black" points="359.48,-118.77 358.39,-108.23 352.67,-117.15 359.48,-118.77"/>
|
167
|
+
</g>
|
168
|
+
<!-- 9->6 -->
|
169
|
+
<g id="edge21" class="edge">
|
170
|
+
<title>9->6</title>
|
171
|
+
<path fill="none" stroke="black" d="M308.43,-287.86C302.03,-249.05 288.97,-151.64 303.5,-72 305.11,-63.2 308.1,-53.95 311.29,-45.7"/>
|
172
|
+
<polygon fill="black" stroke="black" points="314.62,-46.79 315.19,-36.21 308.15,-44.12 314.62,-46.79"/>
|
173
|
+
</g>
|
174
|
+
<!-- 9->7 -->
|
175
|
+
<g id="edge20" class="edge">
|
176
|
+
<title>9->7</title>
|
177
|
+
<path fill="none" stroke="black" d="M297.75,-287.87C277.81,-263.03 240.73,-216.85 217.68,-188.14"/>
|
178
|
+
<polygon fill="black" stroke="black" points="220.29,-185.8 211.3,-180.19 214.83,-190.18 220.29,-185.8"/>
|
179
|
+
</g>
|
180
|
+
<!-- 9->8 -->
|
181
|
+
<g id="edge18" class="edge">
|
182
|
+
<title>9->8</title>
|
183
|
+
<path fill="none" stroke="black" d="M334.74,-287.7C346.69,-278.8 361.42,-267.82 374.35,-258.2"/>
|
184
|
+
<polygon fill="black" stroke="black" points="376.6,-260.88 382.53,-252.1 372.42,-255.27 376.6,-260.88"/>
|
185
|
+
</g>
|
186
|
+
</g>
|
187
|
+
</svg>
|