temporalio 1.4.1 → 1.6.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/Cargo.lock +1456 -616
- data/Cargo.toml +1 -1
- data/Gemfile +6 -5
- data/README.md +99 -1
- data/ext/Cargo.toml +9 -3
- data/lib/temporalio/activity/definition.rb +22 -0
- data/lib/temporalio/activity/info.rb +21 -5
- data/lib/temporalio/api/activity/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/billing/v1/message.rb +2 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +17 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +1 -1
- data/lib/temporalio/api/cloud/connectivityrule/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/identity/v1/message.rb +8 -1
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +5 -1
- data/lib/temporalio/api/command/v1/message.rb +2 -1
- data/lib/temporalio/api/common/v1/message.rb +5 -1
- data/lib/temporalio/api/deployment/v1/message.rb +3 -1
- data/lib/temporalio/api/history/v1/message.rb +3 -1
- data/lib/temporalio/api/namespace/v1/message.rb +1 -1
- data/lib/temporalio/api/nexus/v1/message.rb +1 -1
- data/lib/temporalio/api/nexusannotations/v1/options.rb +20 -0
- data/lib/temporalio/api/payload_visitor.rb +32 -0
- data/lib/temporalio/api/schedule/v1/message.rb +1 -1
- data/lib/temporalio/api/sdk/v1/event_group_marker.rb +26 -0
- data/lib/temporalio/api/update/v1/message.rb +1 -1
- data/lib/temporalio/api/workflow/v1/message.rb +3 -2
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +11 -1
- data/lib/temporalio/api/workflowservice/v1/service.rb +3 -2
- data/lib/temporalio/client/activity_execution.rb +221 -0
- data/lib/temporalio/client/activity_execution_count.rb +40 -0
- data/lib/temporalio/client/activity_execution_status.rb +20 -0
- data/lib/temporalio/client/activity_handle.rb +123 -0
- data/lib/temporalio/client/activity_id_reference.rb +42 -7
- data/lib/temporalio/client/connection/cloud_service.rb +120 -0
- data/lib/temporalio/client/connection/workflow_service.rb +75 -0
- data/lib/temporalio/client/connection.rb +37 -2
- data/lib/temporalio/client/interceptor.rb +149 -0
- data/lib/temporalio/client/pending_activity_state.rb +18 -0
- data/lib/temporalio/client/with_start_workflow_operation.rb +6 -0
- data/lib/temporalio/client.rb +214 -5
- data/lib/temporalio/common_enums.rb +28 -0
- data/lib/temporalio/error/failure.rb +22 -0
- data/lib/temporalio/error.rb +11 -0
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +1 -1
- data/lib/temporalio/internal/bridge/client.rb +6 -1
- data/lib/temporalio/internal/bridge.rb +20 -0
- data/lib/temporalio/internal/client/implementation.rb +213 -22
- data/lib/temporalio/internal/google_protobuf.rb +11 -0
- data/lib/temporalio/internal/worker/activity_worker.rb +15 -5
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +2 -0
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +3 -1
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +14 -4
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +73 -2
- data/lib/temporalio/internal/worker/workflow_instance.rb +36 -6
- data/lib/temporalio/internal/worker/workflow_worker.rb +10 -2
- data/lib/temporalio/internal/workflow_task_failure_error.rb +9 -0
- data/lib/temporalio/testing/activity_environment.rb +2 -0
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/activity_executor/fiber.rb +1 -1
- data/lib/temporalio/worker/activity_executor/thread_pool.rb +1 -1
- data/lib/temporalio/worker/illegal_workflow_call_validator.rb +3 -1
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +5 -1
- data/lib/temporalio/worker/workflow_replayer.rb +17 -4
- data/lib/temporalio/worker.rb +30 -5
- data/lib/temporalio/workflow/future.rb +5 -0
- data/lib/temporalio/workflow/nexus_operation_cancellation_type.rb +4 -2
- data/lib/temporalio/workflow.rb +8 -0
- data/rbi/google/protobuf.rbi +25 -0
- data/rbi/temporalio/activity/cancellation_details.rbi +33 -0
- data/rbi/temporalio/activity/complete_async_error.rbi +3 -0
- data/rbi/temporalio/activity/context.rbi +42 -0
- data/rbi/temporalio/activity/definition.rbi +74 -0
- data/rbi/temporalio/activity/info.rbi +112 -0
- data/rbi/temporalio/activity.rbi +3 -0
- data/rbi/temporalio/api/activity/v1/message.rbi +1453 -0
- data/rbi/temporalio/api/batch/v1/message.rbi +1283 -0
- data/rbi/temporalio/api/callback/v1/message.rbi +188 -0
- data/rbi/temporalio/api/cloud/account/v1/message.rbi +650 -0
- data/rbi/temporalio/api/cloud/auditlog/v1/message.rbi +318 -0
- data/rbi/temporalio/api/cloud/billing/v1/message.rbi +480 -0
- data/rbi/temporalio/api/cloud/cloudservice/v1/request_response.rbi +12454 -0
- data/rbi/temporalio/api/cloud/cloudservice/v1/service.rbi +3 -0
- data/rbi/temporalio/api/cloud/cloudservice/v1/service_services.rbi +709 -0
- data/rbi/temporalio/api/cloud/cloudservice.rbi +5 -0
- data/rbi/temporalio/api/cloud/connectivityrule/v1/message.rbi +403 -0
- data/rbi/temporalio/api/cloud/identity/v1/message.rbi +3072 -0
- data/rbi/temporalio/api/cloud/namespace/v1/message.rbi +3659 -0
- data/rbi/temporalio/api/cloud/nexus/v1/message.rbi +595 -0
- data/rbi/temporalio/api/cloud/operation/v1/message.rbi +244 -0
- data/rbi/temporalio/api/cloud/region/v1/message.rbi +166 -0
- data/rbi/temporalio/api/cloud/resource/v1/message.rbi +29 -0
- data/rbi/temporalio/api/cloud/sink/v1/message.rbi +438 -0
- data/rbi/temporalio/api/cloud/usage/v1/message.rbi +409 -0
- data/rbi/temporalio/api/command/v1/message.rbi +2655 -0
- data/rbi/temporalio/api/common/v1/grpc_status.rbi +92 -0
- data/rbi/temporalio/api/common/v1/message.rbi +2983 -0
- data/rbi/temporalio/api/compute/v1/config.rbi +421 -0
- data/rbi/temporalio/api/compute/v1/provider.rbi +125 -0
- data/rbi/temporalio/api/compute/v1/scaler.rbi +102 -0
- data/rbi/temporalio/api/deployment/v1/message.rbi +2340 -0
- data/rbi/temporalio/api/enums/v1/activity.rbi +62 -0
- data/rbi/temporalio/api/enums/v1/batch_operation.rbi +47 -0
- data/rbi/temporalio/api/enums/v1/command_type.rbi +36 -0
- data/rbi/temporalio/api/enums/v1/common.rbi +181 -0
- data/rbi/temporalio/api/enums/v1/deployment.rbi +80 -0
- data/rbi/temporalio/api/enums/v1/event_type.rbi +79 -0
- data/rbi/temporalio/api/enums/v1/failed_cause.rbi +155 -0
- data/rbi/temporalio/api/enums/v1/namespace.rbi +58 -0
- data/rbi/temporalio/api/enums/v1/nexus.rbi +98 -0
- data/rbi/temporalio/api/enums/v1/query.rbi +40 -0
- data/rbi/temporalio/api/enums/v1/reset.rbi +60 -0
- data/rbi/temporalio/api/enums/v1/schedule.rbi +25 -0
- data/rbi/temporalio/api/enums/v1/task_queue.rbi +134 -0
- data/rbi/temporalio/api/enums/v1/update.rbi +39 -0
- data/rbi/temporalio/api/enums/v1/workflow.rbi +259 -0
- data/rbi/temporalio/api/errordetails/v1/message.rbi +1389 -0
- data/rbi/temporalio/api/export/v1/message.rbi +123 -0
- data/rbi/temporalio/api/failure/v1/message.rbi +1303 -0
- data/rbi/temporalio/api/filter/v1/message.rbi +267 -0
- data/rbi/temporalio/api/history/v1/message.rbi +10737 -0
- data/rbi/temporalio/api/namespace/v1/message.rbi +1044 -0
- data/rbi/temporalio/api/nexus/v1/message.rbi +2780 -0
- data/rbi/temporalio/api/nexusannotations/v1/options.rbi +161 -0
- data/rbi/temporalio/api/nexusservices/workerservice/v1/request_response.rbi +124 -0
- data/rbi/temporalio/api/operatorservice/v1/request_response.rbi +1836 -0
- data/rbi/temporalio/api/operatorservice/v1/service.rbi +3 -0
- data/rbi/temporalio/api/operatorservice/v1/service_services.rbi +143 -0
- data/rbi/temporalio/api/operatorservice.rbi +5 -0
- data/rbi/temporalio/api/payload_visitor.rbi +876 -0
- data/rbi/temporalio/api/protoc_gen_openapiv2/options/annotations.rbi +3 -0
- data/rbi/temporalio/api/protoc_gen_openapiv2/options/openapiv2.rbi +3482 -0
- data/rbi/temporalio/api/protocol/v1/message.rbi +139 -0
- data/rbi/temporalio/api/protometa/v1/annotations.rbi +97 -0
- data/rbi/temporalio/api/query/v1/message.rbi +288 -0
- data/rbi/temporalio/api/replication/v1/message.rbi +226 -0
- data/rbi/temporalio/api/rules/v1/message.rbi +492 -0
- data/rbi/temporalio/api/schedule/v1/message.rbi +2377 -0
- data/rbi/temporalio/api/sdk/v1/enhanced_stack_trace.rbi +478 -0
- data/rbi/temporalio/api/sdk/v1/event_group_marker.rbi +337 -0
- data/rbi/temporalio/api/sdk/v1/external_storage.rbi +85 -0
- data/rbi/temporalio/api/sdk/v1/task_complete_metadata.rbi +206 -0
- data/rbi/temporalio/api/sdk/v1/user_metadata.rbi +98 -0
- data/rbi/temporalio/api/sdk/v1/worker_config.rbi +255 -0
- data/rbi/temporalio/api/sdk/v1/workflow_metadata.rbi +297 -0
- data/rbi/temporalio/api/taskqueue/v1/message.rbi +2460 -0
- data/rbi/temporalio/api/testservice/v1/request_response.rbi +380 -0
- data/rbi/temporalio/api/testservice/v1/service.rbi +3 -0
- data/rbi/temporalio/api/testservice/v1/service_services.rbi +100 -0
- data/rbi/temporalio/api/update/v1/message.rbi +800 -0
- data/rbi/temporalio/api/version/v1/message.rbi +281 -0
- data/rbi/temporalio/api/worker/v1/message.rbi +1565 -0
- data/rbi/temporalio/api/workflow/v1/message.rbi +5011 -0
- data/rbi/temporalio/api/workflowservice/v1/request_response.rbi +30477 -0
- data/rbi/temporalio/api/workflowservice/v1/service.rbi +3 -0
- data/rbi/temporalio/api/workflowservice/v1/service_services.rbi +1571 -0
- data/rbi/temporalio/api/workflowservice.rbi +5 -0
- data/rbi/temporalio/api.rbi +7 -0
- data/rbi/temporalio/cancellation.rbi +40 -0
- data/rbi/temporalio/client/activity_execution.rbi +134 -0
- data/rbi/temporalio/client/activity_execution_count.rbi +23 -0
- data/rbi/temporalio/client/activity_execution_status.rbi +11 -0
- data/rbi/temporalio/client/activity_handle.rbi +49 -0
- data/rbi/temporalio/client/activity_id_reference.rbi +24 -0
- data/rbi/temporalio/client/async_activity_handle.rbi +49 -0
- data/rbi/temporalio/client/connection/cloud_service.rbi +239 -0
- data/rbi/temporalio/client/connection/operator_service.rbi +47 -0
- data/rbi/temporalio/client/connection/service.rbi +19 -0
- data/rbi/temporalio/client/connection/test_service.rbi +29 -0
- data/rbi/temporalio/client/connection/workflow_service.rbi +377 -0
- data/rbi/temporalio/client/connection.rbi +284 -0
- data/rbi/temporalio/client/interceptor.rbi +1067 -0
- data/rbi/temporalio/client/pending_activity_state.rbi +9 -0
- data/rbi/temporalio/client/plugin.rbi +17 -0
- data/rbi/temporalio/client/schedule.rbi +677 -0
- data/rbi/temporalio/client/schedule_handle.rbi +40 -0
- data/rbi/temporalio/client/with_start_workflow_operation.rbi +126 -0
- data/rbi/temporalio/client/workflow_execution.rbi +62 -0
- data/rbi/temporalio/client/workflow_execution_count.rbi +23 -0
- data/rbi/temporalio/client/workflow_execution_status.rbi +11 -0
- data/rbi/temporalio/client/workflow_handle.rbi +148 -0
- data/rbi/temporalio/client/workflow_query_reject_condition.rbi +7 -0
- data/rbi/temporalio/client/workflow_update_handle.rbi +38 -0
- data/rbi/temporalio/client/workflow_update_wait_stage.rbi +7 -0
- data/rbi/temporalio/client.rbi +534 -0
- data/rbi/temporalio/common_enums.rbi +45 -0
- data/rbi/temporalio/contrib/open_telemetry.rbi +73 -0
- data/rbi/temporalio/converters/data_converter.rbi +44 -0
- data/rbi/temporalio/converters/failure_converter.rbi +20 -0
- data/rbi/temporalio/converters/payload_codec.rbi +11 -0
- data/rbi/temporalio/converters/payload_converter/binary_null.rbi +5 -0
- data/rbi/temporalio/converters/payload_converter/binary_plain.rbi +5 -0
- data/rbi/temporalio/converters/payload_converter/binary_protobuf.rbi +5 -0
- data/rbi/temporalio/converters/payload_converter/composite.rbi +20 -0
- data/rbi/temporalio/converters/payload_converter/encoding.rbi +14 -0
- data/rbi/temporalio/converters/payload_converter/json_plain.rbi +10 -0
- data/rbi/temporalio/converters/payload_converter/json_protobuf.rbi +5 -0
- data/rbi/temporalio/converters/payload_converter.rbi +28 -0
- data/rbi/temporalio/converters/raw_value.rbi +11 -0
- data/rbi/temporalio/converters.rbi +3 -0
- data/rbi/temporalio/env_config.rbi +156 -0
- data/rbi/temporalio/error/failure.rbi +3 -0
- data/rbi/temporalio/error.rbi +313 -0
- data/rbi/temporalio/internal/bridge/api/activity_result/activity_result.rbi +547 -0
- data/rbi/temporalio/internal/bridge/api/activity_task/activity_task.rbi +705 -0
- data/rbi/temporalio/internal/bridge/api/child_workflow/child_workflow.rbi +332 -0
- data/rbi/temporalio/internal/bridge/api/common/common.rbi +191 -0
- data/rbi/temporalio/internal/bridge/api/core_interface.rbi +567 -0
- data/rbi/temporalio/internal/bridge/api/external_data/external_data.rbi +255 -0
- data/rbi/temporalio/internal/bridge/api/nexus/nexus.rbi +527 -0
- data/rbi/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rbi +2808 -0
- data/rbi/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rbi +3309 -0
- data/rbi/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rbi +272 -0
- data/rbi/temporalio/internal/bridge/api.rbi +3 -0
- data/rbi/temporalio/internal/bridge/client.rbi +346 -0
- data/rbi/temporalio/internal/bridge/runtime.rbi +231 -0
- data/rbi/temporalio/internal/bridge/testing.rbi +109 -0
- data/rbi/temporalio/internal/bridge/worker.rbi +250 -0
- data/rbi/temporalio/internal/bridge.rbi +47 -0
- data/rbi/temporalio/internal/client/implementation.rbi +53 -0
- data/rbi/temporalio/internal/google_protobuf.rbi +8 -0
- data/rbi/temporalio/internal/metric.rbi +55 -0
- data/rbi/temporalio/internal/proto_utils.rbi +148 -0
- data/rbi/temporalio/internal/worker/activity_worker.rbi +108 -0
- data/rbi/temporalio/internal/worker/multi_runner.rbi +175 -0
- data/rbi/temporalio/internal/worker/workflow_instance/child_workflow_handle.rbi +20 -0
- data/rbi/temporalio/internal/worker/workflow_instance/context.rbi +290 -0
- data/rbi/temporalio/internal/worker/workflow_instance/details.rbi +87 -0
- data/rbi/temporalio/internal/worker/workflow_instance/external_workflow_handle.rbi +14 -0
- data/rbi/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rbi +17 -0
- data/rbi/temporalio/internal/worker/workflow_instance/handler_execution.rbi +17 -0
- data/rbi/temporalio/internal/worker/workflow_instance/handler_hash.rbi +24 -0
- data/rbi/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rbi +17 -0
- data/rbi/temporalio/internal/worker/workflow_instance/inbound_implementation.rbi +21 -0
- data/rbi/temporalio/internal/worker/workflow_instance/nexus_client.rbi +47 -0
- data/rbi/temporalio/internal/worker/workflow_instance/nexus_operation_handle.rbi +19 -0
- data/rbi/temporalio/internal/worker/workflow_instance/outbound_implementation.rbi +43 -0
- data/rbi/temporalio/internal/worker/workflow_instance/replay_safe_logger.rbi +11 -0
- data/rbi/temporalio/internal/worker/workflow_instance/replay_safe_metric.rbi +15 -0
- data/rbi/temporalio/internal/worker/workflow_instance/scheduler.rbi +36 -0
- data/rbi/temporalio/internal/worker/workflow_instance.rbi +231 -0
- data/rbi/temporalio/internal/worker/workflow_worker.rbi +199 -0
- data/rbi/temporalio/internal/workflow_task_failure_error.rbi +3 -0
- data/rbi/temporalio/internal.rbi +3 -0
- data/rbi/temporalio/metric.rbi +56 -0
- data/rbi/temporalio/priority.rbi +38 -0
- data/rbi/temporalio/retry_policy.rbi +40 -0
- data/rbi/temporalio/runtime/metric_buffer.rbi +45 -0
- data/rbi/temporalio/runtime.rbi +185 -0
- data/rbi/temporalio/scoped_logger.rbi +50 -0
- data/rbi/temporalio/search_attributes.rbi +94 -0
- data/rbi/temporalio/simple_plugin.rbi +41 -0
- data/rbi/temporalio/testing/activity_environment.rbi +43 -0
- data/rbi/temporalio/testing/workflow_environment.rbi +116 -0
- data/rbi/temporalio/testing.rbi +3 -0
- data/rbi/temporalio/version.rbi +5 -0
- data/rbi/temporalio/versioning_override.rbi +13 -0
- data/rbi/temporalio/worker/activity_executor/fiber.rbi +20 -0
- data/rbi/temporalio/worker/activity_executor/thread_pool.rbi +20 -0
- data/rbi/temporalio/worker/activity_executor.rbi +20 -0
- data/rbi/temporalio/worker/deployment_options.rbi +23 -0
- data/rbi/temporalio/worker/illegal_workflow_call_validator.rbi +33 -0
- data/rbi/temporalio/worker/interceptor.rbi +489 -0
- data/rbi/temporalio/worker/plugin.rbi +49 -0
- data/rbi/temporalio/worker/poller_behavior.rbi +29 -0
- data/rbi/temporalio/worker/thread_pool.rbi +38 -0
- data/rbi/temporalio/worker/tuner.rbi +221 -0
- data/rbi/temporalio/worker/workflow_executor/thread_pool.rbi +15 -0
- data/rbi/temporalio/worker/workflow_executor.rbi +8 -0
- data/rbi/temporalio/worker/workflow_replayer.rbi +152 -0
- data/rbi/temporalio/worker.rbi +258 -0
- data/rbi/temporalio/worker_deployment_version.rbi +29 -0
- data/rbi/temporalio/workflow/activity_cancellation_type.rbi +7 -0
- data/rbi/temporalio/workflow/child_workflow_cancellation_type.rbi +8 -0
- data/rbi/temporalio/workflow/child_workflow_handle.rbi +27 -0
- data/rbi/temporalio/workflow/definition.rbi +305 -0
- data/rbi/temporalio/workflow/external_workflow_handle.rbi +24 -0
- data/rbi/temporalio/workflow/future.rbi +62 -0
- data/rbi/temporalio/workflow/handler_unfinished_policy.rbi +6 -0
- data/rbi/temporalio/workflow/info.rbi +100 -0
- data/rbi/temporalio/workflow/nexus_client.rbi +65 -0
- data/rbi/temporalio/workflow/nexus_operation_cancellation_type.rbi +8 -0
- data/rbi/temporalio/workflow/nexus_operation_handle.rbi +14 -0
- data/rbi/temporalio/workflow/parent_close_policy.rbi +8 -0
- data/rbi/temporalio/workflow/update_info.rbi +14 -0
- data/rbi/temporalio/workflow.rbi +393 -0
- data/rbi/temporalio/workflow_history.rbi +21 -0
- data/rbi/temporalio.rbi +5 -0
- data/sig/common.rbs +1 -0
- data/sig/google/protobuf_compat.rbs +17 -0
- data/sig/open_telemetry.rbs +47 -0
- data/sig/temporalio/activity/cancellation_details.rbs +21 -0
- data/sig/temporalio/activity/complete_async_error.rbs +6 -0
- data/sig/temporalio/activity/context.rbs +26 -0
- data/sig/temporalio/activity/definition.rbs +60 -0
- data/sig/temporalio/activity/info.rbs +57 -0
- data/sig/temporalio/activity.rbs +4 -0
- data/sig/temporalio/api/activity/v1/message.rbs +708 -0
- data/sig/temporalio/api/batch/v1/message.rbs +594 -0
- data/sig/temporalio/api/callback/v1/message.rbs +112 -0
- data/sig/temporalio/api/cloud/account/v1/message.rbs +314 -0
- data/sig/temporalio/api/cloud/auditlog/v1/message.rbs +168 -0
- data/sig/temporalio/api/cloud/billing/v1/message.rbs +279 -0
- data/sig/temporalio/api/cloud/cloudservice/v1/request_response.rbs +4726 -0
- data/sig/temporalio/api/cloud/cloudservice/v1/service.rbs +25 -0
- data/sig/temporalio/api/cloud/cloudservice.rbs +8 -0
- data/sig/temporalio/api/cloud/connectivityrule/v1/message.rbs +191 -0
- data/sig/temporalio/api/cloud/identity/v1/message.rbs +1372 -0
- data/sig/temporalio/api/cloud/namespace/v1/message.rbs +1571 -0
- data/sig/temporalio/api/cloud/nexus/v1/message.rbs +269 -0
- data/sig/temporalio/api/cloud/operation/v1/message.rbs +156 -0
- data/sig/temporalio/api/cloud/region/v1/message.rbs +109 -0
- data/sig/temporalio/api/cloud/resource/v1/message.rbs +61 -0
- data/sig/temporalio/api/cloud/sink/v1/message.rbs +207 -0
- data/sig/temporalio/api/cloud/usage/v1/message.rbs +230 -0
- data/sig/temporalio/api/command/v1/message.rbs +1211 -0
- data/sig/temporalio/api/common/v1/grpc_status.rbs +59 -0
- data/sig/temporalio/api/common/v1/message.rbs +1238 -0
- data/sig/temporalio/api/compute/v1/config.rbs +176 -0
- data/sig/temporalio/api/compute/v1/provider.rbs +73 -0
- data/sig/temporalio/api/compute/v1/scaler.rbs +60 -0
- data/sig/temporalio/api/deployment/v1/message.rbs +1063 -0
- data/sig/temporalio/api/enums/v1/activity.rbs +134 -0
- data/sig/temporalio/api/enums/v1/batch_operation.rbs +80 -0
- data/sig/temporalio/api/enums/v1/command_type.rbs +74 -0
- data/sig/temporalio/api/enums/v1/common.rbs +271 -0
- data/sig/temporalio/api/enums/v1/deployment.rbs +177 -0
- data/sig/temporalio/api/enums/v1/event_type.rbs +263 -0
- data/sig/temporalio/api/enums/v1/failed_cause.rbs +281 -0
- data/sig/temporalio/api/enums/v1/namespace.rbs +87 -0
- data/sig/temporalio/api/enums/v1/nexus.rbs +172 -0
- data/sig/temporalio/api/enums/v1/query.rbs +69 -0
- data/sig/temporalio/api/enums/v1/reset.rbs +106 -0
- data/sig/temporalio/api/enums/v1/schedule.rbs +68 -0
- data/sig/temporalio/api/enums/v1/task_queue.rbs +238 -0
- data/sig/temporalio/api/enums/v1/update.rbs +87 -0
- data/sig/temporalio/api/enums/v1/workflow.rbs +435 -0
- data/sig/temporalio/api/errordetails/v1/message.rbs +532 -0
- data/sig/temporalio/api/export/v1/message.rbs +63 -0
- data/sig/temporalio/api/failure/v1/message.rbs +579 -0
- data/sig/temporalio/api/filter/v1/message.rbs +121 -0
- data/sig/temporalio/api/history/v1/message.rbs +4928 -0
- data/sig/temporalio/api/namespace/v1/message.rbs +465 -0
- data/sig/temporalio/api/nexus/v1/message.rbs +1268 -0
- data/sig/temporalio/api/nexusannotations/v1/options.rbs +76 -0
- data/sig/temporalio/api/nexusservices/workerservice/v1/request_response.rbs +65 -0
- data/sig/temporalio/api/operatorservice/v1/request_response.rbs +679 -0
- data/sig/temporalio/api/operatorservice/v1/service.rbs +23 -0
- data/sig/temporalio/api/operatorservice.rbs +6 -0
- data/sig/temporalio/api/payload_visitor.rbs +298 -0
- data/sig/temporalio/api/protoc_gen_openapiv2/options/annotations.rbs +23 -0
- data/sig/temporalio/api/protoc_gen_openapiv2/options/openapiv2.rbs +1691 -0
- data/sig/temporalio/api/protocol/v1/message.rbs +90 -0
- data/sig/temporalio/api/protometa/v1/annotations.rbs +62 -0
- data/sig/temporalio/api/query/v1/message.rbs +138 -0
- data/sig/temporalio/api/replication/v1/message.rbs +109 -0
- data/sig/temporalio/api/rules/v1/message.rbs +213 -0
- data/sig/temporalio/api/schedule/v1/message.rbs +1066 -0
- data/sig/temporalio/api/sdk/v1/enhanced_stack_trace.rbs +210 -0
- data/sig/temporalio/api/sdk/v1/event_group_marker.rbs +154 -0
- data/sig/temporalio/api/sdk/v1/external_storage.rbs +54 -0
- data/sig/temporalio/api/sdk/v1/task_complete_metadata.rbs +92 -0
- data/sig/temporalio/api/sdk/v1/user_metadata.rbs +58 -0
- data/sig/temporalio/api/sdk/v1/worker_config.rbs +122 -0
- data/sig/temporalio/api/sdk/v1/workflow_metadata.rbs +138 -0
- data/sig/temporalio/api/taskqueue/v1/message.rbs +1013 -0
- data/sig/temporalio/api/testservice/v1/request_response.rbs +125 -0
- data/sig/temporalio/api/testservice/v1/service.rbs +23 -0
- data/sig/temporalio/api/update/v1/message.rbs +349 -0
- data/sig/temporalio/api/version/v1/message.rbs +143 -0
- data/sig/temporalio/api/worker/v1/message.rbs +716 -0
- data/sig/temporalio/api/workflow/v1/message.rbs +2322 -0
- data/sig/temporalio/api/workflowservice/v1/request_response.rbs +12735 -0
- data/sig/temporalio/api/workflowservice/v1/service.rbs +23 -0
- data/sig/temporalio/api/workflowservice.rbs +6 -0
- data/sig/temporalio/api.rbs +4 -0
- data/sig/temporalio/cancellation.rbs +20 -0
- data/sig/temporalio/client/activity_execution.rbs +50 -0
- data/sig/temporalio/client/activity_execution_count.rbs +17 -0
- data/sig/temporalio/client/activity_execution_status.rbs +15 -0
- data/sig/temporalio/client/activity_handle.rbs +26 -0
- data/sig/temporalio/client/activity_id_reference.rbs +16 -0
- data/sig/temporalio/client/async_activity_handle.rbs +41 -0
- data/sig/temporalio/client/connection/cloud_service.rbs +315 -0
- data/sig/temporalio/client/connection/operator_service.rbs +59 -0
- data/sig/temporalio/client/connection/service.rbs +17 -0
- data/sig/temporalio/client/connection/test_service.rbs +35 -0
- data/sig/temporalio/client/connection/workflow_service.rbs +499 -0
- data/sig/temporalio/client/connection.rbs +143 -0
- data/sig/temporalio/client/interceptor.rbs +622 -0
- data/sig/temporalio/client/pending_activity_state.rbs +14 -0
- data/sig/temporalio/client/plugin.rbs +14 -0
- data/sig/temporalio/client/schedule.rbs +337 -0
- data/sig/temporalio/client/schedule_handle.rbs +44 -0
- data/sig/temporalio/client/with_start_workflow_operation.rbs +82 -0
- data/sig/temporalio/client/workflow_execution.rbs +37 -0
- data/sig/temporalio/client/workflow_execution_count.rbs +17 -0
- data/sig/temporalio/client/workflow_execution_status.rbs +16 -0
- data/sig/temporalio/client/workflow_handle.rbs +95 -0
- data/sig/temporalio/client/workflow_query_reject_condition.rbs +12 -0
- data/sig/temporalio/client/workflow_update_handle.rbs +26 -0
- data/sig/temporalio/client/workflow_update_wait_stage.rbs +12 -0
- data/sig/temporalio/client.rbs +271 -0
- data/sig/temporalio/common_enums.rbs +60 -0
- data/sig/temporalio/contrib/open_telemetry.rbs +74 -0
- data/sig/temporalio/converters/data_converter.rbs +32 -0
- data/sig/temporalio/converters/failure_converter.rbs +12 -0
- data/sig/temporalio/converters/payload_codec.rbs +8 -0
- data/sig/temporalio/converters/payload_converter/binary_null.rbs +9 -0
- data/sig/temporalio/converters/payload_converter/binary_plain.rbs +9 -0
- data/sig/temporalio/converters/payload_converter/binary_protobuf.rbs +9 -0
- data/sig/temporalio/converters/payload_converter/composite.rbs +16 -0
- data/sig/temporalio/converters/payload_converter/encoding.rbs +13 -0
- data/sig/temporalio/converters/payload_converter/json_plain.rbs +14 -0
- data/sig/temporalio/converters/payload_converter/json_protobuf.rbs +9 -0
- data/sig/temporalio/converters/payload_converter.rbs +24 -0
- data/sig/temporalio/converters/raw_value.rbs +9 -0
- data/sig/temporalio/converters.rbs +4 -0
- data/sig/temporalio/env_config.rbs +86 -0
- data/sig/temporalio/error/failure.rbs +170 -0
- data/sig/temporalio/error.rbs +88 -0
- data/sig/temporalio/internal/bridge/api/activity_result/activity_result.rbs +247 -0
- data/sig/temporalio/internal/bridge/api/activity_task/activity_task.rbs +372 -0
- data/sig/temporalio/internal/bridge/api/child_workflow/child_workflow.rbs +207 -0
- data/sig/temporalio/internal/bridge/api/common/common.rbs +123 -0
- data/sig/temporalio/internal/bridge/api/core_interface.rbs +231 -0
- data/sig/temporalio/internal/bridge/api/external_data/external_data.rbs +134 -0
- data/sig/temporalio/internal/bridge/api/nexus/nexus.rbs +285 -0
- data/sig/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rbs +1304 -0
- data/sig/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rbs +1526 -0
- data/sig/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rbs +136 -0
- data/sig/temporalio/internal/bridge/api.rbs +8 -0
- data/sig/temporalio/internal/bridge/client.rbs +144 -0
- data/sig/temporalio/internal/bridge/metric.rbs +28 -0
- data/sig/temporalio/internal/bridge/runtime.rbs +97 -0
- data/sig/temporalio/internal/bridge/testing.rbs +91 -0
- data/sig/temporalio/internal/bridge/worker.rbs +199 -0
- data/sig/temporalio/internal/bridge.rbs +36 -0
- data/sig/temporalio/internal/client/implementation.rbs +33 -0
- data/sig/temporalio/internal/google_protobuf.rbs +7 -0
- data/sig/temporalio/internal/metric.rbs +35 -0
- data/sig/temporalio/internal/proto_utils.rbs +94 -0
- data/sig/temporalio/internal/worker/activity_worker.rbs +64 -0
- data/sig/temporalio/internal/worker/multi_runner.rbs +132 -0
- data/sig/temporalio/internal/worker/workflow_instance/child_workflow_handle.rbs +22 -0
- data/sig/temporalio/internal/worker/workflow_instance/context.rbs +172 -0
- data/sig/temporalio/internal/worker/workflow_instance/details.rbs +43 -0
- data/sig/temporalio/internal/worker/workflow_instance/external_workflow_handle.rbs +15 -0
- data/sig/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rbs +16 -0
- data/sig/temporalio/internal/worker/workflow_instance/handler_execution.rbs +19 -0
- data/sig/temporalio/internal/worker/workflow_instance/handler_hash.rbs +14 -0
- data/sig/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rbs +20 -0
- data/sig/temporalio/internal/worker/workflow_instance/inbound_implementation.rbs +19 -0
- data/sig/temporalio/internal/worker/workflow_instance/nexus_client.rbs +25 -0
- data/sig/temporalio/internal/worker/workflow_instance/nexus_operation_handle.rbs +19 -0
- data/sig/temporalio/internal/worker/workflow_instance/outbound_implementation.rbs +35 -0
- data/sig/temporalio/internal/worker/workflow_instance/replay_safe_logger.rbs +16 -0
- data/sig/temporalio/internal/worker/workflow_instance/replay_safe_metric.rbs +15 -0
- data/sig/temporalio/internal/worker/workflow_instance/scheduler.rbs +52 -0
- data/sig/temporalio/internal/worker/workflow_instance.rbs +111 -0
- data/sig/temporalio/internal/worker/workflow_worker.rbs +99 -0
- data/sig/temporalio/internal/workflow_task_failure_error.rbs +6 -0
- data/sig/temporalio/internal.rbs +4 -0
- data/sig/temporalio/metric.rbs +55 -0
- data/sig/temporalio/priority.rbs +17 -0
- data/sig/temporalio/retry_policy.rbs +21 -0
- data/sig/temporalio/runtime/metric_buffer.rbs +49 -0
- data/sig/temporalio/runtime.rbs +118 -0
- data/sig/temporalio/scoped_logger.rbs +15 -0
- data/sig/temporalio/search_attributes.rbs +82 -0
- data/sig/temporalio/simple_plugin.rbs +65 -0
- data/sig/temporalio/testing/activity_environment.rbs +52 -0
- data/sig/temporalio/testing/workflow_environment.rbs +141 -0
- data/sig/temporalio/testing.rbs +4 -0
- data/sig/temporalio/version.rbs +3 -0
- data/sig/temporalio/versioning_override.rbs +17 -0
- data/sig/temporalio/worker/activity_executor/fiber.rbs +9 -0
- data/sig/temporalio/worker/activity_executor/thread_pool.rbs +11 -0
- data/sig/temporalio/worker/activity_executor.rbs +12 -0
- data/sig/temporalio/worker/deployment_options.rbs +17 -0
- data/sig/temporalio/worker/illegal_workflow_call_validator.rbs +25 -0
- data/sig/temporalio/worker/interceptor.rbs +373 -0
- data/sig/temporalio/worker/plugin.rbs +47 -0
- data/sig/temporalio/worker/poller_behavior.rbs +23 -0
- data/sig/temporalio/worker/thread_pool.rbs +44 -0
- data/sig/temporalio/worker/tuner.rbs +121 -0
- data/sig/temporalio/worker/workflow_executor/thread_pool.rbs +58 -0
- data/sig/temporalio/worker/workflow_executor.rbs +15 -0
- data/sig/temporalio/worker/workflow_replayer.rbs +105 -0
- data/sig/temporalio/worker.rbs +168 -0
- data/sig/temporalio/worker_deployment_version.rbs +17 -0
- data/sig/temporalio/workflow/activity_cancellation_type.rbs +11 -0
- data/sig/temporalio/workflow/child_workflow_cancellation_type.rbs +12 -0
- data/sig/temporalio/workflow/child_workflow_handle.rbs +18 -0
- data/sig/temporalio/workflow/definition.rbs +181 -0
- data/sig/temporalio/workflow/external_workflow_handle.rbs +17 -0
- data/sig/temporalio/workflow/future.rbs +24 -0
- data/sig/temporalio/workflow/handler_unfinished_policy.rbs +10 -0
- data/sig/temporalio/workflow/info.rbs +79 -0
- data/sig/temporalio/workflow/nexus_client.rbs +34 -0
- data/sig/temporalio/workflow/nexus_operation_cancellation_type.rbs +12 -0
- data/sig/temporalio/workflow/nexus_operation_handle.rbs +10 -0
- data/sig/temporalio/workflow/parent_close_policy.rbs +12 -0
- data/sig/temporalio/workflow/update_info.rbs +15 -0
- data/sig/temporalio/workflow.rbs +215 -0
- data/sig/temporalio/workflow_history.rbs +13 -0
- data/sig/temporalio.rbs +3 -0
- data/temporalio.gemspec +1 -1
- metadata +450 -2
|
@@ -74,6 +74,7 @@ module Temporalio
|
|
|
74
74
|
workflow_failure_exception_types:,
|
|
75
75
|
workflow_payload_codec_thread_pool:,
|
|
76
76
|
unsafe_workflow_io_enabled:,
|
|
77
|
+
patch_activation_callback:,
|
|
77
78
|
debug_mode:,
|
|
78
79
|
assert_valid_local_activity:, on_eviction: nil
|
|
79
80
|
)
|
|
@@ -118,6 +119,7 @@ module Temporalio
|
|
|
118
119
|
t
|
|
119
120
|
end.freeze,
|
|
120
121
|
unsafe_workflow_io_enabled:,
|
|
122
|
+
patch_activation_callback:,
|
|
121
123
|
assert_valid_local_activity:
|
|
122
124
|
)
|
|
123
125
|
@state.on_eviction = on_eviction if on_eviction
|
|
@@ -145,6 +147,8 @@ module Temporalio
|
|
|
145
147
|
@state.logger.error(e)
|
|
146
148
|
end
|
|
147
149
|
|
|
150
|
+
# Returns whether completion was submitted to the bridge
|
|
151
|
+
# rubocop:disable Naming/PredicateMethod
|
|
148
152
|
def handle_activation_complete(runner:, activation_completion:, encoded:, completion_complete_queue:)
|
|
149
153
|
if @payload_encoding_visitor && !encoded
|
|
150
154
|
if Fiber.current_scheduler
|
|
@@ -154,12 +158,15 @@ module Temporalio
|
|
|
154
158
|
encode_activation_completion(runner, activation_completion)
|
|
155
159
|
end
|
|
156
160
|
end
|
|
161
|
+
false
|
|
157
162
|
else
|
|
158
163
|
@state.bridge_worker.async_complete_workflow_activation(
|
|
159
164
|
activation_completion.run_id, activation_completion.to_proto, completion_complete_queue
|
|
160
165
|
)
|
|
166
|
+
true
|
|
161
167
|
end
|
|
162
168
|
end
|
|
169
|
+
# rubocop:enable Naming/PredicateMethod
|
|
163
170
|
|
|
164
171
|
def on_shutdown_complete
|
|
165
172
|
@state.evict_all
|
|
@@ -194,7 +201,7 @@ module Temporalio
|
|
|
194
201
|
attr_reader :workflow_definitions, :bridge_worker, :logger, :metric_meter, :data_converter, :deadlock_timeout,
|
|
195
202
|
:illegal_calls, :namespace, :task_queue, :disable_eager_activity_execution,
|
|
196
203
|
:workflow_interceptors, :workflow_failure_exception_types, :unsafe_workflow_io_enabled,
|
|
197
|
-
:assert_valid_local_activity
|
|
204
|
+
:patch_activation_callback, :assert_valid_local_activity
|
|
198
205
|
|
|
199
206
|
attr_writer :on_eviction
|
|
200
207
|
|
|
@@ -202,7 +209,7 @@ module Temporalio
|
|
|
202
209
|
workflow_definitions:, bridge_worker:, logger:, metric_meter:, data_converter:, deadlock_timeout:,
|
|
203
210
|
illegal_calls:, namespace:, task_queue:, disable_eager_activity_execution:,
|
|
204
211
|
workflow_interceptors:, workflow_failure_exception_types:, unsafe_workflow_io_enabled:,
|
|
205
|
-
assert_valid_local_activity:
|
|
212
|
+
patch_activation_callback:, assert_valid_local_activity:
|
|
206
213
|
)
|
|
207
214
|
@workflow_definitions = workflow_definitions
|
|
208
215
|
@bridge_worker = bridge_worker
|
|
@@ -217,6 +224,7 @@ module Temporalio
|
|
|
217
224
|
@workflow_interceptors = workflow_interceptors
|
|
218
225
|
@workflow_failure_exception_types = workflow_failure_exception_types
|
|
219
226
|
@unsafe_workflow_io_enabled = unsafe_workflow_io_enabled
|
|
227
|
+
@patch_activation_callback = patch_activation_callback
|
|
220
228
|
@assert_valid_local_activity = assert_valid_local_activity
|
|
221
229
|
|
|
222
230
|
@running_workflows = {}
|
|
@@ -18,11 +18,13 @@ module Temporalio
|
|
|
18
18
|
def self.default_info
|
|
19
19
|
@default_info ||= Activity::Info.new(
|
|
20
20
|
activity_id: 'test',
|
|
21
|
+
activity_run_id: nil,
|
|
21
22
|
activity_type: 'unknown',
|
|
22
23
|
attempt: 1,
|
|
23
24
|
current_attempt_scheduled_time: Time.at(0),
|
|
24
25
|
heartbeat_timeout: nil,
|
|
25
26
|
local?: false,
|
|
27
|
+
namespace: 'default',
|
|
26
28
|
priority: Temporalio::Priority.default,
|
|
27
29
|
raw_heartbeat_details: [],
|
|
28
30
|
retry_policy: RetryPolicy.new,
|
data/lib/temporalio/version.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'temporalio/internal/google_protobuf'
|
|
4
|
+
|
|
3
5
|
module Temporalio
|
|
4
6
|
class Worker
|
|
5
7
|
# Custom validator for validating illegal workflow calls.
|
|
@@ -44,7 +46,7 @@ module Temporalio
|
|
|
44
46
|
def self.known_safe_mutex_validator
|
|
45
47
|
@known_safe_mutex_validator ||= IllegalWorkflowCallValidator.new do
|
|
46
48
|
# Only Google Protobuf use of Mutex is known to be safe, fail unless any caller location path has protobuf
|
|
47
|
-
raise 'disallowed' unless
|
|
49
|
+
raise 'disallowed' unless ::Temporalio::Internal::GoogleProtobuf.in_call_stack?(caller_locations)
|
|
48
50
|
end
|
|
49
51
|
end
|
|
50
52
|
|
|
@@ -4,6 +4,7 @@ require 'etc'
|
|
|
4
4
|
require 'temporalio/internal/bridge/api'
|
|
5
5
|
require 'temporalio/internal/proto_utils'
|
|
6
6
|
require 'temporalio/internal/worker/workflow_instance'
|
|
7
|
+
require 'temporalio/internal/workflow_task_failure_error'
|
|
7
8
|
require 'temporalio/scoped_logger'
|
|
8
9
|
require 'temporalio/worker/thread_pool'
|
|
9
10
|
require 'temporalio/worker/workflow_executor'
|
|
@@ -215,6 +216,7 @@ module Temporalio
|
|
|
215
216
|
illegal_calls: worker_state.illegal_calls,
|
|
216
217
|
workflow_failure_exception_types: worker_state.workflow_failure_exception_types,
|
|
217
218
|
unsafe_workflow_io_enabled: worker_state.unsafe_workflow_io_enabled,
|
|
219
|
+
patch_activation_callback: worker_state.patch_activation_callback,
|
|
218
220
|
assert_valid_local_activity: worker_state.assert_valid_local_activity
|
|
219
221
|
)
|
|
220
222
|
)
|
|
@@ -229,7 +231,9 @@ module Temporalio
|
|
|
229
231
|
private_constant :Worker
|
|
230
232
|
|
|
231
233
|
# Error raised when a processing a workflow task takes more than the expected amount of time.
|
|
232
|
-
class DeadlockError < Exception
|
|
234
|
+
class DeadlockError < Exception # rubocop:disable Lint/InheritException
|
|
235
|
+
include Internal::WorkflowTaskFailureError
|
|
236
|
+
end
|
|
233
237
|
end
|
|
234
238
|
end
|
|
235
239
|
end
|
|
@@ -264,6 +264,7 @@ module Temporalio
|
|
|
264
264
|
workflow_failure_exception_types: options.workflow_failure_exception_types,
|
|
265
265
|
workflow_payload_codec_thread_pool: options.workflow_payload_codec_thread_pool,
|
|
266
266
|
unsafe_workflow_io_enabled: options.unsafe_workflow_io_enabled,
|
|
267
|
+
patch_activation_callback: nil,
|
|
267
268
|
debug_mode: options.debug_mode,
|
|
268
269
|
on_eviction: proc { |_, remove_job| @last_workflow_remove_job = remove_job }, # steep:ignore
|
|
269
270
|
assert_valid_local_activity: ->(_) {}
|
|
@@ -271,6 +272,8 @@ module Temporalio
|
|
|
271
272
|
|
|
272
273
|
# Create the runner
|
|
273
274
|
@runner = Internal::Worker::MultiRunner.new(workers: [self], shutdown_signals: [])
|
|
275
|
+
@pending_workflow_activations = 0
|
|
276
|
+
@pending_workflow_activation_completions = 0
|
|
274
277
|
end
|
|
275
278
|
|
|
276
279
|
# Replay a workflow history.
|
|
@@ -295,11 +298,12 @@ module Temporalio
|
|
|
295
298
|
history.workflow_id, Api::History::V1::History.new(events: history.events).to_proto
|
|
296
299
|
)
|
|
297
300
|
|
|
298
|
-
# Process events until workflow complete
|
|
299
|
-
until @last_workflow_remove_job
|
|
301
|
+
# Process events until workflow complete and all completions submitted to core have finished.
|
|
302
|
+
until @last_workflow_remove_job && workflow_activation_work_drained?
|
|
300
303
|
event = @runner.next_event
|
|
301
304
|
case event
|
|
302
305
|
when Internal::Worker::MultiRunner::Event::PollSuccess
|
|
306
|
+
@pending_workflow_activations += 1
|
|
303
307
|
@workflow_worker.handle_activation(
|
|
304
308
|
runner: @runner,
|
|
305
309
|
activation: Internal::Bridge::Api::WorkflowActivation::WorkflowActivation.decode(event.bytes),
|
|
@@ -308,14 +312,17 @@ module Temporalio
|
|
|
308
312
|
when Internal::Worker::MultiRunner::Event::WorkflowActivationDecoded
|
|
309
313
|
@workflow_worker.handle_activation(runner: @runner, activation: event.activation, decoded: true)
|
|
310
314
|
when Internal::Worker::MultiRunner::Event::WorkflowActivationComplete
|
|
311
|
-
@workflow_worker.handle_activation_complete(
|
|
315
|
+
if @workflow_worker.handle_activation_complete(
|
|
312
316
|
runner: @runner,
|
|
313
317
|
activation_completion: event.activation_completion,
|
|
314
318
|
encoded: event.encoded,
|
|
315
319
|
completion_complete_queue: event.completion_complete_queue
|
|
316
320
|
)
|
|
321
|
+
@pending_workflow_activations -= 1
|
|
322
|
+
@pending_workflow_activation_completions += 1
|
|
323
|
+
end
|
|
317
324
|
when Internal::Worker::MultiRunner::Event::WorkflowActivationCompletionComplete
|
|
318
|
-
|
|
325
|
+
@pending_workflow_activation_completions -= 1
|
|
319
326
|
else
|
|
320
327
|
raise "Unexpected event: #{event}"
|
|
321
328
|
end
|
|
@@ -365,6 +372,12 @@ module Temporalio
|
|
|
365
372
|
def _wait_all_complete
|
|
366
373
|
# Do nothing
|
|
367
374
|
end
|
|
375
|
+
|
|
376
|
+
private
|
|
377
|
+
|
|
378
|
+
def workflow_activation_work_drained?
|
|
379
|
+
@pending_workflow_activations.zero? && @pending_workflow_activation_completions.zero?
|
|
380
|
+
end
|
|
368
381
|
end
|
|
369
382
|
end
|
|
370
383
|
end
|
data/lib/temporalio/worker.rb
CHANGED
|
@@ -28,6 +28,17 @@ module Temporalio
|
|
|
28
28
|
# {run_all} is used for a collection of workers. These can wait until a block is complete or a {Cancellation} is
|
|
29
29
|
# canceled.
|
|
30
30
|
class Worker
|
|
31
|
+
# Input for the experimental `patch_activation_callback:` worker option.
|
|
32
|
+
#
|
|
33
|
+
# @!attribute [r] workflow_info
|
|
34
|
+
# @return [Workflow::Info] Information about the workflow execution calling {Workflow.patched}.
|
|
35
|
+
# @!attribute [r] patch_id
|
|
36
|
+
# @return [String] Patch ID passed to {Workflow.patched}.
|
|
37
|
+
PatchActivationInput = Data.define(
|
|
38
|
+
:workflow_info,
|
|
39
|
+
:patch_id
|
|
40
|
+
)
|
|
41
|
+
|
|
31
42
|
Options = Data.define(
|
|
32
43
|
:client,
|
|
33
44
|
:task_queue,
|
|
@@ -57,6 +68,7 @@ module Temporalio
|
|
|
57
68
|
:workflow_payload_codec_thread_pool,
|
|
58
69
|
:unsafe_workflow_io_enabled,
|
|
59
70
|
:deployment_options,
|
|
71
|
+
:patch_activation_callback,
|
|
60
72
|
:workflow_task_poller_behavior,
|
|
61
73
|
:activity_task_poller_behavior,
|
|
62
74
|
:debug_mode
|
|
@@ -81,12 +93,16 @@ module Temporalio
|
|
|
81
93
|
# hashing all bytecode of required files. This means later/dynamic require
|
|
82
94
|
# won't be accounted for because this is memoized. It also means the
|
|
83
95
|
# tiniest code change will affect this, which is what we want since this
|
|
84
|
-
# is meant to be a "binary checksum". We
|
|
85
|
-
# similarity with other SDKs, and because security is not a factor.
|
|
96
|
+
# is meant to be a "binary checksum". We default to MD5 for speed,
|
|
97
|
+
# similarity with other SDKs, and because security is not a factor. On
|
|
98
|
+
# FIPS builds we use SHA-256 instead, since MD5 is rejected by FIPS-mode
|
|
99
|
+
# OpenSSL. This is opt-in (tied to the FIPS build) so existing,
|
|
100
|
+
# non-FIPS users keep their stable MD5-based build IDs.
|
|
86
101
|
require 'digest'
|
|
87
102
|
|
|
103
|
+
initial_digest = Internal::Bridge::FIPS ? Digest::SHA256.new : Digest::MD5.new
|
|
88
104
|
saw_bridge = false
|
|
89
|
-
build_id = $LOADED_FEATURES.each_with_object(
|
|
105
|
+
build_id = $LOADED_FEATURES.each_with_object(initial_digest) do |file, digest|
|
|
90
106
|
saw_bridge = true if file.include?('temporalio_bridge.')
|
|
91
107
|
digest.update(File.read(file)) if File.file?(file)
|
|
92
108
|
end.hexdigest
|
|
@@ -166,6 +182,7 @@ module Temporalio
|
|
|
166
182
|
raise ArgumentError, 'Not all parameters are workers' unless workers.all?(Worker)
|
|
167
183
|
|
|
168
184
|
Internal::Bridge.assert_fiber_compatibility!
|
|
185
|
+
Internal::Bridge.assert_fips_compatibility!
|
|
169
186
|
|
|
170
187
|
# Start the multi runner
|
|
171
188
|
runner = Internal::Worker::MultiRunner.new(workers:, shutdown_signals:)
|
|
@@ -425,6 +442,9 @@ module Temporalio
|
|
|
425
442
|
# scheduler will fail. Instead of setting this to true, users are encouraged to use {Workflow::Unsafe.io_enabled}
|
|
426
443
|
# with a block for narrower enabling of IO.
|
|
427
444
|
# @param deployment_options [DeploymentOptions, nil] Deployment options for the worker.
|
|
445
|
+
# @param patch_activation_callback [Proc, nil] Experimental callback to decide whether the first non-replay call to
|
|
446
|
+
# {Workflow.patched} for a patch ID should activate that patch. The callback receives a {PatchActivationInput} and
|
|
447
|
+
# must return `true` to activate the patch or `false` to leave it inactive.
|
|
428
448
|
# @param workflow_task_poller_behavior [PollerBehavior] Specify the behavior of workflow task
|
|
429
449
|
# polling. Defaults to a 5-poller maximum.
|
|
430
450
|
# @param activity_task_poller_behavior [PollerBehavior] Specify the behavior of activity task
|
|
@@ -461,6 +481,7 @@ module Temporalio
|
|
|
461
481
|
workflow_payload_codec_thread_pool: nil,
|
|
462
482
|
unsafe_workflow_io_enabled: false,
|
|
463
483
|
deployment_options: Worker.default_deployment_options,
|
|
484
|
+
patch_activation_callback: nil,
|
|
464
485
|
workflow_task_poller_behavior: PollerBehavior::SimpleMaximum.new(max_concurrent_workflow_task_polls),
|
|
465
486
|
activity_task_poller_behavior: PollerBehavior::SimpleMaximum.new(max_concurrent_activity_task_polls),
|
|
466
487
|
debug_mode: %w[true 1].include?(ENV['TEMPORAL_DEBUG'].to_s.downcase)
|
|
@@ -496,6 +517,7 @@ module Temporalio
|
|
|
496
517
|
workflow_payload_codec_thread_pool:,
|
|
497
518
|
unsafe_workflow_io_enabled:,
|
|
498
519
|
deployment_options:,
|
|
520
|
+
patch_activation_callback:,
|
|
499
521
|
workflow_task_poller_behavior:,
|
|
500
522
|
activity_task_poller_behavior:,
|
|
501
523
|
debug_mode:
|
|
@@ -564,8 +586,10 @@ module Temporalio
|
|
|
564
586
|
)
|
|
565
587
|
|
|
566
588
|
# Collect interceptors from client and params
|
|
567
|
-
@activity_interceptors =
|
|
568
|
-
|
|
589
|
+
@activity_interceptors =
|
|
590
|
+
(@options.client.options.interceptors + @options.interceptors).grep(Interceptor::Activity)
|
|
591
|
+
@workflow_interceptors =
|
|
592
|
+
(@options.client.options.interceptors + @options.interceptors).grep(Interceptor::Workflow)
|
|
569
593
|
|
|
570
594
|
# Cancellation for the whole worker
|
|
571
595
|
@worker_shutdown_cancellation = Cancellation.new
|
|
@@ -591,6 +615,7 @@ module Temporalio
|
|
|
591
615
|
workflow_failure_exception_types: @options.workflow_failure_exception_types,
|
|
592
616
|
workflow_payload_codec_thread_pool: @options.workflow_payload_codec_thread_pool,
|
|
593
617
|
unsafe_workflow_io_enabled: @options.unsafe_workflow_io_enabled,
|
|
618
|
+
patch_activation_callback: @options.patch_activation_callback,
|
|
594
619
|
debug_mode: @options.debug_mode,
|
|
595
620
|
assert_valid_local_activity: ->(activity) { _assert_valid_local_activity(activity) }
|
|
596
621
|
)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'temporalio/internal/workflow_task_failure_error'
|
|
3
4
|
require 'temporalio/workflow'
|
|
4
5
|
|
|
5
6
|
module Temporalio
|
|
@@ -81,6 +82,10 @@ module Temporalio
|
|
|
81
82
|
@fiber = Fiber.schedule do
|
|
82
83
|
@result = block.call # steep:ignore
|
|
83
84
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
85
|
+
# These errors invalidate the whole workflow task. If stored and only raised on wait, the activation may
|
|
86
|
+
# complete successfully with commands that were emitted before the error.
|
|
87
|
+
raise if e.is_a?(Internal::WorkflowTaskFailureError)
|
|
88
|
+
|
|
84
89
|
@failure = e
|
|
85
90
|
ensure
|
|
86
91
|
@done = true
|
|
@@ -9,13 +9,15 @@ module Temporalio
|
|
|
9
9
|
# WARNING: Nexus support is experimental.
|
|
10
10
|
module NexusOperationCancellationType
|
|
11
11
|
# Wait for cancellation to complete (default).
|
|
12
|
-
WAIT_CANCELLATION_COMPLETED =
|
|
12
|
+
WAIT_CANCELLATION_COMPLETED =
|
|
13
|
+
Internal::Bridge::Api::Nexus::NexusOperationCancellationType::WAIT_CANCELLATION_COMPLETED
|
|
13
14
|
# Abandon the operation without sending a cancellation request.
|
|
14
15
|
ABANDON = Internal::Bridge::Api::Nexus::NexusOperationCancellationType::ABANDON
|
|
15
16
|
# Send a cancellation request but do not wait for confirmation.
|
|
16
17
|
TRY_CANCEL = Internal::Bridge::Api::Nexus::NexusOperationCancellationType::TRY_CANCEL
|
|
17
18
|
# Wait for the server to confirm the cancellation request was delivered.
|
|
18
|
-
WAIT_CANCELLATION_REQUESTED =
|
|
19
|
+
WAIT_CANCELLATION_REQUESTED =
|
|
20
|
+
Internal::Bridge::Api::Nexus::NexusOperationCancellationType::WAIT_CANCELLATION_REQUESTED
|
|
19
21
|
end
|
|
20
22
|
end
|
|
21
23
|
end
|
data/lib/temporalio/workflow.rb
CHANGED
|
@@ -344,6 +344,9 @@ module Temporalio
|
|
|
344
344
|
# same ID and workflow are memoized. Use {deprecate_patch} when all workflows are done and will never be queried
|
|
345
345
|
# again. The old code path can be removed at that time too.
|
|
346
346
|
#
|
|
347
|
+
# Workers can set `patch_activation_callback:` to delay activating a newly introduced patch during rolling
|
|
348
|
+
# deployments. That callback is only used when the patch marker would otherwise be created for the first time.
|
|
349
|
+
#
|
|
347
350
|
# @param patch_id [Symbol, String] Patch ID.
|
|
348
351
|
# @return [Boolean] True if this should take the newer patch, false if it should take the old path.
|
|
349
352
|
def self.patched(patch_id)
|
|
@@ -646,6 +649,7 @@ module Temporalio
|
|
|
646
649
|
# Error that is raised by a workflow out of the primary workflow method to issue a continue-as-new.
|
|
647
650
|
class ContinueAsNewError < Error
|
|
648
651
|
attr_accessor :args, :workflow, :task_queue, :run_timeout, :task_timeout,
|
|
652
|
+
:backoff_start_interval,
|
|
649
653
|
:retry_policy, :memo, :search_attributes, :arg_hints, :headers,
|
|
650
654
|
:initial_versioning_behavior
|
|
651
655
|
|
|
@@ -660,6 +664,8 @@ module Temporalio
|
|
|
660
664
|
# from the current workflow.
|
|
661
665
|
# @param task_timeout [Float, nil] Timeout of a single workflow task in seconds. The default is _not_ carried over
|
|
662
666
|
# from the current workflow.
|
|
667
|
+
# @param backoff_start_interval [Float, nil] Delay before the first workflow task of the continued run is
|
|
668
|
+
# scheduled.
|
|
663
669
|
# @param retry_policy [RetryPolicy, nil] Retry policy for the workflow. If unset/nil, the current workflow retry
|
|
664
670
|
# policy is used.
|
|
665
671
|
# @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow. If unset/nil, the current workflow memo
|
|
@@ -680,6 +686,7 @@ module Temporalio
|
|
|
680
686
|
task_queue: nil,
|
|
681
687
|
run_timeout: nil,
|
|
682
688
|
task_timeout: nil,
|
|
689
|
+
backoff_start_interval: nil,
|
|
683
690
|
retry_policy: nil,
|
|
684
691
|
memo: nil,
|
|
685
692
|
search_attributes: nil,
|
|
@@ -693,6 +700,7 @@ module Temporalio
|
|
|
693
700
|
@task_queue = task_queue
|
|
694
701
|
@run_timeout = run_timeout
|
|
695
702
|
@task_timeout = task_timeout
|
|
703
|
+
@backoff_start_interval = backoff_start_interval
|
|
696
704
|
@retry_policy = retry_policy
|
|
697
705
|
@memo = memo
|
|
698
706
|
@search_attributes = search_attributes
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# typed: false
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Minimal shim for google-protobuf types referenced by generated proto RBI files.
|
|
5
|
+
|
|
6
|
+
module Google
|
|
7
|
+
module Protobuf
|
|
8
|
+
module MessageExts
|
|
9
|
+
module ClassMethods; end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class AbstractMessage; end
|
|
13
|
+
class Descriptor; end
|
|
14
|
+
class EnumDescriptor; end
|
|
15
|
+
class RepeatedField; end
|
|
16
|
+
class Map; end
|
|
17
|
+
|
|
18
|
+
class Any; end
|
|
19
|
+
class DoubleValue; end
|
|
20
|
+
class Duration; end
|
|
21
|
+
class Empty; end
|
|
22
|
+
class FieldMask; end
|
|
23
|
+
class Timestamp; end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
class Temporalio::Activity::CancellationDetails
|
|
4
|
+
sig do
|
|
5
|
+
params(
|
|
6
|
+
gone_from_server: T::Boolean,
|
|
7
|
+
cancel_requested: T::Boolean,
|
|
8
|
+
timed_out: T::Boolean,
|
|
9
|
+
worker_shutdown: T::Boolean,
|
|
10
|
+
paused: T::Boolean,
|
|
11
|
+
reset: T::Boolean
|
|
12
|
+
).void
|
|
13
|
+
end
|
|
14
|
+
def initialize(gone_from_server: false, cancel_requested: false, timed_out: false, worker_shutdown: false, paused: false, reset: false); end
|
|
15
|
+
|
|
16
|
+
sig { returns(T::Boolean) }
|
|
17
|
+
def gone_from_server?; end
|
|
18
|
+
|
|
19
|
+
sig { returns(T::Boolean) }
|
|
20
|
+
def cancel_requested?; end
|
|
21
|
+
|
|
22
|
+
sig { returns(T::Boolean) }
|
|
23
|
+
def timed_out?; end
|
|
24
|
+
|
|
25
|
+
sig { returns(T::Boolean) }
|
|
26
|
+
def worker_shutdown?; end
|
|
27
|
+
|
|
28
|
+
sig { returns(T::Boolean) }
|
|
29
|
+
def paused?; end
|
|
30
|
+
|
|
31
|
+
sig { returns(T::Boolean) }
|
|
32
|
+
def reset?; end
|
|
33
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
class Temporalio::Activity::Context
|
|
4
|
+
sig { returns(Temporalio::Activity::Context) }
|
|
5
|
+
def self.current; end
|
|
6
|
+
|
|
7
|
+
sig { returns(T.nilable(Temporalio::Activity::Context)) }
|
|
8
|
+
def self.current_or_nil; end
|
|
9
|
+
|
|
10
|
+
sig { returns(T::Boolean) }
|
|
11
|
+
def self.exist?; end
|
|
12
|
+
|
|
13
|
+
sig { returns(Temporalio::Activity::Info) }
|
|
14
|
+
def info; end
|
|
15
|
+
|
|
16
|
+
sig { returns(T.nilable(Temporalio::Activity::Definition)) }
|
|
17
|
+
def instance; end
|
|
18
|
+
|
|
19
|
+
sig { params(details: T.nilable(Object), detail_hints: T.nilable(T::Array[Object])).void }
|
|
20
|
+
def heartbeat(*details, detail_hints: nil); end
|
|
21
|
+
|
|
22
|
+
sig { returns(Temporalio::Cancellation) }
|
|
23
|
+
def cancellation; end
|
|
24
|
+
|
|
25
|
+
sig { returns(T.nilable(Temporalio::Activity::CancellationDetails)) }
|
|
26
|
+
def cancellation_details; end
|
|
27
|
+
|
|
28
|
+
sig { returns(Temporalio::Cancellation) }
|
|
29
|
+
def worker_shutdown_cancellation; end
|
|
30
|
+
|
|
31
|
+
sig { returns(Temporalio::Converters::PayloadConverter) }
|
|
32
|
+
def payload_converter; end
|
|
33
|
+
|
|
34
|
+
sig { returns(Temporalio::ScopedLogger) }
|
|
35
|
+
def logger; end
|
|
36
|
+
|
|
37
|
+
sig { returns(Temporalio::Metric::Meter) }
|
|
38
|
+
def metric_meter; end
|
|
39
|
+
|
|
40
|
+
sig { returns(Temporalio::Client) }
|
|
41
|
+
def client; end
|
|
42
|
+
end
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# typed: true
|
|
2
|
+
|
|
3
|
+
class Temporalio::Activity::Definition
|
|
4
|
+
sig { params(args: Object).returns(Object) }
|
|
5
|
+
def execute(*args); end
|
|
6
|
+
|
|
7
|
+
class << self
|
|
8
|
+
protected
|
|
9
|
+
|
|
10
|
+
sig { params(name: T.any(String, Symbol)).void }
|
|
11
|
+
def activity_name(name); end
|
|
12
|
+
|
|
13
|
+
sig { params(executor_name: Symbol).void }
|
|
14
|
+
def activity_executor(executor_name); end
|
|
15
|
+
|
|
16
|
+
sig { params(cancel_raise: T::Boolean).void }
|
|
17
|
+
def activity_cancel_raise(cancel_raise); end
|
|
18
|
+
|
|
19
|
+
sig { params(value: T::Boolean).void }
|
|
20
|
+
def activity_dynamic(value = true); end
|
|
21
|
+
|
|
22
|
+
sig { params(value: T::Boolean).void }
|
|
23
|
+
def activity_raw_args(value = true); end
|
|
24
|
+
|
|
25
|
+
sig { params(hints: Object).void }
|
|
26
|
+
def activity_arg_hint(*hints); end
|
|
27
|
+
|
|
28
|
+
sig { params(hint: T.nilable(Object)).void }
|
|
29
|
+
def activity_result_hint(hint); end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
class Temporalio::Activity::Definition::Info
|
|
34
|
+
sig do
|
|
35
|
+
params(
|
|
36
|
+
name: T.nilable(T.any(String, Symbol)),
|
|
37
|
+
instance: T.nilable(T.any(Object, Proc)),
|
|
38
|
+
executor: Symbol,
|
|
39
|
+
cancel_raise: T::Boolean,
|
|
40
|
+
raw_args: T::Boolean,
|
|
41
|
+
arg_hints: T.nilable(T::Array[Object]),
|
|
42
|
+
result_hint: T.nilable(Object),
|
|
43
|
+
block: T.nilable(T.proc.params(arg0: Object).returns(Object))
|
|
44
|
+
).void
|
|
45
|
+
end
|
|
46
|
+
def initialize(name:, instance: nil, executor: :default, cancel_raise: true, raw_args: false, arg_hints: nil, result_hint: nil, &block); end
|
|
47
|
+
|
|
48
|
+
sig { params(activity: T.any(Temporalio::Activity::Definition, T.class_of(Temporalio::Activity::Definition), Temporalio::Activity::Definition::Info)).returns(Temporalio::Activity::Definition::Info) }
|
|
49
|
+
def self.from_activity(activity); end
|
|
50
|
+
|
|
51
|
+
sig { returns(T.nilable(T.any(String, Symbol))) }
|
|
52
|
+
attr_reader :name
|
|
53
|
+
|
|
54
|
+
sig { returns(T.nilable(T.any(Object, Proc))) }
|
|
55
|
+
attr_reader :instance
|
|
56
|
+
|
|
57
|
+
sig { returns(Proc) }
|
|
58
|
+
attr_reader :proc
|
|
59
|
+
|
|
60
|
+
sig { returns(Symbol) }
|
|
61
|
+
attr_reader :executor
|
|
62
|
+
|
|
63
|
+
sig { returns(T::Boolean) }
|
|
64
|
+
attr_reader :cancel_raise
|
|
65
|
+
|
|
66
|
+
sig { returns(T::Boolean) }
|
|
67
|
+
attr_reader :raw_args
|
|
68
|
+
|
|
69
|
+
sig { returns(T.nilable(T::Array[Object])) }
|
|
70
|
+
attr_reader :arg_hints
|
|
71
|
+
|
|
72
|
+
sig { returns(T.nilable(Object)) }
|
|
73
|
+
attr_reader :result_hint
|
|
74
|
+
end
|