@temporalio/core-bridge 1.14.2-canary-release-testing.0 → 1.16.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.
- package/Cargo.lock +794 -650
- package/bridge-macros/src/derive_tryintojs.rs +40 -0
- package/lib/native.d.ts +24 -3
- package/package.json +4 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.github/workflows/per-pr.yml +6 -6
- package/sdk-core/AGENTS.md +42 -31
- package/sdk-core/Cargo.toml +4 -1
- package/sdk-core/README.md +19 -13
- package/sdk-core/crates/client/Cargo.toml +4 -0
- package/sdk-core/crates/client/README.md +139 -0
- package/sdk-core/crates/client/src/async_activity_handle.rs +297 -0
- package/sdk-core/crates/client/src/callback_based.rs +7 -0
- package/sdk-core/crates/client/src/errors.rs +294 -0
- package/sdk-core/crates/client/src/{raw.rs → grpc.rs} +370 -159
- package/sdk-core/crates/client/src/lib.rs +920 -1326
- package/sdk-core/crates/client/src/metrics.rs +24 -33
- package/sdk-core/crates/client/src/options_structs.rs +457 -0
- package/sdk-core/crates/client/src/replaceable.rs +5 -4
- package/sdk-core/crates/client/src/request_extensions.rs +8 -9
- package/sdk-core/crates/client/src/retry.rs +99 -54
- package/sdk-core/crates/client/src/{worker/mod.rs → worker.rs} +104 -29
- package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
- package/sdk-core/crates/common/Cargo.toml +62 -3
- package/sdk-core/crates/common/build.rs +742 -12
- package/sdk-core/crates/common/protos/api_upstream/.github/workflows/ci.yml +2 -0
- package/sdk-core/crates/common/protos/api_upstream/.github/workflows/create-release.yml +0 -5
- package/sdk-core/crates/common/protos/api_upstream/Makefile +2 -1
- package/sdk-core/crates/common/protos/api_upstream/README.md +8 -0
- package/sdk-core/crates/common/protos/api_upstream/cmd/check-path-conflicts/main.go +137 -0
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv2.json +3329 -2647
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +2734 -708
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/activity/v1/message.proto +155 -3
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/command/v1/message.proto +26 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/common/v1/message.proto +8 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +27 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/activity.proto +81 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/event_type.proto +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +15 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +63 -15
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/errordetails/v1/message.proto +8 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/failure/v1/message.proto +1 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/history/v1/message.proto +111 -17
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +21 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +20 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/schedule/v1/message.proto +2 -2
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +2 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/worker/v1/message.proto +4 -7
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflow/v1/message.proto +80 -22
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +347 -23
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +242 -43
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/core_interface.proto +15 -0
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +9 -2
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +8 -0
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +22 -5
- package/sdk-core/crates/common/src/activity_definition.rs +20 -0
- package/sdk-core/crates/common/src/data_converters.rs +770 -0
- package/sdk-core/crates/common/src/envconfig.rs +5 -0
- package/sdk-core/crates/common/src/lib.rs +15 -211
- package/sdk-core/crates/common/src/payload_visitor.rs +648 -0
- package/sdk-core/crates/common/src/priority.rs +110 -0
- package/sdk-core/crates/common/src/protos/canned_histories.rs +19 -0
- package/sdk-core/crates/common/src/protos/history_builder.rs +45 -0
- package/sdk-core/crates/common/src/protos/history_info.rs +2 -0
- package/sdk-core/crates/common/src/protos/mod.rs +134 -27
- package/sdk-core/crates/common/src/protos/task_token.rs +3 -3
- package/sdk-core/crates/common/src/protos/utilities.rs +11 -0
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/log_export.rs +11 -16
- package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
- package/sdk-core/crates/common/src/telemetry/metrics.rs +272 -225
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/otel.rs +8 -13
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_meter.rs +49 -50
- package/sdk-core/crates/{sdk-core → common}/src/telemetry/prometheus_server.rs +2 -3
- package/sdk-core/crates/common/src/telemetry.rs +278 -19
- package/sdk-core/crates/common/src/worker.rs +68 -636
- package/sdk-core/crates/common/src/workflow_definition.rs +60 -0
- package/sdk-core/crates/macros/Cargo.toml +5 -1
- package/sdk-core/crates/macros/src/activities_definitions.rs +585 -0
- package/sdk-core/crates/macros/src/fsm_impl.rs +507 -0
- package/sdk-core/crates/macros/src/lib.rs +138 -512
- package/sdk-core/crates/macros/src/macro_utils.rs +106 -0
- package/sdk-core/crates/macros/src/workflow_definitions.rs +1224 -0
- package/sdk-core/crates/sdk/Cargo.toml +19 -6
- package/sdk-core/crates/sdk/README.md +415 -0
- package/sdk-core/crates/sdk/src/activities.rs +417 -0
- package/sdk-core/crates/sdk/src/interceptors.rs +1 -1
- package/sdk-core/crates/sdk/src/lib.rs +759 -442
- package/sdk-core/crates/sdk/src/workflow_context/options.rs +64 -35
- package/sdk-core/crates/sdk/src/workflow_context.rs +1033 -289
- package/sdk-core/crates/sdk/src/workflow_future.rs +277 -213
- package/sdk-core/crates/sdk/src/workflows.rs +711 -0
- package/sdk-core/crates/sdk-core/Cargo.toml +59 -65
- package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +45 -54
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +1 -1
- package/sdk-core/crates/sdk-core/src/abstractions.rs +6 -10
- package/sdk-core/crates/sdk-core/src/core_tests/activity_tasks.rs +6 -5
- package/sdk-core/crates/sdk-core/src/core_tests/mod.rs +22 -21
- package/sdk-core/crates/sdk-core/src/core_tests/queries.rs +21 -25
- package/sdk-core/crates/sdk-core/src/core_tests/replay_flag.rs +7 -10
- package/sdk-core/crates/sdk-core/src/core_tests/updates.rs +14 -17
- package/sdk-core/crates/sdk-core/src/core_tests/workers.rs +647 -27
- package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +46 -41
- package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +13 -16
- package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
- package/sdk-core/crates/sdk-core/src/lib.rs +60 -123
- package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
- package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +411 -32
- package/sdk-core/crates/sdk-core/src/protosext/mod.rs +2 -2
- package/sdk-core/crates/sdk-core/src/replay/mod.rs +14 -5
- package/sdk-core/crates/sdk-core/src/telemetry/metrics.rs +183 -198
- package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -281
- package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +35 -16
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
- package/sdk-core/crates/sdk-core/src/worker/activities/activity_heartbeat_manager.rs +1 -0
- package/sdk-core/crates/sdk-core/src/worker/activities/local_activities.rs +11 -14
- package/sdk-core/crates/sdk-core/src/worker/activities.rs +16 -19
- package/sdk-core/crates/sdk-core/src/worker/client/mocks.rs +11 -5
- package/sdk-core/crates/sdk-core/src/worker/client.rs +104 -86
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +10 -14
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1175 -241
- package/sdk-core/crates/sdk-core/src/worker/nexus.rs +150 -23
- package/sdk-core/crates/sdk-core/src/worker/slot_provider.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/fixed_size.rs +2 -2
- package/sdk-core/crates/sdk-core/src/worker/tuner/resource_based.rs +25 -27
- package/sdk-core/crates/sdk-core/src/worker/tuner.rs +64 -44
- package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/patch_state_machine.rs +5 -8
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +21 -22
- package/sdk-core/crates/sdk-core/src/worker/workflow/machines/workflow_machines.rs +28 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +20 -41
- package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +50 -9
- package/sdk-core/crates/sdk-core/src/worker/workflow/run_cache.rs +4 -7
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_extraction.rs +2 -4
- package/sdk-core/crates/sdk-core/src/worker/workflow/wft_poller.rs +8 -9
- package/sdk-core/crates/sdk-core/src/worker/workflow/workflow_stream.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/activities_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/basic_pass.rs +54 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.rs +18 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/invalid_self_type_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/missing_context_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/multi_arg_pass.rs +48 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_input_pass.rs +14 -0
- package/sdk-core/crates/sdk-core/tests/activities_trybuild/no_return_type_pass.rs +19 -0
- package/sdk-core/crates/sdk-core/tests/cloud_tests.rs +14 -5
- package/sdk-core/crates/sdk-core/tests/common/activity_functions.rs +55 -0
- package/sdk-core/crates/sdk-core/tests/common/mod.rs +281 -236
- package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
- package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +9 -14
- package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -66
- package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +306 -268
- package/sdk-core/crates/sdk-core/tests/integ_tests/async_activity_client_tests.rs +230 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/client_tests.rs +94 -57
- package/sdk-core/crates/sdk-core/tests/integ_tests/data_converter_tests.rs +381 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +37 -38
- package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +49 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +447 -300
- package/sdk-core/crates/sdk-core/tests/integ_tests/pagination_tests.rs +50 -45
- package/sdk-core/crates/sdk-core/tests/integ_tests/polling_tests.rs +157 -157
- package/sdk-core/crates/sdk-core/tests/integ_tests/queries_tests.rs +103 -89
- package/sdk-core/crates/sdk-core/tests/integ_tests/update_tests.rs +609 -463
- package/sdk-core/crates/sdk-core/tests/integ_tests/visibility_tests.rs +80 -62
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +389 -265
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +250 -185
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -49
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_client_tests.rs +180 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/activities.rs +437 -327
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -58
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -30
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -251
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/client_interactions.rs +552 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +110 -46
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -149
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -32
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1040
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -43
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +402 -245
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +343 -207
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/queries.rs +415 -0
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/replay.rs +96 -36
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/resets.rs +155 -140
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -113
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -44
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -48
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -56
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +365 -242
- package/sdk-core/crates/sdk-core/tests/main.rs +22 -16
- package/sdk-core/crates/sdk-core/tests/manual_tests.rs +233 -187
- package/sdk-core/crates/sdk-core/tests/runner.rs +4 -6
- package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +73 -27
- package/sdk-core/crates/sdk-core/tests/shared_tests/priority.rs +107 -84
- package/sdk-core/crates/sdk-core/tests/workflows_procmacro.rs +6 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/async_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/basic_pass.rs +49 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/minimal_pass.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.rs +26 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/mut_query_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.rs +21 -0
- package/sdk-core/crates/sdk-core/tests/workflows_trybuild/sync_run_fail.stderr +5 -0
- package/sdk-core/crates/sdk-core-c-bridge/Cargo.toml +8 -1
- package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +37 -26
- package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +180 -87
- package/sdk-core/crates/sdk-core-c-bridge/src/lib.rs +89 -5
- package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +10 -16
- package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +59 -67
- package/sdk-core/crates/sdk-core-c-bridge/src/testing.rs +10 -10
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +57 -22
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +108 -12
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +9 -52
- package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +74 -91
- package/sdk-core/rustfmt.toml +2 -1
- package/src/client.rs +206 -289
- package/src/helpers/try_into_js.rs +88 -2
- package/src/metrics.rs +277 -35
- package/src/runtime.rs +94 -45
- package/src/testing.rs +9 -16
- package/src/worker.rs +86 -68
- package/ts/native.ts +39 -3
- package/sdk-core/crates/client/src/workflow_handle/mod.rs +0 -212
- package/sdk-core/crates/common/src/errors.rs +0 -85
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +0 -129
- package/sdk-core/crates/macros/LICENSE.txt +0 -21
- package/sdk-core/crates/sdk/src/activity_context.rs +0 -238
- package/sdk-core/crates/sdk/src/app_data.rs +0 -37
- package/sdk-core/crates/sdk-core/tests/integ_tests/activity_functions.rs +0 -5
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +0 -61
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//! Worker-specific client needs
|
|
2
2
|
|
|
3
3
|
pub(crate) mod mocks;
|
|
4
|
-
use crate::protosext::legacy_query_failure;
|
|
4
|
+
use crate::{protosext::legacy_query_failure, worker::WorkerVersioningStrategy};
|
|
5
5
|
use parking_lot::Mutex;
|
|
6
6
|
use prost_types::Duration as PbDuration;
|
|
7
7
|
use std::{
|
|
@@ -10,37 +10,34 @@ use std::{
|
|
|
10
10
|
time::{Duration, SystemTime},
|
|
11
11
|
};
|
|
12
12
|
use temporalio_client::{
|
|
13
|
-
|
|
14
|
-
WorkflowService,
|
|
13
|
+
Connection, Namespace, NamespacedClient, RetryOptions, SharedReplaceableClient,
|
|
14
|
+
grpc::WorkflowService,
|
|
15
15
|
request_extensions::{IsWorkerTaskLongPoll, NoRetryOnMatching, RetryConfigForCall},
|
|
16
16
|
worker::ClientWorkerSet,
|
|
17
17
|
};
|
|
18
|
-
use temporalio_common::{
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
WorkflowExecution,
|
|
27
|
-
},
|
|
28
|
-
deployment,
|
|
29
|
-
enums::v1::{
|
|
30
|
-
TaskQueueKind, VersioningBehavior, WorkerStatus, WorkerVersioningMode,
|
|
31
|
-
WorkflowTaskFailedCause,
|
|
32
|
-
},
|
|
33
|
-
failure::v1::Failure,
|
|
34
|
-
nexus,
|
|
35
|
-
protocol::v1::Message as ProtocolMessage,
|
|
36
|
-
query::v1::WorkflowQueryResult,
|
|
37
|
-
sdk::v1::WorkflowTaskCompletedMetadata,
|
|
38
|
-
taskqueue::v1::{StickyExecutionAttributes, TaskQueue, TaskQueueMetadata},
|
|
39
|
-
worker::v1::{WorkerHeartbeat, WorkerSlotsInfo},
|
|
40
|
-
workflowservice::v1::{get_system_info_response::Capabilities, *},
|
|
18
|
+
use temporalio_common::protos::{
|
|
19
|
+
TaskToken,
|
|
20
|
+
coresdk::{workflow_commands::QueryResult, workflow_completion},
|
|
21
|
+
temporal::api::{
|
|
22
|
+
command::v1::Command,
|
|
23
|
+
common::v1::{
|
|
24
|
+
MeteringMetadata, Payloads, WorkerVersionCapabilities, WorkerVersionStamp,
|
|
25
|
+
WorkflowExecution,
|
|
41
26
|
},
|
|
27
|
+
deployment,
|
|
28
|
+
enums::v1::{
|
|
29
|
+
TaskQueueKind, TaskQueueType, VersioningBehavior, WorkerVersioningMode,
|
|
30
|
+
WorkflowTaskFailedCause,
|
|
31
|
+
},
|
|
32
|
+
failure::v1::Failure,
|
|
33
|
+
nexus::{self, v1::NexusTaskFailure},
|
|
34
|
+
protocol::v1::Message as ProtocolMessage,
|
|
35
|
+
query::v1::WorkflowQueryResult,
|
|
36
|
+
sdk::v1::WorkflowTaskCompletedMetadata,
|
|
37
|
+
taskqueue::v1::{StickyExecutionAttributes, TaskQueue, TaskQueueMetadata},
|
|
38
|
+
worker::v1::{WorkerHeartbeat, WorkerSlotsInfo},
|
|
39
|
+
workflowservice::v1::{get_system_info_response::Capabilities, *},
|
|
42
40
|
},
|
|
43
|
-
worker::WorkerVersioningStrategy,
|
|
44
41
|
};
|
|
45
42
|
use tonic::IntoRequest;
|
|
46
43
|
use uuid::Uuid;
|
|
@@ -54,29 +51,33 @@ pub enum LegacyQueryResult {
|
|
|
54
51
|
|
|
55
52
|
/// Contains everything a worker needs to interact with the server
|
|
56
53
|
pub(crate) struct WorkerClientBag {
|
|
57
|
-
|
|
54
|
+
connection: SharedReplaceableClient<Connection>,
|
|
58
55
|
namespace: String,
|
|
59
|
-
identity: String,
|
|
60
56
|
worker_versioning_strategy: WorkerVersioningStrategy,
|
|
57
|
+
worker_instance_key: Uuid,
|
|
61
58
|
worker_heartbeat_map: Arc<Mutex<HashMap<String, ClientHeartbeatData>>>,
|
|
62
59
|
}
|
|
63
60
|
|
|
64
61
|
impl WorkerClientBag {
|
|
65
62
|
pub(crate) fn new(
|
|
66
|
-
|
|
63
|
+
connection: SharedReplaceableClient<Connection>,
|
|
67
64
|
namespace: String,
|
|
68
|
-
identity: String,
|
|
69
65
|
worker_versioning_strategy: WorkerVersioningStrategy,
|
|
66
|
+
worker_instance_key: Uuid,
|
|
70
67
|
) -> Self {
|
|
71
68
|
Self {
|
|
72
|
-
|
|
69
|
+
connection,
|
|
73
70
|
namespace,
|
|
74
|
-
identity,
|
|
75
71
|
worker_versioning_strategy,
|
|
72
|
+
worker_instance_key,
|
|
76
73
|
worker_heartbeat_map: Arc::new(Mutex::new(HashMap::new())),
|
|
77
74
|
}
|
|
78
75
|
}
|
|
79
76
|
|
|
77
|
+
fn identity(&self) -> String {
|
|
78
|
+
self.connection.inner_cow().identity().to_owned()
|
|
79
|
+
}
|
|
80
|
+
|
|
80
81
|
fn default_capabilities(&self) -> Capabilities {
|
|
81
82
|
self.capabilities().unwrap_or_default()
|
|
82
83
|
}
|
|
@@ -201,7 +202,7 @@ pub trait WorkerClient: Sync + Send {
|
|
|
201
202
|
async fn fail_nexus_task(
|
|
202
203
|
&self,
|
|
203
204
|
task_token: TaskToken,
|
|
204
|
-
error:
|
|
205
|
+
error: NexusTaskFailure,
|
|
205
206
|
) -> Result<RespondNexusTaskFailedResponse>;
|
|
206
207
|
/// Get the workflow execution history
|
|
207
208
|
async fn get_workflow_execution_history(
|
|
@@ -222,6 +223,8 @@ pub trait WorkerClient: Sync + Send {
|
|
|
222
223
|
async fn shutdown_worker(
|
|
223
224
|
&self,
|
|
224
225
|
sticky_task_queue: String,
|
|
226
|
+
task_queue: String,
|
|
227
|
+
task_queue_types: Vec<TaskQueueType>,
|
|
225
228
|
final_heartbeat: Option<WorkerHeartbeat>,
|
|
226
229
|
) -> Result<ShutdownWorkerResponse>;
|
|
227
230
|
/// Record a worker heartbeat
|
|
@@ -231,8 +234,8 @@ pub trait WorkerClient: Sync + Send {
|
|
|
231
234
|
worker_heartbeat: Vec<WorkerHeartbeat>,
|
|
232
235
|
) -> Result<RecordWorkerHeartbeatResponse>;
|
|
233
236
|
|
|
234
|
-
/// Replace the underlying
|
|
235
|
-
fn
|
|
237
|
+
/// Replace the underlying connection
|
|
238
|
+
fn replace_connection(&self, new_client: Connection);
|
|
236
239
|
/// Return server capabilities
|
|
237
240
|
fn capabilities(&self) -> Option<Capabilities>;
|
|
238
241
|
/// Return workers using this client
|
|
@@ -245,6 +248,8 @@ pub trait WorkerClient: Sync + Send {
|
|
|
245
248
|
fn identity(&self) -> String;
|
|
246
249
|
/// Get worker grouping key
|
|
247
250
|
fn worker_grouping_key(&self) -> Uuid;
|
|
251
|
+
/// Get worker instance key (unique per worker instance)
|
|
252
|
+
fn worker_instance_key(&self) -> Uuid;
|
|
248
253
|
/// Sets the client-reliant fields for WorkerHeartbeat. This also updates client-level tracking
|
|
249
254
|
/// of heartbeat fields, like last heartbeat timestamp.
|
|
250
255
|
fn set_heartbeat_client_fields(&self, heartbeat: &mut WorkerHeartbeat);
|
|
@@ -297,11 +302,11 @@ impl WorkerClient for WorkerClientBag {
|
|
|
297
302
|
let mut request = PollWorkflowTaskQueueRequest {
|
|
298
303
|
namespace: self.namespace.clone(),
|
|
299
304
|
task_queue: Some(task_queue),
|
|
300
|
-
identity: self.identity
|
|
305
|
+
identity: self.identity(),
|
|
301
306
|
binary_checksum: self.binary_checksum(),
|
|
302
307
|
worker_version_capabilities: self.worker_version_capabilities(),
|
|
303
308
|
deployment_options: self.deployment_options(),
|
|
304
|
-
|
|
309
|
+
worker_instance_key: self.worker_instance_key.to_string(),
|
|
305
310
|
}
|
|
306
311
|
.into_request();
|
|
307
312
|
request.extensions_mut().insert(IsWorkerTaskLongPoll);
|
|
@@ -313,7 +318,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
313
318
|
}
|
|
314
319
|
|
|
315
320
|
Ok(self
|
|
316
|
-
.
|
|
321
|
+
.connection
|
|
317
322
|
.clone()
|
|
318
323
|
.poll_workflow_task_queue(request)
|
|
319
324
|
.await?
|
|
@@ -333,13 +338,13 @@ impl WorkerClient for WorkerClientBag {
|
|
|
333
338
|
kind: TaskQueueKind::Normal as i32,
|
|
334
339
|
normal_name: "".to_string(),
|
|
335
340
|
}),
|
|
336
|
-
identity: self.identity
|
|
341
|
+
identity: self.identity(),
|
|
337
342
|
task_queue_metadata: act_options.max_tasks_per_sec.map(|tps| TaskQueueMetadata {
|
|
338
343
|
max_tasks_per_second: Some(tps),
|
|
339
344
|
}),
|
|
340
345
|
worker_version_capabilities: self.worker_version_capabilities(),
|
|
341
346
|
deployment_options: self.deployment_options(),
|
|
342
|
-
|
|
347
|
+
worker_instance_key: self.worker_instance_key.to_string(),
|
|
343
348
|
}
|
|
344
349
|
.into_request();
|
|
345
350
|
request.extensions_mut().insert(IsWorkerTaskLongPoll);
|
|
@@ -351,7 +356,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
351
356
|
}
|
|
352
357
|
|
|
353
358
|
Ok(self
|
|
354
|
-
.
|
|
359
|
+
.connection
|
|
355
360
|
.clone()
|
|
356
361
|
.poll_activity_task_queue(request)
|
|
357
362
|
.await?
|
|
@@ -371,10 +376,11 @@ impl WorkerClient for WorkerClientBag {
|
|
|
371
376
|
kind: TaskQueueKind::Normal as i32,
|
|
372
377
|
normal_name: "".to_string(),
|
|
373
378
|
}),
|
|
374
|
-
identity: self.identity
|
|
379
|
+
identity: self.identity(),
|
|
375
380
|
worker_version_capabilities: self.worker_version_capabilities(),
|
|
376
381
|
deployment_options: self.deployment_options(),
|
|
377
382
|
worker_heartbeat: Vec::new(),
|
|
383
|
+
worker_instance_key: self.worker_instance_key.to_string(),
|
|
378
384
|
}
|
|
379
385
|
.into_request();
|
|
380
386
|
request.extensions_mut().insert(IsWorkerTaskLongPoll);
|
|
@@ -386,7 +392,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
386
392
|
}
|
|
387
393
|
|
|
388
394
|
Ok(self
|
|
389
|
-
.
|
|
395
|
+
.connection
|
|
390
396
|
.clone()
|
|
391
397
|
.poll_nexus_task_queue(request)
|
|
392
398
|
.await?
|
|
@@ -402,7 +408,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
402
408
|
task_token: request.task_token.into(),
|
|
403
409
|
commands: request.commands,
|
|
404
410
|
messages: request.messages,
|
|
405
|
-
identity: self.identity
|
|
411
|
+
identity: self.identity(),
|
|
406
412
|
sticky_attributes: request.sticky_attributes,
|
|
407
413
|
return_new_workflow_task: request.return_new_workflow_task,
|
|
408
414
|
force_create_new_workflow_task: request.force_create_new_workflow_task,
|
|
@@ -437,7 +443,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
437
443
|
deployment_options: self.deployment_options(),
|
|
438
444
|
};
|
|
439
445
|
Ok(self
|
|
440
|
-
.
|
|
446
|
+
.connection
|
|
441
447
|
.clone()
|
|
442
448
|
.respond_workflow_task_completed(request.into_request())
|
|
443
449
|
.await?
|
|
@@ -450,14 +456,14 @@ impl WorkerClient for WorkerClientBag {
|
|
|
450
456
|
result: Option<Payloads>,
|
|
451
457
|
) -> Result<RespondActivityTaskCompletedResponse> {
|
|
452
458
|
Ok(self
|
|
453
|
-
.
|
|
459
|
+
.connection
|
|
454
460
|
.clone()
|
|
455
461
|
.respond_activity_task_completed(
|
|
456
462
|
#[allow(deprecated)] // want to list all fields explicitly
|
|
457
463
|
RespondActivityTaskCompletedRequest {
|
|
458
464
|
task_token: task_token.0,
|
|
459
465
|
result,
|
|
460
|
-
identity: self.identity
|
|
466
|
+
identity: self.identity(),
|
|
461
467
|
namespace: self.namespace.clone(),
|
|
462
468
|
worker_version: self.worker_version_stamp(),
|
|
463
469
|
// Will never be set, deprecated.
|
|
@@ -476,12 +482,12 @@ impl WorkerClient for WorkerClientBag {
|
|
|
476
482
|
response: nexus::v1::Response,
|
|
477
483
|
) -> Result<RespondNexusTaskCompletedResponse> {
|
|
478
484
|
Ok(self
|
|
479
|
-
.
|
|
485
|
+
.connection
|
|
480
486
|
.clone()
|
|
481
487
|
.respond_nexus_task_completed(
|
|
482
488
|
RespondNexusTaskCompletedRequest {
|
|
483
489
|
namespace: self.namespace.clone(),
|
|
484
|
-
identity: self.identity
|
|
490
|
+
identity: self.identity(),
|
|
485
491
|
task_token: task_token.0,
|
|
486
492
|
response: Some(response),
|
|
487
493
|
}
|
|
@@ -497,13 +503,13 @@ impl WorkerClient for WorkerClientBag {
|
|
|
497
503
|
details: Option<Payloads>,
|
|
498
504
|
) -> Result<RecordActivityTaskHeartbeatResponse> {
|
|
499
505
|
Ok(self
|
|
500
|
-
.
|
|
506
|
+
.connection
|
|
501
507
|
.clone()
|
|
502
508
|
.record_activity_task_heartbeat(
|
|
503
509
|
RecordActivityTaskHeartbeatRequest {
|
|
504
510
|
task_token: task_token.0,
|
|
505
511
|
details,
|
|
506
|
-
identity: self.identity
|
|
512
|
+
identity: self.identity(),
|
|
507
513
|
namespace: self.namespace.clone(),
|
|
508
514
|
}
|
|
509
515
|
.into_request(),
|
|
@@ -518,14 +524,14 @@ impl WorkerClient for WorkerClientBag {
|
|
|
518
524
|
details: Option<Payloads>,
|
|
519
525
|
) -> Result<RespondActivityTaskCanceledResponse> {
|
|
520
526
|
Ok(self
|
|
521
|
-
.
|
|
527
|
+
.connection
|
|
522
528
|
.clone()
|
|
523
529
|
.respond_activity_task_canceled(
|
|
524
530
|
#[allow(deprecated)] // want to list all fields explicitly
|
|
525
531
|
RespondActivityTaskCanceledRequest {
|
|
526
532
|
task_token: task_token.0,
|
|
527
533
|
details,
|
|
528
|
-
identity: self.identity
|
|
534
|
+
identity: self.identity(),
|
|
529
535
|
namespace: self.namespace.clone(),
|
|
530
536
|
worker_version: self.worker_version_stamp(),
|
|
531
537
|
// Will never be set, deprecated.
|
|
@@ -544,14 +550,14 @@ impl WorkerClient for WorkerClientBag {
|
|
|
544
550
|
failure: Option<Failure>,
|
|
545
551
|
) -> Result<RespondActivityTaskFailedResponse> {
|
|
546
552
|
Ok(self
|
|
547
|
-
.
|
|
553
|
+
.connection
|
|
548
554
|
.clone()
|
|
549
555
|
.respond_activity_task_failed(
|
|
550
556
|
#[allow(deprecated)] // want to list all fields explicitly
|
|
551
557
|
RespondActivityTaskFailedRequest {
|
|
552
558
|
task_token: task_token.0,
|
|
553
559
|
failure,
|
|
554
|
-
identity: self.identity
|
|
560
|
+
identity: self.identity(),
|
|
555
561
|
namespace: self.namespace.clone(),
|
|
556
562
|
// TODO: Implement - https://github.com/temporalio/sdk-core/issues/293
|
|
557
563
|
last_heartbeat_details: None,
|
|
@@ -577,7 +583,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
577
583
|
task_token: task_token.0,
|
|
578
584
|
cause: cause as i32,
|
|
579
585
|
failure,
|
|
580
|
-
identity: self.identity
|
|
586
|
+
identity: self.identity(),
|
|
581
587
|
binary_checksum: self.binary_checksum(),
|
|
582
588
|
namespace: self.namespace.clone(),
|
|
583
589
|
messages: vec![],
|
|
@@ -587,7 +593,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
587
593
|
deployment_options: self.deployment_options(),
|
|
588
594
|
};
|
|
589
595
|
Ok(self
|
|
590
|
-
.
|
|
596
|
+
.connection
|
|
591
597
|
.clone()
|
|
592
598
|
.respond_workflow_task_failed(request.into_request())
|
|
593
599
|
.await?
|
|
@@ -597,17 +603,24 @@ impl WorkerClient for WorkerClientBag {
|
|
|
597
603
|
async fn fail_nexus_task(
|
|
598
604
|
&self,
|
|
599
605
|
task_token: TaskToken,
|
|
600
|
-
error:
|
|
606
|
+
error: NexusTaskFailure,
|
|
601
607
|
) -> Result<RespondNexusTaskFailedResponse> {
|
|
608
|
+
let (error, failure) = match error {
|
|
609
|
+
NexusTaskFailure::Legacy(handler_err) => (Some(handler_err), None),
|
|
610
|
+
NexusTaskFailure::Temporal(failure) => (None, Some(failure)),
|
|
611
|
+
};
|
|
612
|
+
|
|
602
613
|
Ok(self
|
|
603
|
-
.
|
|
614
|
+
.connection
|
|
604
615
|
.clone()
|
|
605
616
|
.respond_nexus_task_failed(
|
|
617
|
+
#[allow(deprecated)]
|
|
606
618
|
RespondNexusTaskFailedRequest {
|
|
607
619
|
namespace: self.namespace.clone(),
|
|
608
|
-
identity: self.identity
|
|
620
|
+
identity: self.identity(),
|
|
609
621
|
task_token: task_token.0,
|
|
610
|
-
|
|
622
|
+
failure,
|
|
623
|
+
error,
|
|
611
624
|
}
|
|
612
625
|
.into_request(),
|
|
613
626
|
)
|
|
@@ -622,7 +635,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
622
635
|
page_token: Vec<u8>,
|
|
623
636
|
) -> Result<GetWorkflowExecutionHistoryResponse> {
|
|
624
637
|
Ok(self
|
|
625
|
-
.
|
|
638
|
+
.connection
|
|
626
639
|
.clone()
|
|
627
640
|
.get_workflow_execution_history(
|
|
628
641
|
GetWorkflowExecutionHistoryRequest {
|
|
@@ -658,7 +671,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
658
671
|
let (_, completed_type, query_result, error_message) = query_result.into_components();
|
|
659
672
|
|
|
660
673
|
Ok(self
|
|
661
|
-
.
|
|
674
|
+
.connection
|
|
662
675
|
.clone()
|
|
663
676
|
.respond_query_task_completed(
|
|
664
677
|
RespondQueryTaskCompletedRequest {
|
|
@@ -678,7 +691,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
678
691
|
|
|
679
692
|
async fn describe_namespace(&self) -> Result<DescribeNamespaceResponse> {
|
|
680
693
|
Ok(self
|
|
681
|
-
.
|
|
694
|
+
.connection
|
|
682
695
|
.clone()
|
|
683
696
|
.describe_namespace(
|
|
684
697
|
Namespace::Name(self.namespace.clone())
|
|
@@ -692,19 +705,23 @@ impl WorkerClient for WorkerClientBag {
|
|
|
692
705
|
async fn shutdown_worker(
|
|
693
706
|
&self,
|
|
694
707
|
sticky_task_queue: String,
|
|
708
|
+
task_queue: String,
|
|
709
|
+
task_queue_types: Vec<TaskQueueType>,
|
|
695
710
|
final_heartbeat: Option<WorkerHeartbeat>,
|
|
696
711
|
) -> Result<ShutdownWorkerResponse> {
|
|
697
712
|
let mut final_heartbeat = final_heartbeat;
|
|
698
713
|
if let Some(w) = final_heartbeat.as_mut() {
|
|
699
|
-
w.status = WorkerStatus::Shutdown.into();
|
|
700
714
|
self.set_heartbeat_client_fields(w);
|
|
701
715
|
}
|
|
702
716
|
let mut request = ShutdownWorkerRequest {
|
|
703
717
|
namespace: self.namespace.clone(),
|
|
704
|
-
identity: self.identity
|
|
718
|
+
identity: self.identity(),
|
|
705
719
|
sticky_task_queue,
|
|
706
720
|
reason: "graceful shutdown".to_string(),
|
|
707
721
|
worker_heartbeat: final_heartbeat,
|
|
722
|
+
worker_instance_key: self.worker_instance_key.to_string(),
|
|
723
|
+
task_queue,
|
|
724
|
+
task_queue_types: task_queue_types.into_iter().map(|t| t as i32).collect(),
|
|
708
725
|
}
|
|
709
726
|
.into_request();
|
|
710
727
|
request
|
|
@@ -712,7 +729,7 @@ impl WorkerClient for WorkerClientBag {
|
|
|
712
729
|
.insert(RetryConfigForCall(RetryOptions::no_retries()));
|
|
713
730
|
|
|
714
731
|
Ok(
|
|
715
|
-
WorkflowService::shutdown_worker(&mut self.
|
|
732
|
+
WorkflowService::shutdown_worker(&mut self.connection.clone(), request)
|
|
716
733
|
.await?
|
|
717
734
|
.into_inner(),
|
|
718
735
|
)
|
|
@@ -725,32 +742,27 @@ impl WorkerClient for WorkerClientBag {
|
|
|
725
742
|
) -> Result<RecordWorkerHeartbeatResponse> {
|
|
726
743
|
let request = RecordWorkerHeartbeatRequest {
|
|
727
744
|
namespace,
|
|
728
|
-
identity: self.identity
|
|
745
|
+
identity: self.identity(),
|
|
729
746
|
worker_heartbeat,
|
|
730
747
|
};
|
|
731
748
|
Ok(self
|
|
732
|
-
.
|
|
749
|
+
.connection
|
|
733
750
|
.clone()
|
|
734
751
|
.record_worker_heartbeat(request.into_request())
|
|
735
752
|
.await?
|
|
736
753
|
.into_inner())
|
|
737
754
|
}
|
|
738
755
|
|
|
739
|
-
fn
|
|
740
|
-
self.
|
|
756
|
+
fn replace_connection(&self, new_connection: Connection) {
|
|
757
|
+
self.connection.replace_client(new_connection);
|
|
741
758
|
}
|
|
742
759
|
|
|
743
760
|
fn capabilities(&self) -> Option<Capabilities> {
|
|
744
|
-
self.
|
|
745
|
-
.get_client()
|
|
746
|
-
.inner_cow()
|
|
747
|
-
.inner()
|
|
748
|
-
.capabilities()
|
|
749
|
-
.cloned()
|
|
761
|
+
self.connection.inner_cow().capabilities().cloned()
|
|
750
762
|
}
|
|
751
763
|
|
|
752
764
|
fn workers(&self) -> Arc<ClientWorkerSet> {
|
|
753
|
-
self.
|
|
765
|
+
self.connection.inner_cow().workers()
|
|
754
766
|
}
|
|
755
767
|
|
|
756
768
|
fn is_mock(&self) -> bool {
|
|
@@ -758,22 +770,28 @@ impl WorkerClient for WorkerClientBag {
|
|
|
758
770
|
}
|
|
759
771
|
|
|
760
772
|
fn sdk_name_and_version(&self) -> (String, String) {
|
|
761
|
-
let inner = self.
|
|
762
|
-
|
|
763
|
-
|
|
773
|
+
let inner = self.connection.inner_cow();
|
|
774
|
+
(
|
|
775
|
+
inner.client_name().to_owned(),
|
|
776
|
+
inner.client_version().to_owned(),
|
|
777
|
+
)
|
|
764
778
|
}
|
|
765
779
|
|
|
766
780
|
fn identity(&self) -> String {
|
|
767
|
-
self.identity
|
|
781
|
+
self.identity()
|
|
768
782
|
}
|
|
769
783
|
|
|
770
784
|
fn worker_grouping_key(&self) -> Uuid {
|
|
771
|
-
self.
|
|
785
|
+
self.connection.inner_cow().worker_grouping_key()
|
|
786
|
+
}
|
|
787
|
+
|
|
788
|
+
fn worker_instance_key(&self) -> Uuid {
|
|
789
|
+
self.worker_instance_key
|
|
772
790
|
}
|
|
773
791
|
|
|
774
792
|
fn set_heartbeat_client_fields(&self, heartbeat: &mut WorkerHeartbeat) {
|
|
775
793
|
if let Some(host_info) = heartbeat.host_info.as_mut() {
|
|
776
|
-
host_info.
|
|
794
|
+
host_info.worker_grouping_key = self.worker_grouping_key().to_string();
|
|
777
795
|
}
|
|
778
796
|
heartbeat.worker_identity = WorkerClient::identity(self);
|
|
779
797
|
let sdk_name_and_ver = self.sdk_name_and_version();
|
|
@@ -822,7 +840,7 @@ impl NamespacedClient for WorkerClientBag {
|
|
|
822
840
|
}
|
|
823
841
|
|
|
824
842
|
fn identity(&self) -> String {
|
|
825
|
-
self.identity
|
|
843
|
+
self.identity()
|
|
826
844
|
}
|
|
827
845
|
}
|
|
828
846
|
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
use crate::{
|
|
2
|
-
WorkerClient,
|
|
3
|
-
worker::{TaskPollers, WorkerTelemetry},
|
|
2
|
+
WorkerClient, WorkerConfig,
|
|
3
|
+
worker::{PollerBehavior, TaskPollers, WorkerTelemetry, WorkerVersioningStrategy},
|
|
4
4
|
};
|
|
5
5
|
use parking_lot::RwLock;
|
|
6
6
|
use std::{collections::HashMap, sync::Arc, time::Duration};
|
|
7
7
|
use temporalio_client::worker::SharedNamespaceWorkerTrait;
|
|
8
8
|
use temporalio_common::{
|
|
9
|
-
protos::temporal::api::worker::v1::WorkerHeartbeat,
|
|
10
|
-
worker::{PollerBehavior, WorkerConfigBuilder, WorkerTaskTypes, WorkerVersioningStrategy},
|
|
9
|
+
protos::temporal::api::worker::v1::WorkerHeartbeat, worker::WorkerTaskTypes,
|
|
11
10
|
};
|
|
12
11
|
use tokio::sync::Notify;
|
|
13
12
|
use tokio_util::sync::CancellationToken;
|
|
@@ -32,7 +31,7 @@ impl SharedNamespaceWorker {
|
|
|
32
31
|
heartbeat_interval: Duration,
|
|
33
32
|
telemetry: Option<WorkerTelemetry>,
|
|
34
33
|
) -> Result<Self, anyhow::Error> {
|
|
35
|
-
let config =
|
|
34
|
+
let config = WorkerConfig::builder()
|
|
36
35
|
.namespace(namespace.clone())
|
|
37
36
|
.task_queue(format!(
|
|
38
37
|
"temporal-sys/worker-commands/{namespace}/{}",
|
|
@@ -45,7 +44,7 @@ impl SharedNamespaceWorker {
|
|
|
45
44
|
})
|
|
46
45
|
.nexus_task_poller_behavior(PollerBehavior::SimpleMaximum(1_usize))
|
|
47
46
|
.build()
|
|
48
|
-
.expect("
|
|
47
|
+
.expect("internal shared namespace worker options are valid");
|
|
49
48
|
let worker = crate::worker::Worker::new_with_pollers(
|
|
50
49
|
config,
|
|
51
50
|
None,
|
|
@@ -75,7 +74,7 @@ impl SharedNamespaceWorker {
|
|
|
75
74
|
.map(|caps| caps.worker_heartbeats)
|
|
76
75
|
!= Some(true)
|
|
77
76
|
{
|
|
78
|
-
|
|
77
|
+
debug!(
|
|
79
78
|
"Worker heartbeating configured for runtime, but server version does not support it."
|
|
80
79
|
);
|
|
81
80
|
worker.shutdown().await;
|
|
@@ -161,7 +160,7 @@ mod tests {
|
|
|
161
160
|
use crate::{
|
|
162
161
|
test_help::{WorkerExt, test_worker_cfg},
|
|
163
162
|
worker,
|
|
164
|
-
worker::client::mocks::mock_worker_client,
|
|
163
|
+
worker::{PollerBehavior, client::mocks::mock_worker_client},
|
|
165
164
|
};
|
|
166
165
|
use std::{
|
|
167
166
|
sync::{
|
|
@@ -170,12 +169,9 @@ mod tests {
|
|
|
170
169
|
},
|
|
171
170
|
time::Duration,
|
|
172
171
|
};
|
|
173
|
-
use temporalio_common::{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
workflowservice::v1::{DescribeNamespaceResponse, RecordWorkerHeartbeatResponse},
|
|
177
|
-
},
|
|
178
|
-
worker::PollerBehavior,
|
|
172
|
+
use temporalio_common::protos::temporal::api::{
|
|
173
|
+
namespace::v1::{NamespaceInfo, namespace_info::Capabilities},
|
|
174
|
+
workflowservice::v1::{DescribeNamespaceResponse, RecordWorkerHeartbeatResponse},
|
|
179
175
|
};
|
|
180
176
|
|
|
181
177
|
#[tokio::test]
|