@temporalio/core-bridge 1.15.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 +172 -70
- package/lib/native.d.ts +1 -1
- package/package.json +2 -2
- 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 +41 -30
- package/sdk-core/Cargo.toml +3 -0
- package/sdk-core/README.md +15 -9
- 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} +280 -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} +1 -1
- package/sdk-core/crates/client/src/workflow_handle.rs +826 -0
- package/sdk-core/crates/common/Cargo.toml +61 -2
- 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/Makefile +2 -1
- package/sdk-core/crates/common/protos/api_upstream/buf.yaml +0 -3
- 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 +1166 -770
- package/sdk-core/crates/common/protos/api_upstream/openapi/openapiv3.yaml +1243 -750
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/deployment/v1/message.proto +2 -2
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/enums/v1/workflow.proto +4 -3
- 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 +4 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/nexus/v1/message.proto +16 -1
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +64 -6
- package/sdk-core/crates/common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +88 -33
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/nexus/nexus.proto +4 -2
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +4 -0
- package/sdk-core/crates/common/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +5 -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 +3 -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 +122 -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 +5 -7
- package/sdk-core/crates/common/src/telemetry/metrics/core.rs +125 -0
- package/sdk-core/crates/common/src/telemetry/metrics.rs +268 -223
- 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 +264 -4
- package/sdk-core/crates/common/src/worker.rs +68 -603
- 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 +757 -442
- package/sdk-core/crates/sdk/src/workflow_context/options.rs +45 -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 +57 -64
- package/sdk-core/crates/sdk-core/benches/workflow_replay_bench.rs +41 -35
- 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 +13 -15
- 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 +493 -26
- package/sdk-core/crates/sdk-core/src/core_tests/workflow_tasks.rs +4 -8
- package/sdk-core/crates/sdk-core/src/ephemeral_server/mod.rs +7 -7
- package/sdk-core/crates/sdk-core/src/histfetch.rs +20 -10
- package/sdk-core/crates/sdk-core/src/lib.rs +41 -111
- package/sdk-core/crates/sdk-core/src/pollers/mod.rs +4 -9
- package/sdk-core/crates/sdk-core/src/pollers/poll_buffer.rs +118 -19
- 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 +179 -196
- package/sdk-core/crates/sdk-core/src/telemetry/mod.rs +3 -280
- package/sdk-core/crates/sdk-core/src/test_help/integ_helpers.rs +6 -9
- package/sdk-core/crates/sdk-core/src/test_help/unit_helpers.rs +3 -6
- 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 +9 -5
- package/sdk-core/crates/sdk-core/src/worker/client.rs +103 -81
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +7 -11
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1124 -229
- package/sdk-core/crates/sdk-core/src/worker/nexus.rs +145 -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 +13 -13
- package/sdk-core/crates/sdk-core/src/worker/tuner.rs +28 -8
- package/sdk-core/crates/sdk-core/src/worker/workflow/driven_workflow.rs +9 -3
- 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 +16 -3
- package/sdk-core/crates/sdk-core/src/worker/workflow/managed_run.rs +14 -18
- package/sdk-core/crates/sdk-core/src/worker/workflow/mod.rs +4 -6
- 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 +241 -196
- package/sdk-core/crates/sdk-core/tests/common/workflows.rs +41 -28
- package/sdk-core/crates/sdk-core/tests/global_metric_tests.rs +3 -5
- package/sdk-core/crates/sdk-core/tests/heavy_tests/fuzzy_workflow.rs +73 -64
- package/sdk-core/crates/sdk-core/tests/heavy_tests.rs +298 -252
- 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 +16 -12
- package/sdk-core/crates/sdk-core/tests/integ_tests/heartbeat_tests.rs +48 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/metrics_tests.rs +327 -255
- 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 +147 -126
- 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 -453
- 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 +360 -231
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_tests.rs +248 -185
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_versioning_tests.rs +52 -43
- 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 +428 -315
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +82 -56
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +56 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +364 -243
- 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 +101 -42
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +243 -147
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/eager.rs +98 -28
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +1475 -1036
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +73 -41
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +397 -238
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/patches.rs +340 -188
- 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 +154 -137
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/signals.rs +183 -105
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +85 -38
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/timers.rs +142 -40
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +73 -54
- package/sdk-core/crates/sdk-core/tests/integ_tests/workflow_tests.rs +363 -226
- package/sdk-core/crates/sdk-core/tests/main.rs +17 -15
- package/sdk-core/crates/sdk-core/tests/manual_tests.rs +207 -152
- package/sdk-core/crates/sdk-core/tests/shared_tests/mod.rs +65 -34
- 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 +7 -1
- package/sdk-core/crates/sdk-core-c-bridge/include/temporal-sdk-core-c-bridge.h +14 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/client.rs +83 -74
- package/sdk-core/crates/sdk-core-c-bridge/src/metric.rs +9 -14
- package/sdk-core/crates/sdk-core-c-bridge/src/runtime.rs +1 -2
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/context.rs +13 -13
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/mod.rs +6 -6
- package/sdk-core/crates/sdk-core-c-bridge/src/tests/utils.rs +3 -4
- package/sdk-core/crates/sdk-core-c-bridge/src/worker.rs +62 -75
- package/sdk-core/rustfmt.toml +2 -1
- package/src/client.rs +205 -318
- package/src/metrics.rs +22 -30
- package/src/runtime.rs +4 -5
- package/src/worker.rs +15 -18
- package/ts/native.ts +1 -1
- 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/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,11 +1,8 @@
|
|
|
1
1
|
use crate::{
|
|
2
2
|
abstractions::UsedMeteredSemPermit,
|
|
3
3
|
pollers::{BoxedNexusPoller, NexusPollItem, new_nexus_task_poller},
|
|
4
|
-
telemetry::{
|
|
5
|
-
|
|
6
|
-
metrics::{FailureReason, MetricsContext},
|
|
7
|
-
},
|
|
8
|
-
worker::client::WorkerClient,
|
|
4
|
+
telemetry::metrics::{self, FailureReason, MetricsContext},
|
|
5
|
+
worker::{CompleteNexusError, NexusSlotKind, PollError, client::WorkerClient},
|
|
9
6
|
};
|
|
10
7
|
use anyhow::anyhow;
|
|
11
8
|
use futures_util::{
|
|
@@ -21,24 +18,26 @@ use std::{
|
|
|
21
18
|
},
|
|
22
19
|
time::{Duration, Instant, SystemTime},
|
|
23
20
|
};
|
|
24
|
-
use temporalio_common::{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
CancelNexusTask, NexusTask, NexusTaskCancelReason, nexus_task,
|
|
32
|
-
nexus_task_completion,
|
|
33
|
-
},
|
|
21
|
+
use temporalio_common::protos::{
|
|
22
|
+
TaskToken,
|
|
23
|
+
coresdk::{
|
|
24
|
+
NexusSlotInfo,
|
|
25
|
+
nexus::{
|
|
26
|
+
CancelNexusTask, NexusOperationErrorState, NexusTask, NexusTaskCancelReason,
|
|
27
|
+
nexus_task, nexus_task_completion,
|
|
34
28
|
},
|
|
35
|
-
|
|
29
|
+
},
|
|
30
|
+
temporal::api::{
|
|
31
|
+
failure::v1::failure::FailureInfo,
|
|
32
|
+
nexus::{
|
|
36
33
|
self,
|
|
37
|
-
v1::{
|
|
34
|
+
v1::{
|
|
35
|
+
NexusTaskFailure, UnsuccessfulOperationError, request::Variant, response,
|
|
36
|
+
start_operation_response,
|
|
37
|
+
},
|
|
38
38
|
},
|
|
39
|
-
utilities::normalize_http_headers,
|
|
40
39
|
},
|
|
41
|
-
|
|
40
|
+
utilities::normalize_http_headers,
|
|
42
41
|
};
|
|
43
42
|
use tokio::{
|
|
44
43
|
join,
|
|
@@ -125,20 +124,78 @@ impl NexusManager {
|
|
|
125
124
|
.nexus_task_execution_latency(task_info.start_time.elapsed());
|
|
126
125
|
task_info.timeout_task.inspect(|jh| jh.abort());
|
|
127
126
|
let (did_send, maybe_net_err) = match status {
|
|
128
|
-
nexus_task_completion::Status::Completed(c) => {
|
|
127
|
+
nexus_task_completion::Status::Completed(mut c) => {
|
|
129
128
|
// Server doesn't provide obvious errors for this validation, so it's done
|
|
130
129
|
// here to make life easier for lang implementors.
|
|
131
|
-
match &c.variant {
|
|
130
|
+
match &mut c.variant {
|
|
132
131
|
Some(response::Variant::StartOperation(so)) => {
|
|
132
|
+
#[allow(deprecated)]
|
|
133
133
|
if let Some(start_operation_response::Variant::OperationError(oe)) =
|
|
134
134
|
so.variant.as_ref()
|
|
135
135
|
{
|
|
136
|
+
// Deprecated branch left for SDKs that have not yet started using Temporal failures
|
|
136
137
|
self.metrics
|
|
137
138
|
.with_new_attrs([metrics::failure_reason(
|
|
138
139
|
FailureReason::NexusOperation(oe.operation_state.clone()),
|
|
139
140
|
)])
|
|
140
141
|
.nexus_task_execution_failed();
|
|
141
|
-
}
|
|
142
|
+
} else if let Some(start_operation_response::Variant::Failure(f)) =
|
|
143
|
+
&mut so.variant
|
|
144
|
+
{
|
|
145
|
+
let operation_state = match &f.failure_info {
|
|
146
|
+
Some(FailureInfo::ApplicationFailureInfo(_)) => {
|
|
147
|
+
NexusOperationErrorState::Failed
|
|
148
|
+
}
|
|
149
|
+
Some(FailureInfo::CanceledFailureInfo(_)) => {
|
|
150
|
+
NexusOperationErrorState::Canceled
|
|
151
|
+
}
|
|
152
|
+
_ => {
|
|
153
|
+
return Err(CompleteNexusError::MalformedNexusCompletion {
|
|
154
|
+
reason: "Nexus StartOperationResponse with a failure must contain ApplicationFailureInfo or CanceledFailureInfo"
|
|
155
|
+
.to_string(),
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
let use_temporal_failures = task_info
|
|
161
|
+
.capabilities
|
|
162
|
+
.as_ref()
|
|
163
|
+
.map(|c| c.temporal_failure_responses)
|
|
164
|
+
.unwrap_or_default();
|
|
165
|
+
|
|
166
|
+
if !use_temporal_failures {
|
|
167
|
+
// Take the failure from the StartOperationResponse variant
|
|
168
|
+
let failure = std::mem::take(f);
|
|
169
|
+
|
|
170
|
+
// Convert the failure to an UnsuccessfulOperationError
|
|
171
|
+
let failure =
|
|
172
|
+
nexus::v1::Failure::try_from(failure)
|
|
173
|
+
.map_err(|err| CompleteNexusError::MalformedNexusCompletion {
|
|
174
|
+
reason: format!(
|
|
175
|
+
"error converting temporal failure to nexus failure: {:?}",
|
|
176
|
+
err
|
|
177
|
+
),
|
|
178
|
+
})?;
|
|
179
|
+
|
|
180
|
+
// Set StartOperationResponse variant to new UnsuccessfulOperationError
|
|
181
|
+
so.variant = Some(
|
|
182
|
+
#[allow(deprecated)]
|
|
183
|
+
start_operation_response::Variant::OperationError(
|
|
184
|
+
UnsuccessfulOperationError {
|
|
185
|
+
operation_state: operation_state.to_string(),
|
|
186
|
+
failure: Some(failure),
|
|
187
|
+
},
|
|
188
|
+
),
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
self.metrics
|
|
193
|
+
.with_new_attrs([metrics::failure_reason(
|
|
194
|
+
FailureReason::NexusOperation(operation_state.to_string()),
|
|
195
|
+
)])
|
|
196
|
+
.nexus_task_execution_failed();
|
|
197
|
+
}
|
|
198
|
+
|
|
142
199
|
if task_info.request_kind != RequestKind::Start {
|
|
143
200
|
return Err(CompleteNexusError::MalformedNexusCompletion {
|
|
144
201
|
reason: "Nexus response was StartOperation but request was not"
|
|
@@ -164,19 +221,76 @@ impl NexusManager {
|
|
|
164
221
|
}
|
|
165
222
|
(true, client.complete_nexus_task(tt, c).await.err())
|
|
166
223
|
}
|
|
224
|
+
|
|
167
225
|
nexus_task_completion::Status::AckCancel(_) => {
|
|
168
226
|
self.metrics
|
|
169
227
|
.with_new_attrs([metrics::failure_reason(FailureReason::Timeout)])
|
|
170
228
|
.nexus_task_execution_failed();
|
|
171
229
|
(false, None)
|
|
172
230
|
}
|
|
231
|
+
|
|
232
|
+
#[allow(deprecated)]
|
|
173
233
|
nexus_task_completion::Status::Error(e) => {
|
|
234
|
+
// Deprecated branch left for SDKs that have not yet started using Temporal failures
|
|
174
235
|
self.metrics
|
|
175
236
|
.with_new_attrs([metrics::failure_reason(
|
|
176
237
|
FailureReason::NexusHandlerError(e.error_type.clone()),
|
|
177
238
|
)])
|
|
178
239
|
.nexus_task_execution_failed();
|
|
179
|
-
|
|
240
|
+
let maybe_net_err = client
|
|
241
|
+
.fail_nexus_task(tt, NexusTaskFailure::Legacy(e))
|
|
242
|
+
.await
|
|
243
|
+
.err();
|
|
244
|
+
(true, maybe_net_err)
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
nexus_task_completion::Status::Failure(f) => {
|
|
248
|
+
let use_temporal_failures = task_info
|
|
249
|
+
.capabilities
|
|
250
|
+
.as_ref()
|
|
251
|
+
.map(|c| c.temporal_failure_responses)
|
|
252
|
+
.unwrap_or_default();
|
|
253
|
+
|
|
254
|
+
let failure_info = match &f.failure_info {
|
|
255
|
+
Some(FailureInfo::NexusHandlerFailureInfo(failure_info)) => {
|
|
256
|
+
failure_info.clone()
|
|
257
|
+
}
|
|
258
|
+
_ => {
|
|
259
|
+
return Err(CompleteNexusError::MalformedNexusCompletion {
|
|
260
|
+
reason: "Nexus completions with a failure must contain a NexusHandlerFailureInfo".to_string(),
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
self.metrics
|
|
266
|
+
.with_new_attrs([metrics::failure_reason(
|
|
267
|
+
FailureReason::NexusHandlerError(failure_info.r#type.clone()),
|
|
268
|
+
)])
|
|
269
|
+
.nexus_task_execution_failed();
|
|
270
|
+
|
|
271
|
+
let task_failure = if use_temporal_failures {
|
|
272
|
+
NexusTaskFailure::Temporal(f)
|
|
273
|
+
} else {
|
|
274
|
+
let failure = nexus::v1::Failure::try_from(f).map_err(|err| {
|
|
275
|
+
CompleteNexusError::MalformedNexusCompletion {
|
|
276
|
+
reason: format!(
|
|
277
|
+
"error converting temporal failure to nexus failure: {:?}",
|
|
278
|
+
err
|
|
279
|
+
),
|
|
280
|
+
}
|
|
281
|
+
})?;
|
|
282
|
+
|
|
283
|
+
let h = nexus::v1::HandlerError {
|
|
284
|
+
error_type: failure_info.r#type,
|
|
285
|
+
failure: Some(failure),
|
|
286
|
+
//NexusHandlerFailureInfo and HandlerError both use enums::v1::NexusHandlerErrorRetryBehavior
|
|
287
|
+
retry_behavior: failure_info.retry_behavior,
|
|
288
|
+
};
|
|
289
|
+
NexusTaskFailure::Legacy(h)
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
let maybe_net_err = client.fail_nexus_task(tt, task_failure).await.err();
|
|
293
|
+
(true, maybe_net_err)
|
|
180
294
|
}
|
|
181
295
|
};
|
|
182
296
|
|
|
@@ -317,6 +431,12 @@ where
|
|
|
317
431
|
),
|
|
318
432
|
})
|
|
319
433
|
.unwrap_or_default();
|
|
434
|
+
|
|
435
|
+
let capabilities = t
|
|
436
|
+
.resp
|
|
437
|
+
.request
|
|
438
|
+
.as_ref()
|
|
439
|
+
.and_then(|r| r.capabilities);
|
|
320
440
|
self.outstanding_task_map.lock().insert(
|
|
321
441
|
tt,
|
|
322
442
|
NexusInFlightTask {
|
|
@@ -330,6 +450,7 @@ where
|
|
|
330
450
|
.and_then(|t| t.try_into().ok()),
|
|
331
451
|
start_time: Instant::now(),
|
|
332
452
|
_permit: t.permit.into_used(NexusSlotInfo { service, operation }),
|
|
453
|
+
capabilities,
|
|
333
454
|
},
|
|
334
455
|
);
|
|
335
456
|
Some(Ok(NexusTask {
|
|
@@ -387,6 +508,7 @@ struct NexusInFlightTask {
|
|
|
387
508
|
scheduled_time: Option<SystemTime>,
|
|
388
509
|
start_time: Instant,
|
|
389
510
|
_permit: UsedMeteredSemPermit<NexusSlotKind>,
|
|
511
|
+
capabilities: Option<nexus::v1::request::Capabilities>,
|
|
390
512
|
}
|
|
391
513
|
|
|
392
514
|
#[derive(Eq, PartialEq, Copy, Clone, Default)]
|
|
@@ -5,12 +5,12 @@
|
|
|
5
5
|
use crate::{
|
|
6
6
|
abstractions::{MeteredPermitDealer, OwnedMeteredSemPermit},
|
|
7
7
|
protosext::ValidPollWFTQResponse,
|
|
8
|
-
worker::workflow::wft_poller::validate_wft,
|
|
8
|
+
worker::{WorkflowSlotKind, workflow::wft_poller::validate_wft},
|
|
9
9
|
};
|
|
10
10
|
use temporalio_client::worker::Slot as SlotTrait;
|
|
11
11
|
use temporalio_common::{
|
|
12
12
|
protos::temporal::api::workflowservice::v1::PollWorkflowTaskQueueResponse,
|
|
13
|
-
worker::
|
|
13
|
+
worker::WorkerDeploymentOptions,
|
|
14
14
|
};
|
|
15
15
|
use tokio::sync::mpsc::UnboundedSender;
|
|
16
16
|
use tonic::Status;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
use
|
|
2
|
-
use temporalio_common::worker::{
|
|
1
|
+
use crate::worker::{
|
|
3
2
|
SlotKind, SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext, SlotSupplier,
|
|
4
3
|
SlotSupplierPermit,
|
|
5
4
|
};
|
|
5
|
+
use std::{marker::PhantomData, sync::Arc};
|
|
6
6
|
use tokio::sync::Semaphore;
|
|
7
7
|
|
|
8
8
|
/// Implements [SlotSupplier] with a fixed number of slots
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
use crate::worker::{
|
|
2
|
+
ActivitySlotKind, LocalActivitySlotKind, NexusSlotKind, SlotInfo, SlotInfoTrait, SlotKind,
|
|
3
|
+
SlotKindType, SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext, SlotSupplier,
|
|
4
|
+
SlotSupplierPermit, WorkerTuner, WorkflowSlotKind,
|
|
5
|
+
};
|
|
1
6
|
use crossbeam_utils::atomic::AtomicCell;
|
|
2
7
|
use parking_lot::Mutex;
|
|
3
8
|
use std::{
|
|
@@ -12,18 +17,11 @@ use std::{
|
|
|
12
17
|
thread,
|
|
13
18
|
time::{Duration, Instant},
|
|
14
19
|
};
|
|
15
|
-
use temporalio_common::{
|
|
16
|
-
telemetry::metrics::{CoreMeter, GaugeF64, MetricAttributes, TemporalMeter},
|
|
17
|
-
worker::{
|
|
18
|
-
ActivitySlotKind, LocalActivitySlotKind, NexusSlotKind, SlotInfo, SlotInfoTrait, SlotKind,
|
|
19
|
-
SlotKindType, SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext,
|
|
20
|
-
SlotSupplier, SlotSupplierPermit, WorkerTuner, WorkflowSlotKind,
|
|
21
|
-
},
|
|
22
|
-
};
|
|
20
|
+
use temporalio_common::telemetry::metrics::{GaugeF64, MetricAttributes, TemporalMeter};
|
|
23
21
|
use tokio::{sync::watch, task::JoinHandle};
|
|
24
22
|
|
|
25
|
-
/// Implements [WorkerTuner] and attempts to maintain certain levels of resource
|
|
26
|
-
/// under load.
|
|
23
|
+
/// Implements [crate::worker::WorkerTuner] and attempts to maintain certain levels of resource
|
|
24
|
+
/// usage when under load.
|
|
27
25
|
///
|
|
28
26
|
/// It does so by using two PID controllers, one for memory and one for CPU, which are fed the
|
|
29
27
|
/// current usage levels of their respective resource as measurements. The user specifies a target
|
|
@@ -236,7 +234,7 @@ impl MetricInstruments {
|
|
|
236
234
|
let cpu_usage = meter.gauge_f64("resource_slots_cpu_usage".into());
|
|
237
235
|
let mem_pid_output = meter.gauge_f64("resource_slots_mem_pid_output".into());
|
|
238
236
|
let cpu_pid_output = meter.gauge_f64("resource_slots_cpu_pid_output".into());
|
|
239
|
-
let attribs = meter.
|
|
237
|
+
let attribs = meter.get_default_attributes().clone();
|
|
240
238
|
Self {
|
|
241
239
|
attribs,
|
|
242
240
|
mem_usage,
|
|
@@ -726,7 +724,10 @@ impl CGroupCpuFileSystem for CgroupV2CpuFileSystem {
|
|
|
726
724
|
#[cfg(test)]
|
|
727
725
|
mod tests {
|
|
728
726
|
use super::*;
|
|
729
|
-
use crate::{
|
|
727
|
+
use crate::{
|
|
728
|
+
abstractions::MeteredPermitDealer, telemetry::metrics::MetricsContext,
|
|
729
|
+
worker::WorkflowSlotKind,
|
|
730
|
+
};
|
|
730
731
|
use std::{
|
|
731
732
|
cell::RefCell,
|
|
732
733
|
env,
|
|
@@ -738,7 +739,6 @@ mod tests {
|
|
|
738
739
|
},
|
|
739
740
|
thread::sleep,
|
|
740
741
|
};
|
|
741
|
-
use temporalio_common::worker::WorkflowSlotKind;
|
|
742
742
|
|
|
743
743
|
struct FakeMIS {
|
|
744
744
|
used: Arc<AtomicU64>,
|
|
@@ -9,13 +9,16 @@ pub use resource_based::{
|
|
|
9
9
|
|
|
10
10
|
pub(crate) use resource_based::{RealSysInfo, SystemResourceInfo};
|
|
11
11
|
|
|
12
|
-
use
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
use crate::{
|
|
13
|
+
WorkerConfig,
|
|
14
|
+
worker::{
|
|
15
|
+
ActivitySlotKind, LocalActivitySlotKind, NexusSlotKind, SlotKind, SlotSupplier,
|
|
16
|
+
WorkerTuner, WorkflowSlotKind,
|
|
17
|
+
},
|
|
16
18
|
};
|
|
19
|
+
use std::sync::Arc;
|
|
17
20
|
|
|
18
|
-
/// Allows for the composition of different slot suppliers into a [WorkerTuner]
|
|
21
|
+
/// Allows for the composition of different slot suppliers into a [crate::WorkerTuner]
|
|
19
22
|
pub struct TunerHolder {
|
|
20
23
|
wft_supplier: Arc<dyn SlotSupplier<SlotKind = WorkflowSlotKind> + Send + Sync>,
|
|
21
24
|
act_supplier: Arc<dyn SlotSupplier<SlotKind = ActivitySlotKind> + Send + Sync>,
|
|
@@ -23,6 +26,23 @@ pub struct TunerHolder {
|
|
|
23
26
|
nexus_supplier: Arc<dyn SlotSupplier<SlotKind = NexusSlotKind> + Send + Sync>,
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
impl TunerHolder {
|
|
30
|
+
/// Create a tuner with fixed size slot suppliers for all slot kinds.
|
|
31
|
+
pub fn fixed_size(
|
|
32
|
+
workflow_slots: usize,
|
|
33
|
+
activity_slots: usize,
|
|
34
|
+
local_activity_slots: usize,
|
|
35
|
+
nexus_slots: usize,
|
|
36
|
+
) -> Self {
|
|
37
|
+
Self {
|
|
38
|
+
wft_supplier: Arc::new(FixedSizeSlotSupplier::new(workflow_slots)),
|
|
39
|
+
act_supplier: Arc::new(FixedSizeSlotSupplier::new(activity_slots)),
|
|
40
|
+
la_supplier: Arc::new(FixedSizeSlotSupplier::new(local_activity_slots)),
|
|
41
|
+
nexus_supplier: Arc::new(FixedSizeSlotSupplier::new(nexus_slots)),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
26
46
|
/// Can be used to construct a [TunerHolder] without needing to manually construct each
|
|
27
47
|
/// [SlotSupplier]. Useful for lang bridges to allow more easily passing through user options.
|
|
28
48
|
#[derive(Clone, Debug, bon::Builder)]
|
|
@@ -262,7 +282,7 @@ impl TunerBuilder {
|
|
|
262
282
|
self.sys_info.clone()
|
|
263
283
|
}
|
|
264
284
|
|
|
265
|
-
/// Build a [WorkerTuner] from the configured slot suppliers
|
|
285
|
+
/// Build a [crate::WorkerTuner] from the configured slot suppliers
|
|
266
286
|
pub fn build(&mut self) -> TunerHolder {
|
|
267
287
|
TunerHolder {
|
|
268
288
|
wft_supplier: self
|
|
@@ -314,10 +334,10 @@ impl WorkerTuner for TunerHolder {
|
|
|
314
334
|
#[cfg(test)]
|
|
315
335
|
mod tests {
|
|
316
336
|
use super::*;
|
|
317
|
-
use
|
|
318
|
-
use temporalio_common::worker::{
|
|
337
|
+
use crate::worker::{
|
|
319
338
|
SlotMarkUsedContext, SlotReleaseContext, SlotReservationContext, SlotSupplierPermit,
|
|
320
339
|
};
|
|
340
|
+
use std::time::Duration;
|
|
321
341
|
|
|
322
342
|
struct TestSlotSupplier;
|
|
323
343
|
#[async_trait::async_trait]
|
|
@@ -9,7 +9,10 @@ use std::{
|
|
|
9
9
|
};
|
|
10
10
|
use temporalio_common::protos::{
|
|
11
11
|
coresdk::workflow_activation::{WorkflowActivationJob, start_workflow_from_attribs},
|
|
12
|
-
temporal::api::{
|
|
12
|
+
temporal::api::{
|
|
13
|
+
common::v1::{Payload, SearchAttributes},
|
|
14
|
+
history::v1::WorkflowExecutionStartedEventAttributes,
|
|
15
|
+
},
|
|
13
16
|
utilities::TryIntoOrNone,
|
|
14
17
|
};
|
|
15
18
|
|
|
@@ -97,8 +100,11 @@ impl DrivenWorkflow {
|
|
|
97
100
|
}
|
|
98
101
|
|
|
99
102
|
/// Lang sent us an SA upsert command - use it to update our current view of search attributes.
|
|
100
|
-
pub(crate) fn search_attributes_update(&mut self, update:
|
|
101
|
-
|
|
103
|
+
pub(crate) fn search_attributes_update(&mut self, update: Option<SearchAttributes>) {
|
|
104
|
+
if let Some(sa) = update {
|
|
105
|
+
self.search_attribute_modifications
|
|
106
|
+
.extend(sa.indexed_fields);
|
|
107
|
+
}
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
/// Return a view of the "current" state of search attributes. IE: The initial attributes
|
|
@@ -50,11 +50,11 @@ pub(super) fn upsert_search_attrs(
|
|
|
50
50
|
let has_flag = internal_flags
|
|
51
51
|
.borrow_mut()
|
|
52
52
|
.try_use(CoreInternalFlags::UpsertSearchAttributeOnPatch, !replaying);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
{
|
|
53
|
+
let contains_version_key = attribs
|
|
54
|
+
.search_attributes
|
|
55
|
+
.as_ref()
|
|
56
|
+
.is_some_and(|sa| sa.indexed_fields.contains_key(VERSION_SEARCH_ATTR_KEY));
|
|
57
|
+
if has_flag && contains_version_key {
|
|
58
58
|
warn!(
|
|
59
59
|
"Upserting the {VERSION_SEARCH_ATTR_KEY} search attribute directly from workflow code \
|
|
60
60
|
is not permitted and has no effect!"
|
|
@@ -63,7 +63,7 @@ pub(super) fn upsert_search_attrs(
|
|
|
63
63
|
// this.
|
|
64
64
|
create_new(Default::default())
|
|
65
65
|
} else {
|
|
66
|
-
create_new(attribs.search_attributes.
|
|
66
|
+
create_new(attribs.search_attributes.unwrap_or_default())
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
@@ -186,21 +186,18 @@ mod tests {
|
|
|
186
186
|
worker::client::mocks::mock_worker_client,
|
|
187
187
|
};
|
|
188
188
|
use std::collections::HashMap;
|
|
189
|
-
use temporalio_common::{
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
enums::v1::EventType,
|
|
202
|
-
history::v1::{HistoryEvent, UpsertWorkflowSearchAttributesEventAttributes},
|
|
203
|
-
},
|
|
189
|
+
use temporalio_common::protos::{
|
|
190
|
+
coresdk::{
|
|
191
|
+
AsJsonPayloadExt,
|
|
192
|
+
workflow_activation::{WorkflowActivationJob, workflow_activation_job},
|
|
193
|
+
workflow_commands::SetPatchMarker,
|
|
194
|
+
workflow_completion::WorkflowActivationCompletion,
|
|
195
|
+
},
|
|
196
|
+
temporal::api::{
|
|
197
|
+
command::v1::command::Attributes,
|
|
198
|
+
common::v1::Payload,
|
|
199
|
+
enums::v1::EventType,
|
|
200
|
+
history::v1::{HistoryEvent, UpsertWorkflowSearchAttributesEventAttributes},
|
|
204
201
|
},
|
|
205
202
|
};
|
|
206
203
|
|
|
@@ -318,7 +315,9 @@ mod tests {
|
|
|
318
315
|
};
|
|
319
316
|
cmds.push(
|
|
320
317
|
UpsertWorkflowSearchAttributes {
|
|
321
|
-
search_attributes:
|
|
318
|
+
search_attributes: Some(SearchAttributes {
|
|
319
|
+
indexed_fields: ver_upsert,
|
|
320
|
+
}),
|
|
322
321
|
}
|
|
323
322
|
.into(),
|
|
324
323
|
);
|
|
@@ -13,6 +13,7 @@ use super::{
|
|
|
13
13
|
workflow_task_state_machine::WorkflowTaskMachine,
|
|
14
14
|
};
|
|
15
15
|
use crate::{
|
|
16
|
+
WorkerConfig,
|
|
16
17
|
abstractions::dbg_panic,
|
|
17
18
|
internal_flags::{CoreInternalFlags, InternalFlags},
|
|
18
19
|
protosext::{
|
|
@@ -66,13 +67,14 @@ use temporalio_common::{
|
|
|
66
67
|
command::v1::{
|
|
67
68
|
Command as ProtoCommand, CommandAttributesExt, command::Attributes as ProtoCmdAttrs,
|
|
68
69
|
},
|
|
70
|
+
common::v1::SearchAttributes,
|
|
69
71
|
enums::v1::EventType,
|
|
70
72
|
history::v1::{HistoryEvent, history_event},
|
|
71
73
|
protocol::v1::{Message as ProtocolMessage, message::SequencingId},
|
|
72
74
|
sdk::v1::{UserMetadata, WorkflowTaskCompletedMetadata},
|
|
73
75
|
},
|
|
74
76
|
},
|
|
75
|
-
worker::
|
|
77
|
+
worker::WorkerDeploymentVersion,
|
|
76
78
|
};
|
|
77
79
|
|
|
78
80
|
type Result<T, E = WFMachinesError> = std::result::Result<T, E>;
|
|
@@ -128,6 +130,8 @@ pub(crate) struct WorkflowMachines {
|
|
|
128
130
|
continue_as_new_suggested: bool,
|
|
129
131
|
/// Set on each WFT started event
|
|
130
132
|
suggest_continue_as_new_reasons: Vec<i32>,
|
|
133
|
+
/// Set on each WFT started event
|
|
134
|
+
target_worker_deployment_version_changed: bool,
|
|
131
135
|
/// Set if the current WFT is already complete and that completion event had legacy build-id
|
|
132
136
|
/// or a deployment version in it. Will use an empty deployment name if it's legacy build-id.
|
|
133
137
|
current_wft_deployment_info: Option<WorkerDeploymentVersion>,
|
|
@@ -293,6 +297,7 @@ impl WorkflowMachines {
|
|
|
293
297
|
history_size_bytes: 0,
|
|
294
298
|
continue_as_new_suggested: false,
|
|
295
299
|
suggest_continue_as_new_reasons: Default::default(),
|
|
300
|
+
target_worker_deployment_version_changed: false,
|
|
296
301
|
current_wft_deployment_info: None,
|
|
297
302
|
all_machines: Default::default(),
|
|
298
303
|
machine_is_core_created: Default::default(),
|
|
@@ -475,6 +480,7 @@ impl WorkflowMachines {
|
|
|
475
480
|
.unwrap_or_default()
|
|
476
481
|
.to_owned(),
|
|
477
482
|
suggest_continue_as_new_reasons: self.suggest_continue_as_new_reasons.clone(),
|
|
483
|
+
target_worker_deployment_version_changed: self.target_worker_deployment_version_changed,
|
|
478
484
|
}
|
|
479
485
|
}
|
|
480
486
|
|
|
@@ -896,6 +902,8 @@ impl WorkflowMachines {
|
|
|
896
902
|
self.history_size_bytes = u64::try_from(attrs.history_size_bytes).unwrap_or_default();
|
|
897
903
|
self.continue_as_new_suggested = attrs.suggest_continue_as_new;
|
|
898
904
|
self.suggest_continue_as_new_reasons = attrs.suggest_continue_as_new_reasons.clone();
|
|
905
|
+
self.target_worker_deployment_version_changed =
|
|
906
|
+
attrs.target_worker_deployment_version_changed;
|
|
899
907
|
}
|
|
900
908
|
|
|
901
909
|
if let Some(initial_cmd_id) = event.get_initial_command_event_id() {
|
|
@@ -1648,8 +1656,13 @@ impl WorkflowMachines {
|
|
|
1648
1656
|
attrs.retry_policy.clone_from(&started_info.retry_policy);
|
|
1649
1657
|
}
|
|
1650
1658
|
}
|
|
1651
|
-
if attrs.search_attributes.
|
|
1652
|
-
|
|
1659
|
+
if attrs.search_attributes.is_none() {
|
|
1660
|
+
let current = self.drive_me.get_current_search_attributes();
|
|
1661
|
+
if !current.is_empty() {
|
|
1662
|
+
attrs.search_attributes = Some(SearchAttributes {
|
|
1663
|
+
indexed_fields: current,
|
|
1664
|
+
});
|
|
1665
|
+
}
|
|
1653
1666
|
}
|
|
1654
1667
|
attrs
|
|
1655
1668
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
use crate::{
|
|
2
|
-
MetricsContext,
|
|
2
|
+
MetricsContext, WorkerConfig,
|
|
3
3
|
abstractions::dbg_panic,
|
|
4
4
|
internal_flags::CoreInternalFlags,
|
|
5
5
|
protosext::{WorkflowActivationExt, protocol_messages::IncomingProtocolMessage},
|
|
6
6
|
telemetry::metrics,
|
|
7
7
|
worker::{
|
|
8
|
-
LEGACY_QUERY_ID, LocalActRequest,
|
|
8
|
+
LEGACY_QUERY_ID, LocalActRequest, WorkflowErrorType,
|
|
9
9
|
workflow::{
|
|
10
10
|
ActivationAction, ActivationCompleteOutcome, ActivationCompleteResult,
|
|
11
11
|
ActivationOrAuto, BufferedTasks, DrivenWorkflow, EvictionRequestResult,
|
|
@@ -28,24 +28,20 @@ use std::{
|
|
|
28
28
|
sync::{Arc, mpsc::Sender},
|
|
29
29
|
time::{Duration, Instant},
|
|
30
30
|
};
|
|
31
|
-
use temporalio_common::{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
WorkflowActivation, create_evict_activation, query_to_job,
|
|
38
|
-
remove_from_cache::EvictionReason, workflow_activation_job,
|
|
39
|
-
},
|
|
40
|
-
workflow_commands::{FailWorkflowExecution, QueryResult},
|
|
41
|
-
workflow_completion,
|
|
42
|
-
},
|
|
43
|
-
temporal::api::{
|
|
44
|
-
enums::v1::{VersioningBehavior, WorkflowTaskFailedCause},
|
|
45
|
-
failure::v1::Failure,
|
|
31
|
+
use temporalio_common::protos::{
|
|
32
|
+
TaskToken,
|
|
33
|
+
coresdk::{
|
|
34
|
+
workflow_activation::{
|
|
35
|
+
WorkflowActivation, create_evict_activation, query_to_job,
|
|
36
|
+
remove_from_cache::EvictionReason, workflow_activation_job,
|
|
46
37
|
},
|
|
38
|
+
workflow_commands::{FailWorkflowExecution, QueryResult},
|
|
39
|
+
workflow_completion,
|
|
40
|
+
},
|
|
41
|
+
temporal::api::{
|
|
42
|
+
enums::v1::{VersioningBehavior, WorkflowTaskFailedCause},
|
|
43
|
+
failure::v1::Failure,
|
|
47
44
|
},
|
|
48
|
-
worker::WorkerConfig,
|
|
49
45
|
};
|
|
50
46
|
use tokio::sync::oneshot;
|
|
51
47
|
use tracing::Span;
|
|
@@ -15,7 +15,7 @@ pub(crate) use driven_workflow::DrivenWorkflow;
|
|
|
15
15
|
pub(crate) use history_update::HistoryUpdate;
|
|
16
16
|
|
|
17
17
|
use crate::{
|
|
18
|
-
MetricsContext,
|
|
18
|
+
MetricsContext, WorkerConfig,
|
|
19
19
|
abstractions::{
|
|
20
20
|
MeteredPermitDealer, TrackedOwnedMeteredSemPermit, UsedMeteredSemPermit, dbg_panic,
|
|
21
21
|
take_cell::TakeCell,
|
|
@@ -26,11 +26,10 @@ use crate::{
|
|
|
26
26
|
telemetry::{
|
|
27
27
|
VecDisplayer,
|
|
28
28
|
metrics::{self, FailureReason},
|
|
29
|
-
set_trace_subscriber_for_current_thread,
|
|
30
29
|
},
|
|
31
30
|
worker::{
|
|
32
|
-
LocalActRequest, LocalActivityExecutionResult,
|
|
33
|
-
PostActivateHookData,
|
|
31
|
+
ActivitySlotKind, CompleteWfError, LocalActRequest, LocalActivityExecutionResult,
|
|
32
|
+
LocalActivityResolution, PollError, PostActivateHookData, WorkflowSlotKind,
|
|
34
33
|
activities::{ActivitiesFromWFTsHandle, LocalActivityManager},
|
|
35
34
|
client::{LegacyQueryResult, WorkerClient, WorkflowTaskCompletion},
|
|
36
35
|
workflow::{
|
|
@@ -61,7 +60,6 @@ use std::{
|
|
|
61
60
|
};
|
|
62
61
|
use temporalio_client::MESSAGE_TOO_LARGE_KEY;
|
|
63
62
|
use temporalio_common::{
|
|
64
|
-
errors::{CompleteWfError, PollError},
|
|
65
63
|
protos::{
|
|
66
64
|
TaskToken,
|
|
67
65
|
coresdk::{
|
|
@@ -88,7 +86,7 @@ use temporalio_common::{
|
|
|
88
86
|
workflowservice::v1::{PollActivityTaskQueueResponse, get_system_info_response},
|
|
89
87
|
},
|
|
90
88
|
},
|
|
91
|
-
|
|
89
|
+
telemetry::set_trace_subscriber_for_current_thread,
|
|
92
90
|
};
|
|
93
91
|
use tokio::{
|
|
94
92
|
sync::{
|