temporalio 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/README.md +180 -7
- data/bridge/Cargo.lock +208 -76
- data/bridge/Cargo.toml +5 -2
- data/bridge/sdk-core/Cargo.toml +1 -1
- data/bridge/sdk-core/README.md +20 -10
- data/bridge/sdk-core/client/Cargo.toml +1 -1
- data/bridge/sdk-core/client/src/lib.rs +227 -59
- data/bridge/sdk-core/client/src/metrics.rs +17 -8
- data/bridge/sdk-core/client/src/raw.rs +13 -12
- data/bridge/sdk-core/client/src/retry.rs +132 -43
- data/bridge/sdk-core/core/Cargo.toml +28 -15
- data/bridge/sdk-core/core/benches/workflow_replay.rs +13 -10
- data/bridge/sdk-core/core/src/abstractions.rs +225 -36
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +217 -79
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +165 -2
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +565 -34
- data/bridge/sdk-core/core/src/core_tests/queries.rs +247 -90
- data/bridge/sdk-core/core/src/core_tests/workers.rs +3 -5
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +430 -67
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +106 -12
- data/bridge/sdk-core/core/src/internal_flags.rs +136 -0
- data/bridge/sdk-core/core/src/lib.rs +148 -34
- data/bridge/sdk-core/core/src/protosext/mod.rs +1 -1
- data/bridge/sdk-core/core/src/replay/mod.rs +185 -41
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +190 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +219 -140
- data/bridge/sdk-core/core/src/telemetry/mod.rs +326 -315
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +20 -14
- data/bridge/sdk-core/core/src/test_help/mod.rs +85 -21
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +112 -156
- data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +364 -128
- data/bridge/sdk-core/core/src/worker/activities.rs +263 -170
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +23 -3
- data/bridge/sdk-core/core/src/worker/client.rs +48 -6
- data/bridge/sdk-core/core/src/worker/mod.rs +186 -75
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +13 -24
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +879 -226
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +101 -48
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -12
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +90 -32
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +7 -10
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +160 -83
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +36 -54
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +179 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +104 -157
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +8 -12
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +9 -13
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +10 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +14 -11
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +6 -17
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +395 -299
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +12 -20
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +33 -18
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +1032 -374
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +525 -392
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
- data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +3 -6
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +456 -681
- data/bridge/sdk-core/core-api/Cargo.toml +6 -4
- data/bridge/sdk-core/core-api/src/errors.rs +1 -34
- data/bridge/sdk-core/core-api/src/lib.rs +7 -45
- data/bridge/sdk-core/core-api/src/telemetry.rs +141 -0
- data/bridge/sdk-core/core-api/src/worker.rs +27 -1
- data/bridge/sdk-core/etc/deps.svg +115 -140
- data/bridge/sdk-core/etc/regen-depgraph.sh +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +18 -15
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +8 -3
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -3
- data/bridge/sdk-core/protos/api_upstream/build/go.mod +7 -0
- data/bridge/sdk-core/protos/api_upstream/build/go.sum +5 -0
- data/bridge/sdk-core/protos/api_upstream/{temporal/api/enums/v1/cluster.proto → build/tools.go} +7 -18
- data/bridge/sdk-core/protos/api_upstream/go.mod +6 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +15 -26
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +13 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +4 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +10 -8
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +28 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +24 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +62 -26
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +4 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +24 -61
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -21
- data/bridge/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +57 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +110 -31
- data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +71 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +111 -36
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +19 -5
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +9 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +9 -1
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +6 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- data/bridge/sdk-core/sdk/Cargo.toml +4 -3
- data/bridge/sdk-core/sdk/src/interceptors.rs +36 -3
- data/bridge/sdk-core/sdk/src/lib.rs +94 -25
- data/bridge/sdk-core/sdk/src/workflow_context.rs +13 -2
- data/bridge/sdk-core/sdk/src/workflow_future.rs +10 -13
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +5 -2
- data/bridge/sdk-core/sdk-core-protos/build.rs +36 -2
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +164 -104
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +27 -23
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +252 -74
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
- data/bridge/sdk-core/test-utils/Cargo.toml +4 -1
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +106 -296
- data/bridge/sdk-core/test-utils/src/histfetch.rs +1 -1
- data/bridge/sdk-core/test-utils/src/lib.rs +161 -50
- data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
- data/bridge/sdk-core/test-utils/src/workflows.rs +29 -0
- data/bridge/sdk-core/tests/fuzzy_workflow.rs +130 -0
- data/bridge/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +10 -5
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +239 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +4 -60
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -69
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +151 -116
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +54 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +7 -28
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +115 -24
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -4
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +27 -18
- data/bridge/sdk-core/tests/main.rs +8 -16
- data/bridge/sdk-core/tests/runner.rs +75 -36
- data/bridge/sdk-core/tests/wf_input_replay.rs +32 -0
- data/bridge/src/connection.rs +117 -82
- data/bridge/src/lib.rs +356 -42
- data/bridge/src/runtime.rs +10 -3
- data/bridge/src/test_server.rs +153 -0
- data/bridge/src/worker.rs +133 -9
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +8 -6
- data/lib/gen/temporal/api/command/v1/message_pb.rb +10 -16
- data/lib/gen/temporal/api/common/v1/message_pb.rb +5 -1
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +3 -3
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +5 -4
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +9 -1
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +7 -10
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +1 -1
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/history/v1/message_pb.rb +34 -25
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +14 -51
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/api/protocol/v1/message_pb.rb +30 -0
- data/lib/gen/temporal/api/query/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +22 -1
- data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +23 -0
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +2 -2
- data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +49 -0
- data/lib/gen/temporal/api/testservice/v1/service_pb.rb +21 -0
- data/lib/gen/temporal/api/update/v1/message_pb.rb +49 -3
- data/lib/gen/temporal/api/version/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +47 -20
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +10 -6
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +9 -3
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +28 -21
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +32 -24
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +12 -5
- data/lib/temporalio/activity/context.rb +102 -0
- data/lib/temporalio/activity/info.rb +67 -0
- data/lib/temporalio/activity.rb +85 -0
- data/lib/temporalio/bridge/connect_options.rb +15 -0
- data/lib/temporalio/bridge/error.rb +8 -0
- data/lib/temporalio/bridge/retry_config.rb +24 -0
- data/lib/temporalio/bridge/tls_options.rb +19 -0
- data/lib/temporalio/bridge.rb +14 -0
- data/lib/{temporal → temporalio}/client/implementation.rb +57 -56
- data/lib/{temporal → temporalio}/client/workflow_handle.rb +35 -35
- data/lib/{temporal → temporalio}/client.rb +19 -32
- data/lib/temporalio/connection/retry_config.rb +44 -0
- data/lib/temporalio/connection/service.rb +20 -0
- data/lib/temporalio/connection/test_service.rb +92 -0
- data/lib/temporalio/connection/tls_options.rb +51 -0
- data/lib/temporalio/connection/workflow_service.rb +731 -0
- data/lib/temporalio/connection.rb +86 -0
- data/lib/{temporal → temporalio}/data_converter.rb +76 -35
- data/lib/{temporal → temporalio}/error/failure.rb +6 -6
- data/lib/{temporal → temporalio}/error/workflow_failure.rb +4 -2
- data/lib/{temporal → temporalio}/errors.rb +19 -1
- data/lib/{temporal → temporalio}/failure_converter/base.rb +5 -5
- data/lib/{temporal → temporalio}/failure_converter/basic.rb +58 -52
- data/lib/temporalio/failure_converter.rb +7 -0
- data/lib/temporalio/interceptor/activity_inbound.rb +22 -0
- data/lib/temporalio/interceptor/activity_outbound.rb +24 -0
- data/lib/{temporal → temporalio}/interceptor/chain.rb +7 -6
- data/lib/{temporal → temporalio}/interceptor/client.rb +27 -2
- data/lib/temporalio/interceptor.rb +22 -0
- data/lib/{temporal → temporalio}/payload_codec/base.rb +5 -5
- data/lib/{temporal → temporalio}/payload_converter/base.rb +3 -3
- data/lib/{temporal → temporalio}/payload_converter/bytes.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/composite.rb +7 -5
- data/lib/{temporal → temporalio}/payload_converter/encoding_base.rb +4 -4
- data/lib/{temporal → temporalio}/payload_converter/json.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/nil.rb +4 -3
- data/lib/temporalio/payload_converter.rb +14 -0
- data/lib/{temporal → temporalio}/retry_policy.rb +17 -7
- data/lib/{temporal → temporalio}/retry_state.rb +1 -1
- data/lib/temporalio/runtime.rb +25 -0
- data/lib/temporalio/testing/time_skipping_handle.rb +32 -0
- data/lib/temporalio/testing/time_skipping_interceptor.rb +23 -0
- data/lib/temporalio/testing/workflow_environment.rb +112 -0
- data/lib/temporalio/testing.rb +175 -0
- data/lib/{temporal → temporalio}/timeout_type.rb +2 -2
- data/lib/temporalio/version.rb +3 -0
- data/lib/temporalio/worker/activity_runner.rb +114 -0
- data/lib/temporalio/worker/activity_worker.rb +164 -0
- data/lib/temporalio/worker/reactor.rb +46 -0
- data/lib/temporalio/worker/runner.rb +63 -0
- data/lib/temporalio/worker/sync_worker.rb +124 -0
- data/lib/temporalio/worker/thread_pool_executor.rb +51 -0
- data/lib/temporalio/worker.rb +204 -0
- data/lib/temporalio/workflow/async.rb +46 -0
- data/lib/{temporal → temporalio}/workflow/execution_info.rb +4 -4
- data/lib/{temporal → temporalio}/workflow/execution_status.rb +1 -1
- data/lib/temporalio/workflow/future.rb +138 -0
- data/lib/{temporal → temporalio}/workflow/id_reuse_policy.rb +6 -6
- data/lib/temporalio/workflow/info.rb +76 -0
- data/lib/{temporal → temporalio}/workflow/query_reject_condition.rb +5 -5
- data/lib/temporalio.rb +12 -3
- data/temporalio.gemspec +11 -6
- metadata +137 -64
- data/bridge/sdk-core/Cargo.lock +0 -2606
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +0 -24
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- data/bridge/sdk-core/bridge-ffi/build.rs +0 -25
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -249
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +0 -825
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +0 -211
- data/bridge/sdk-core/core/src/log_export.rs +0 -62
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- data/bridge/sdk-core/sdk/src/conversions.rs +0 -8
- data/lib/bridge.so +0 -0
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +0 -67
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +0 -26
- data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +0 -222
- data/lib/temporal/bridge.rb +0 -14
- data/lib/temporal/connection.rb +0 -736
- data/lib/temporal/failure_converter.rb +0 -8
- data/lib/temporal/payload_converter.rb +0 -14
- data/lib/temporal/runtime.rb +0 -22
- data/lib/temporal/version.rb +0 -3
- data/lib/temporal.rb +0 -8
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
use assert_matches::assert_matches;
|
|
2
|
-
use
|
|
3
|
-
use
|
|
2
|
+
use parking_lot::Mutex;
|
|
3
|
+
use std::{collections::HashSet, sync::Arc, time::Duration};
|
|
4
|
+
use temporal_sdk::{interceptors::WorkerInterceptor, WfContext, Worker, WorkflowFunction};
|
|
5
|
+
use temporal_sdk_core::replay::{HistoryFeeder, HistoryForReplay};
|
|
4
6
|
use temporal_sdk_core_api::errors::{PollActivityError, PollWfError};
|
|
5
7
|
use temporal_sdk_core_protos::{
|
|
6
8
|
coresdk::{
|
|
@@ -8,20 +10,29 @@ use temporal_sdk_core_protos::{
|
|
|
8
10
|
workflow_commands::{ScheduleActivity, StartTimer},
|
|
9
11
|
workflow_completion::WorkflowActivationCompletion,
|
|
10
12
|
},
|
|
11
|
-
DEFAULT_WORKFLOW_TYPE,
|
|
13
|
+
TestHistoryBuilder, DEFAULT_WORKFLOW_TYPE,
|
|
12
14
|
};
|
|
13
15
|
use temporal_sdk_core_test_utils::{
|
|
14
|
-
canned_histories, history_from_proto_binary, init_core_replay_preloaded,
|
|
16
|
+
canned_histories, history_from_proto_binary, init_core_replay_preloaded, replay_sdk_worker,
|
|
17
|
+
replay_sdk_worker_stream, WorkerTestHelpers,
|
|
15
18
|
};
|
|
16
19
|
use tokio::join;
|
|
17
20
|
|
|
21
|
+
fn test_hist_to_replay(t: TestHistoryBuilder) -> HistoryForReplay {
|
|
22
|
+
let hi = t.get_full_history_info().unwrap().into();
|
|
23
|
+
HistoryForReplay::new(hi, "fake".to_string())
|
|
24
|
+
}
|
|
25
|
+
|
|
18
26
|
#[tokio::test]
|
|
19
27
|
async fn timer_workflow_replay() {
|
|
20
|
-
let
|
|
28
|
+
let core = init_core_replay_preloaded(
|
|
21
29
|
"timer_workflow_replay",
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
30
|
+
[HistoryForReplay::new(
|
|
31
|
+
history_from_proto_binary("histories/timer_workflow_history.bin")
|
|
32
|
+
.await
|
|
33
|
+
.unwrap(),
|
|
34
|
+
"fake".to_owned(),
|
|
35
|
+
)],
|
|
25
36
|
);
|
|
26
37
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
27
38
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
@@ -43,6 +54,14 @@ async fn timer_workflow_replay() {
|
|
|
43
54
|
);
|
|
44
55
|
};
|
|
45
56
|
let poll_fut = async {
|
|
57
|
+
let evict_task = core
|
|
58
|
+
.poll_workflow_activation()
|
|
59
|
+
.await
|
|
60
|
+
.expect("Should be an eviction activation");
|
|
61
|
+
assert!(evict_task.eviction_reason().is_some());
|
|
62
|
+
core.complete_workflow_activation(WorkflowActivationCompletion::empty(evict_task.run_id))
|
|
63
|
+
.await
|
|
64
|
+
.unwrap();
|
|
46
65
|
assert_matches!(
|
|
47
66
|
core.poll_workflow_activation().await,
|
|
48
67
|
Err(PollWfError::ShutDown)
|
|
@@ -64,11 +83,14 @@ async fn timer_workflow_replay() {
|
|
|
64
83
|
|
|
65
84
|
#[tokio::test]
|
|
66
85
|
async fn workflow_nondeterministic_replay() {
|
|
67
|
-
let
|
|
86
|
+
let core = init_core_replay_preloaded(
|
|
68
87
|
"timer_workflow_replay",
|
|
69
|
-
|
|
70
|
-
.
|
|
71
|
-
|
|
88
|
+
[HistoryForReplay::new(
|
|
89
|
+
history_from_proto_binary("histories/timer_workflow_history.bin")
|
|
90
|
+
.await
|
|
91
|
+
.unwrap(),
|
|
92
|
+
"fake".to_owned(),
|
|
93
|
+
)],
|
|
72
94
|
);
|
|
73
95
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
74
96
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
@@ -102,29 +124,85 @@ async fn replay_using_wf_function() {
|
|
|
102
124
|
let num_timers = 10;
|
|
103
125
|
let t = canned_histories::long_sequential_timers(num_timers as usize);
|
|
104
126
|
let func = timers_wf(num_timers);
|
|
105
|
-
let
|
|
106
|
-
init_core_replay_preloaded("replay_bench", &t.get_full_history_info().unwrap().into());
|
|
107
|
-
let mut worker = Worker::new_from_core(worker, "replay_bench".to_string());
|
|
127
|
+
let mut worker = replay_sdk_worker([test_hist_to_replay(t)]);
|
|
108
128
|
worker.register_wf(DEFAULT_WORKFLOW_TYPE, func);
|
|
109
129
|
worker.run().await.unwrap();
|
|
110
130
|
}
|
|
111
131
|
|
|
132
|
+
async fn replay_abrupt_ending(t: TestHistoryBuilder) {
|
|
133
|
+
let func = timers_wf(1);
|
|
134
|
+
let mut worker = replay_sdk_worker([test_hist_to_replay(t)]);
|
|
135
|
+
worker.register_wf(DEFAULT_WORKFLOW_TYPE, func);
|
|
136
|
+
worker.run().await.unwrap();
|
|
137
|
+
}
|
|
112
138
|
#[tokio::test]
|
|
113
|
-
async fn
|
|
139
|
+
async fn replay_ok_ending_with_terminated() {
|
|
114
140
|
let mut t1 = canned_histories::single_timer("1");
|
|
115
141
|
t1.add_workflow_execution_terminated();
|
|
142
|
+
replay_abrupt_ending(t1).await;
|
|
143
|
+
}
|
|
144
|
+
#[tokio::test]
|
|
145
|
+
async fn replay_ok_ending_with_timed_out() {
|
|
116
146
|
let mut t2 = canned_histories::single_timer("1");
|
|
117
147
|
t2.add_workflow_execution_timed_out();
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
148
|
+
replay_abrupt_ending(t2).await;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
#[rstest::rstest]
|
|
152
|
+
#[tokio::test]
|
|
153
|
+
async fn multiple_histories_replay(#[values(false, true)] use_feeder: bool) {
|
|
154
|
+
let num_timers = 10;
|
|
155
|
+
let seq_timer_wf = timers_wf(num_timers);
|
|
156
|
+
let one_timer_wf = timers_wf(1);
|
|
157
|
+
let mut one_timer_hist = canned_histories::single_timer("1");
|
|
158
|
+
one_timer_hist.set_wf_type("onetimer");
|
|
159
|
+
let mut seq_timer_hist = canned_histories::long_sequential_timers(num_timers as usize);
|
|
160
|
+
seq_timer_hist.set_wf_type("seqtimer");
|
|
161
|
+
let (feeder, stream) = HistoryFeeder::new(1);
|
|
162
|
+
let mut worker = if use_feeder {
|
|
163
|
+
replay_sdk_worker_stream(stream)
|
|
164
|
+
} else {
|
|
165
|
+
replay_sdk_worker([
|
|
166
|
+
test_hist_to_replay(one_timer_hist.clone()),
|
|
167
|
+
test_hist_to_replay(seq_timer_hist.clone()),
|
|
168
|
+
])
|
|
169
|
+
};
|
|
170
|
+
let runs_ctr_i = UniqueRunsCounter::default();
|
|
171
|
+
let runs_ctr = runs_ctr_i.runs.clone();
|
|
172
|
+
worker.set_worker_interceptor(Box::new(runs_ctr_i));
|
|
173
|
+
worker.register_wf("onetimer", one_timer_wf);
|
|
174
|
+
worker.register_wf("seqtimer", seq_timer_wf);
|
|
175
|
+
|
|
176
|
+
if use_feeder {
|
|
177
|
+
let feed_fut = async move {
|
|
178
|
+
feeder
|
|
179
|
+
.feed(test_hist_to_replay(one_timer_hist))
|
|
180
|
+
.await
|
|
181
|
+
.unwrap();
|
|
182
|
+
feeder
|
|
183
|
+
.feed(test_hist_to_replay(seq_timer_hist))
|
|
184
|
+
.await
|
|
185
|
+
.unwrap();
|
|
186
|
+
};
|
|
187
|
+
let (_, runr) = join!(feed_fut, worker.run());
|
|
188
|
+
runr.unwrap();
|
|
189
|
+
} else {
|
|
126
190
|
worker.run().await.unwrap();
|
|
127
191
|
}
|
|
192
|
+
assert_eq!(runs_ctr.lock().len(), 2);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
#[tokio::test]
|
|
196
|
+
async fn multiple_histories_can_handle_dupe_run_ids() {
|
|
197
|
+
let mut hist1 = canned_histories::single_timer("1");
|
|
198
|
+
hist1.set_wf_type("onetimer");
|
|
199
|
+
let mut worker = replay_sdk_worker([
|
|
200
|
+
test_hist_to_replay(hist1.clone()),
|
|
201
|
+
test_hist_to_replay(hist1.clone()),
|
|
202
|
+
test_hist_to_replay(hist1),
|
|
203
|
+
]);
|
|
204
|
+
worker.register_wf("onetimer", timers_wf(1));
|
|
205
|
+
worker.run().await.unwrap();
|
|
128
206
|
}
|
|
129
207
|
|
|
130
208
|
fn timers_wf(num_timers: u32) -> WorkflowFunction {
|
|
@@ -135,3 +213,16 @@ fn timers_wf(num_timers: u32) -> WorkflowFunction {
|
|
|
135
213
|
Ok(().into())
|
|
136
214
|
})
|
|
137
215
|
}
|
|
216
|
+
|
|
217
|
+
#[derive(Default)]
|
|
218
|
+
struct UniqueRunsCounter {
|
|
219
|
+
runs: Arc<Mutex<HashSet<String>>>,
|
|
220
|
+
}
|
|
221
|
+
#[async_trait::async_trait(?Send)]
|
|
222
|
+
impl WorkerInterceptor for UniqueRunsCounter {
|
|
223
|
+
async fn on_workflow_activation_completion(&self, completion: &WorkflowActivationCompletion) {
|
|
224
|
+
self.runs.lock().insert(completion.run_id.clone());
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
fn on_shutdown(&self, _: &Worker) {}
|
|
228
|
+
}
|
|
@@ -14,6 +14,7 @@ const POST_RESET_SIG: &str = "post-reset";
|
|
|
14
14
|
async fn reset_workflow() {
|
|
15
15
|
let wf_name = "reset_me_wf";
|
|
16
16
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
17
|
+
starter.no_remote_activities();
|
|
17
18
|
let mut worker = starter.worker().await;
|
|
18
19
|
worker.fetch_results = false;
|
|
19
20
|
let notify = Arc::new(Notify::new());
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
use std::collections::HashMap;
|
|
2
2
|
|
|
3
3
|
use futures::StreamExt;
|
|
4
|
-
use temporal_client::{
|
|
4
|
+
use temporal_client::{
|
|
5
|
+
SignalWithStartOptions, WorkflowClientTrait, WorkflowExecutionInfo, WorkflowOptions,
|
|
6
|
+
};
|
|
5
7
|
use temporal_sdk::{
|
|
6
8
|
ChildWorkflowOptions, Signal, SignalWorkflowOptions, WfContext, WorkflowResult,
|
|
7
9
|
};
|
|
@@ -32,6 +34,7 @@ async fn signal_sender(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
32
34
|
async fn sends_signal_to_missing_wf() {
|
|
33
35
|
let wf_name = "sends_signal_to_missing_wf";
|
|
34
36
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
37
|
+
starter.no_remote_activities();
|
|
35
38
|
let mut worker = starter.worker().await;
|
|
36
39
|
worker.register_wf(wf_name.to_owned(), signal_sender);
|
|
37
40
|
|
|
@@ -59,7 +62,6 @@ async fn signal_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
59
62
|
|
|
60
63
|
async fn signal_with_create_wf_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
61
64
|
let res = ctx.make_signal_channel(SIGNAME).next().await.unwrap();
|
|
62
|
-
println!("HEADER: {:?}", res.headers);
|
|
63
65
|
assert_eq!(&res.input, &[b"tada".into()]);
|
|
64
66
|
assert_eq!(
|
|
65
67
|
*res.headers.get("tupac").expect("tupac header exists"),
|
|
@@ -71,6 +73,7 @@ async fn signal_with_create_wf_receiver(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
71
73
|
#[tokio::test]
|
|
72
74
|
async fn sends_signal_to_other_wf() {
|
|
73
75
|
let mut starter = CoreWfStarter::new("sends_signal_to_other_wf");
|
|
76
|
+
starter.no_remote_activities();
|
|
74
77
|
let mut worker = starter.worker().await;
|
|
75
78
|
worker.register_wf("sender", signal_sender);
|
|
76
79
|
worker.register_wf("receiver", signal_receiver);
|
|
@@ -99,24 +102,24 @@ async fn sends_signal_to_other_wf() {
|
|
|
99
102
|
#[tokio::test]
|
|
100
103
|
async fn sends_signal_with_create_wf() {
|
|
101
104
|
let mut starter = CoreWfStarter::new("sends_signal_with_create_wf");
|
|
105
|
+
starter.no_remote_activities();
|
|
102
106
|
let mut worker = starter.worker().await;
|
|
103
|
-
worker.register_wf("
|
|
107
|
+
worker.register_wf("receiver_signal", signal_with_create_wf_receiver);
|
|
104
108
|
|
|
105
109
|
let client = starter.get_client().await;
|
|
106
110
|
let mut header: HashMap<String, Payload> = HashMap::new();
|
|
107
111
|
header.insert("tupac".into(), "shakur".into());
|
|
112
|
+
let options = SignalWithStartOptions::builder()
|
|
113
|
+
.task_queue(worker.inner_mut().task_queue())
|
|
114
|
+
.workflow_id("sends_signal_with_create_wf")
|
|
115
|
+
.workflow_type("receiver_signal")
|
|
116
|
+
.signal_name(SIGNAME)
|
|
117
|
+
.signal_input(vec![b"tada".into()].into_payloads())
|
|
118
|
+
.signal_header(header.into())
|
|
119
|
+
.build()
|
|
120
|
+
.unwrap();
|
|
108
121
|
let res = client
|
|
109
|
-
.signal_with_start_workflow_execution(
|
|
110
|
-
None,
|
|
111
|
-
worker.inner_mut().task_queue().to_owned(),
|
|
112
|
-
"sends_signal_with_create_wf".to_owned(),
|
|
113
|
-
"receiversignal".to_owned(),
|
|
114
|
-
None,
|
|
115
|
-
WorkflowOptions::default(),
|
|
116
|
-
SIGNAME.to_owned(),
|
|
117
|
-
vec![b"tada".into()].into_payloads(),
|
|
118
|
-
Some(header.into()),
|
|
119
|
-
)
|
|
122
|
+
.signal_with_start_workflow_execution(options, WorkflowOptions::default())
|
|
120
123
|
.await
|
|
121
124
|
.expect("request succeeds.qed");
|
|
122
125
|
|
|
@@ -150,6 +153,7 @@ async fn signals_child(ctx: WfContext) -> WorkflowResult<()> {
|
|
|
150
153
|
#[tokio::test]
|
|
151
154
|
async fn sends_signal_to_child() {
|
|
152
155
|
let mut starter = CoreWfStarter::new("sends_signal_to_child");
|
|
156
|
+
starter.no_remote_activities();
|
|
153
157
|
let mut worker = starter.worker().await;
|
|
154
158
|
worker.register_wf("child_signaler", signals_child);
|
|
155
159
|
worker.register_wf("child_receiver", signal_receiver);
|
|
@@ -12,19 +12,12 @@ use tokio::sync::Barrier;
|
|
|
12
12
|
async fn timer_workflow_not_sticky() {
|
|
13
13
|
let wf_name = "timer_wf_not_sticky";
|
|
14
14
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
15
|
+
starter.no_remote_activities();
|
|
15
16
|
starter.max_cached_workflows(0);
|
|
16
17
|
let mut worker = starter.worker().await;
|
|
17
18
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
18
19
|
|
|
19
|
-
worker
|
|
20
|
-
.submit_wf(
|
|
21
|
-
wf_name.to_owned(),
|
|
22
|
-
wf_name.to_owned(),
|
|
23
|
-
vec![],
|
|
24
|
-
WorkflowOptions::default(),
|
|
25
|
-
)
|
|
26
|
-
.await
|
|
27
|
-
.unwrap();
|
|
20
|
+
starter.start_with_worker(wf_name, &mut worker).await;
|
|
28
21
|
worker.run_until_done().await.unwrap();
|
|
29
22
|
}
|
|
30
23
|
|
|
@@ -47,19 +40,12 @@ async fn timer_workflow_timeout_on_sticky() {
|
|
|
47
40
|
// on a not-sticky queue
|
|
48
41
|
let wf_name = "timer_workflow_timeout_on_sticky";
|
|
49
42
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
50
|
-
starter.
|
|
43
|
+
starter.no_remote_activities();
|
|
44
|
+
starter.workflow_options.task_timeout = Some(Duration::from_secs(2));
|
|
51
45
|
let mut worker = starter.worker().await;
|
|
52
46
|
worker.register_wf(wf_name.to_owned(), timer_timeout_wf);
|
|
53
47
|
|
|
54
|
-
worker
|
|
55
|
-
.submit_wf(
|
|
56
|
-
wf_name.to_owned(),
|
|
57
|
-
wf_name.to_owned(),
|
|
58
|
-
vec![],
|
|
59
|
-
WorkflowOptions::default(),
|
|
60
|
-
)
|
|
61
|
-
.await
|
|
62
|
-
.unwrap();
|
|
48
|
+
starter.start_with_worker(wf_name, &mut worker).await;
|
|
63
49
|
worker.run_until_done().await.unwrap();
|
|
64
50
|
// If it didn't run twice it didn't time out
|
|
65
51
|
assert_eq!(RUN_CT.load(Ordering::SeqCst), 2);
|
|
@@ -69,7 +55,7 @@ async fn timer_workflow_timeout_on_sticky() {
|
|
|
69
55
|
async fn cache_miss_ok() {
|
|
70
56
|
let wf_name = "cache_miss_ok";
|
|
71
57
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
72
|
-
starter.max_wft(1);
|
|
58
|
+
starter.no_remote_activities().max_wft(1);
|
|
73
59
|
let mut worker = starter.worker().await;
|
|
74
60
|
|
|
75
61
|
let barr: &'static Barrier = Box::leak(Box::new(Barrier::new(2)));
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
use std::time::Duration;
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
use temporal_sdk::{WfContext, WorkflowResult};
|
|
4
4
|
use temporal_sdk_core_protos::coresdk::{
|
|
5
5
|
workflow_commands::{CancelTimer, CompleteWorkflowExecution, StartTimer},
|
|
6
6
|
workflow_completion::WorkflowActivationCompletion,
|
|
7
7
|
};
|
|
8
8
|
use temporal_sdk_core_test_utils::{
|
|
9
|
-
init_core_and_create_wf, start_timer_cmd, CoreWfStarter,
|
|
9
|
+
drain_pollers_and_shutdown, init_core_and_create_wf, start_timer_cmd, CoreWfStarter,
|
|
10
|
+
WorkerTestHelpers,
|
|
10
11
|
};
|
|
11
12
|
|
|
12
13
|
pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
@@ -18,18 +19,11 @@ pub async fn timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
18
19
|
async fn timer_workflow_workflow_driver() {
|
|
19
20
|
let wf_name = "timer_wf_new";
|
|
20
21
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
22
|
+
starter.no_remote_activities();
|
|
21
23
|
let mut worker = starter.worker().await;
|
|
22
24
|
worker.register_wf(wf_name.to_owned(), timer_wf);
|
|
23
25
|
|
|
24
|
-
worker
|
|
25
|
-
.submit_wf(
|
|
26
|
-
wf_name.to_owned(),
|
|
27
|
-
wf_name.to_owned(),
|
|
28
|
-
vec![],
|
|
29
|
-
WorkflowOptions::default(),
|
|
30
|
-
)
|
|
31
|
-
.await
|
|
32
|
-
.unwrap();
|
|
26
|
+
starter.start_with_worker(wf_name, &mut worker).await;
|
|
33
27
|
worker.run_until_done().await.unwrap();
|
|
34
28
|
}
|
|
35
29
|
|
|
@@ -37,6 +31,7 @@ async fn timer_workflow_workflow_driver() {
|
|
|
37
31
|
async fn timer_workflow_manual() {
|
|
38
32
|
let mut starter = init_core_and_create_wf("timer_workflow").await;
|
|
39
33
|
let core = starter.get_worker().await;
|
|
34
|
+
starter.no_remote_activities();
|
|
40
35
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
41
36
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
42
37
|
task.run_id,
|
|
@@ -50,13 +45,14 @@ async fn timer_workflow_manual() {
|
|
|
50
45
|
.unwrap();
|
|
51
46
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
52
47
|
core.complete_execution(&task.run_id).await;
|
|
53
|
-
core
|
|
48
|
+
drain_pollers_and_shutdown(&core).await;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
#[tokio::test]
|
|
57
52
|
async fn timer_cancel_workflow() {
|
|
58
53
|
let mut starter = init_core_and_create_wf("timer_cancel_workflow").await;
|
|
59
54
|
let core = starter.get_worker().await;
|
|
55
|
+
starter.no_remote_activities();
|
|
60
56
|
let task = core.poll_workflow_activation().await.unwrap();
|
|
61
57
|
core.complete_workflow_activation(WorkflowActivationCompletion::from_cmds(
|
|
62
58
|
task.run_id,
|
|
@@ -115,17 +111,10 @@ async fn parallel_timer_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
115
111
|
async fn parallel_timers() {
|
|
116
112
|
let wf_name = "parallel_timers";
|
|
117
113
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
114
|
+
starter.no_remote_activities();
|
|
118
115
|
let mut worker = starter.worker().await;
|
|
119
116
|
worker.register_wf(wf_name.to_owned(), parallel_timer_wf);
|
|
120
117
|
|
|
121
|
-
worker
|
|
122
|
-
.submit_wf(
|
|
123
|
-
wf_name.to_owned(),
|
|
124
|
-
wf_name.to_owned(),
|
|
125
|
-
vec![],
|
|
126
|
-
WorkflowOptions::default(),
|
|
127
|
-
)
|
|
128
|
-
.await
|
|
129
|
-
.unwrap();
|
|
118
|
+
starter.start_with_worker(wf_name, &mut worker).await;
|
|
130
119
|
worker.run_until_done().await.unwrap();
|
|
131
120
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
use log::warn;
|
|
2
1
|
use std::{collections::HashMap, env};
|
|
3
2
|
use temporal_client::{WorkflowClientTrait, WorkflowOptions};
|
|
4
3
|
use temporal_sdk::{WfContext, WorkflowResult};
|
|
5
4
|
use temporal_sdk_core_protos::coresdk::{AsJsonPayloadExt, FromJsonPayloadExt};
|
|
6
|
-
use temporal_sdk_core_test_utils::{CoreWfStarter,
|
|
5
|
+
use temporal_sdk_core_test_utils::{CoreWfStarter, INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR};
|
|
6
|
+
use tracing::warn;
|
|
7
7
|
use uuid::Uuid;
|
|
8
8
|
|
|
9
9
|
// These are initialized on the server as part of the autosetup container which we
|
|
@@ -24,9 +24,11 @@ async fn sends_upsert() {
|
|
|
24
24
|
let wf_name = "sends_upsert_search_attrs";
|
|
25
25
|
let wf_id = Uuid::new_v4();
|
|
26
26
|
let mut starter = CoreWfStarter::new(wf_name);
|
|
27
|
+
starter.no_remote_activities();
|
|
27
28
|
let mut worker = starter.worker().await;
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
// TODO: this should be supported in server 1.20, remove this condition when CLI is upgraded.
|
|
30
|
+
if env::var(INTEG_TEMPORAL_DEV_SERVER_USED_ENV_VAR).is_ok() {
|
|
31
|
+
warn!("skipping sends_upsert -- does not work on temporal dev server");
|
|
30
32
|
return;
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -6,6 +6,7 @@ mod child_workflows;
|
|
|
6
6
|
mod continue_as_new;
|
|
7
7
|
mod determinism;
|
|
8
8
|
mod local_activities;
|
|
9
|
+
mod modify_wf_properties;
|
|
9
10
|
mod patches;
|
|
10
11
|
mod replay;
|
|
11
12
|
mod resets;
|
|
@@ -28,6 +29,7 @@ use temporal_client::{WorkflowClientTrait, WorkflowOptions};
|
|
|
28
29
|
use temporal_sdk::{
|
|
29
30
|
interceptors::WorkerInterceptor, ActContext, ActivityOptions, WfContext, WorkflowResult,
|
|
30
31
|
};
|
|
32
|
+
use temporal_sdk_core::replay::HistoryForReplay;
|
|
31
33
|
use temporal_sdk_core_api::{errors::PollWfError, Worker};
|
|
32
34
|
use temporal_sdk_core_protos::{
|
|
33
35
|
coresdk::{
|
|
@@ -37,11 +39,11 @@ use temporal_sdk_core_protos::{
|
|
|
37
39
|
workflow_completion::WorkflowActivationCompletion,
|
|
38
40
|
ActivityTaskCompletion, AsJsonPayloadExt, IntoCompletion,
|
|
39
41
|
},
|
|
40
|
-
temporal::api::failure::v1::Failure,
|
|
42
|
+
temporal::api::{failure::v1::Failure, history::v1::history_event},
|
|
41
43
|
};
|
|
42
44
|
use temporal_sdk_core_test_utils::{
|
|
43
|
-
history_from_proto_binary, init_core_and_create_wf,
|
|
44
|
-
schedule_activity_cmd, CoreWfStarter, WorkerTestHelpers,
|
|
45
|
+
drain_pollers_and_shutdown, history_from_proto_binary, init_core_and_create_wf,
|
|
46
|
+
init_core_replay_preloaded, schedule_activity_cmd, CoreWfStarter, WorkerTestHelpers,
|
|
45
47
|
};
|
|
46
48
|
use tokio::time::sleep;
|
|
47
49
|
use uuid::Uuid;
|
|
@@ -56,8 +58,7 @@ async fn parallel_workflows_same_queue() {
|
|
|
56
58
|
let num_workflows = 25usize;
|
|
57
59
|
|
|
58
60
|
let run_ids: Vec<_> = future::join_all(
|
|
59
|
-
(0..num_workflows)
|
|
60
|
-
.map(|i| starter.start_wf_with_id(format!("wf-id-{}", i), WorkflowOptions::default())),
|
|
61
|
+
(0..num_workflows).map(|i| starter.start_wf_with_id(format!("wf-id-{i}"))),
|
|
61
62
|
)
|
|
62
63
|
.await;
|
|
63
64
|
|
|
@@ -102,6 +103,7 @@ async fn parallel_workflows_same_queue() {
|
|
|
102
103
|
for handle in handles {
|
|
103
104
|
handle.await.unwrap()
|
|
104
105
|
}
|
|
106
|
+
drain_pollers_and_shutdown(&core).await;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
static RUN_CT: AtomicUsize = AtomicUsize::new(0);
|
|
@@ -115,7 +117,7 @@ pub async fn cache_evictions_wf(command_sink: WfContext) -> WorkflowResult<()> {
|
|
|
115
117
|
async fn workflow_lru_cache_evictions() {
|
|
116
118
|
let wf_type = "workflow_lru_cache_evictions";
|
|
117
119
|
let mut starter = CoreWfStarter::new(wf_type);
|
|
118
|
-
starter.max_cached_workflows(1);
|
|
120
|
+
starter.no_remote_activities().max_cached_workflows(1);
|
|
119
121
|
let mut worker = starter.worker().await;
|
|
120
122
|
worker.register_wf(wf_type.to_string(), cache_evictions_wf);
|
|
121
123
|
|
|
@@ -160,7 +162,7 @@ async fn shutdown_aborts_actively_blocked_poll() {
|
|
|
160
162
|
let tcore = core.clone();
|
|
161
163
|
let handle = tokio::spawn(async move {
|
|
162
164
|
std::thread::sleep(Duration::from_millis(100));
|
|
163
|
-
tcore
|
|
165
|
+
drain_pollers_and_shutdown(&tcore).await;
|
|
164
166
|
});
|
|
165
167
|
assert_matches!(
|
|
166
168
|
core.poll_workflow_activation().await.unwrap_err(),
|
|
@@ -179,13 +181,20 @@ async fn shutdown_aborts_actively_blocked_poll() {
|
|
|
179
181
|
#[tokio::test]
|
|
180
182
|
async fn fail_wf_task(#[values(true, false)] replay: bool) {
|
|
181
183
|
let core = if replay {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
184
|
+
// We need to send the history twice, since we fail it the first time.
|
|
185
|
+
let mut hist_proto = history_from_proto_binary("histories/fail_wf_task.bin")
|
|
186
|
+
.await
|
|
187
|
+
.unwrap();
|
|
188
|
+
let hist = HistoryForReplay::new(hist_proto.clone(), "fake".to_string());
|
|
189
|
+
if let Some(history_event::Attributes::WorkflowExecutionStartedEventAttributes(
|
|
190
|
+
ref mut attrs,
|
|
191
|
+
)) = hist_proto.events[0].attributes
|
|
192
|
+
{
|
|
193
|
+
attrs.original_execution_run_id = "run2".to_string();
|
|
194
|
+
attrs.first_execution_run_id = "run2".to_string();
|
|
195
|
+
}
|
|
196
|
+
let hist2 = HistoryForReplay::new(hist_proto, "fake".to_string());
|
|
197
|
+
init_core_replay_preloaded("fail_wf_task", [hist, hist2])
|
|
189
198
|
} else {
|
|
190
199
|
let mut starter = init_core_and_create_wf("fail_wf_task").await;
|
|
191
200
|
starter.get_worker().await
|
|
@@ -425,8 +434,8 @@ async fn wft_timeout_doesnt_create_unsolvable_autocomplete() {
|
|
|
425
434
|
wf_starter
|
|
426
435
|
// Test needs eviction on and a short timeout
|
|
427
436
|
.max_cached_workflows(0)
|
|
428
|
-
.max_wft(1)
|
|
429
|
-
|
|
437
|
+
.max_wft(1);
|
|
438
|
+
wf_starter.workflow_options.task_timeout = Some(Duration::from_secs(1));
|
|
430
439
|
let core = wf_starter.get_worker().await;
|
|
431
440
|
let client = wf_starter.get_client().await;
|
|
432
441
|
let task_q = wf_starter.get_task_queue();
|
|
@@ -450,7 +459,7 @@ async fn wft_timeout_doesnt_create_unsolvable_autocomplete() {
|
|
|
450
459
|
.unwrap();
|
|
451
460
|
wf_task
|
|
452
461
|
};
|
|
453
|
-
wf_starter.
|
|
462
|
+
wf_starter.start_wf_with_id(wf_id.to_string()).await;
|
|
454
463
|
|
|
455
464
|
// Poll and schedule the activity
|
|
456
465
|
let wf_task = poll_sched_act().await;
|
|
@@ -562,7 +571,7 @@ async fn slow_completes_with_small_cache() {
|
|
|
562
571
|
for i in 0..20 {
|
|
563
572
|
worker
|
|
564
573
|
.submit_wf(
|
|
565
|
-
format!("{}_{}"
|
|
574
|
+
format!("{wf_name}_{i}"),
|
|
566
575
|
wf_name.to_owned(),
|
|
567
576
|
vec![],
|
|
568
577
|
WorkflowOptions::default(),
|
|
@@ -1,25 +1,16 @@
|
|
|
1
1
|
//! Integration tests
|
|
2
|
-
//!
|
|
3
|
-
//! Note that integ tests which want to use the server (nearly all of them) *need* to use the
|
|
4
|
-
//! `#[rstest]` macro and accept the TODO fixture to support auto setup & teardown of ephemeral
|
|
5
|
-
//! local servers.
|
|
6
2
|
|
|
7
3
|
#[macro_use]
|
|
8
4
|
extern crate rstest;
|
|
5
|
+
#[macro_use]
|
|
6
|
+
extern crate temporal_sdk_core_test_utils;
|
|
9
7
|
|
|
10
8
|
#[cfg(test)]
|
|
11
9
|
mod integ_tests {
|
|
12
|
-
#[macro_export]
|
|
13
|
-
macro_rules! prost_dur {
|
|
14
|
-
($dur_call:ident $args:tt) => {
|
|
15
|
-
std::time::Duration::$dur_call$args
|
|
16
|
-
.try_into()
|
|
17
|
-
.expect("test duration fits")
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
10
|
mod client_tests;
|
|
21
11
|
mod ephemeral_server_tests;
|
|
22
12
|
mod heartbeat_tests;
|
|
13
|
+
mod metrics_tests;
|
|
23
14
|
mod polling_tests;
|
|
24
15
|
mod queries_tests;
|
|
25
16
|
mod visibility_tests;
|
|
@@ -28,10 +19,10 @@ mod integ_tests {
|
|
|
28
19
|
use std::str::FromStr;
|
|
29
20
|
use temporal_client::WorkflowService;
|
|
30
21
|
use temporal_sdk_core::{
|
|
31
|
-
init_worker,
|
|
22
|
+
init_worker, ClientOptionsBuilder, ClientTlsConfig, CoreRuntime, TlsConfig,
|
|
32
23
|
WorkflowClientTrait,
|
|
33
24
|
};
|
|
34
|
-
use temporal_sdk_core_api::
|
|
25
|
+
use temporal_sdk_core_api::worker::WorkerConfigBuilder;
|
|
35
26
|
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::ListNamespacesRequest;
|
|
36
27
|
use temporal_sdk_core_test_utils::{
|
|
37
28
|
get_integ_server_options, get_integ_telem_options, NAMESPACE,
|
|
@@ -43,13 +34,14 @@ mod integ_tests {
|
|
|
43
34
|
#[ignore] // Really a compile time check more than anything
|
|
44
35
|
async fn lang_bridge_example() {
|
|
45
36
|
let opts = get_integ_server_options();
|
|
46
|
-
let
|
|
37
|
+
let runtime = CoreRuntime::new_assume_tokio(get_integ_telem_options()).unwrap();
|
|
47
38
|
let mut retrying_client = opts
|
|
48
|
-
.connect_no_namespace(
|
|
39
|
+
.connect_no_namespace(runtime.metric_meter().as_deref(), None)
|
|
49
40
|
.await
|
|
50
41
|
.unwrap();
|
|
51
42
|
|
|
52
43
|
let _worker = init_worker(
|
|
44
|
+
&runtime,
|
|
53
45
|
WorkerConfigBuilder::default()
|
|
54
46
|
.namespace("default")
|
|
55
47
|
.task_queue("Wheee!")
|