@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
|
@@ -11,7 +11,7 @@ use std::{
|
|
|
11
11
|
path::{Path, PathBuf},
|
|
12
12
|
process::Stdio,
|
|
13
13
|
};
|
|
14
|
-
use temporalio_sdk_core::ephemeral_server::{
|
|
14
|
+
use temporalio_sdk_core::ephemeral_server::{TestServerConfig, default_cached_download};
|
|
15
15
|
use tokio::{self, process::Command};
|
|
16
16
|
|
|
17
17
|
/// This env var is set (to any value) if temporal CLI dev server is in use
|
|
@@ -95,9 +95,7 @@ async fn main() -> Result<(), anyhow::Error> {
|
|
|
95
95
|
let (server, envs) = match server_kind {
|
|
96
96
|
ServerKind::TemporalCLI => {
|
|
97
97
|
let config =
|
|
98
|
-
integ_dev_server_config(vec!["--http-port".to_string(), "7243".to_string()])
|
|
99
|
-
.ui(true)
|
|
100
|
-
.build()?;
|
|
98
|
+
integ_dev_server_config(vec!["--http-port".to_string(), "7243".to_string()], true);
|
|
101
99
|
println!("Using temporal CLI: {config:?}");
|
|
102
100
|
(
|
|
103
101
|
Some(
|
|
@@ -109,9 +107,9 @@ async fn main() -> Result<(), anyhow::Error> {
|
|
|
109
107
|
)
|
|
110
108
|
}
|
|
111
109
|
ServerKind::TestServer => {
|
|
112
|
-
let config =
|
|
110
|
+
let config = TestServerConfig::builder()
|
|
113
111
|
.exe(default_cached_download())
|
|
114
|
-
.build()
|
|
112
|
+
.build();
|
|
115
113
|
println!("Using java test server");
|
|
116
114
|
(
|
|
117
115
|
Some(
|
|
@@ -1,48 +1,94 @@
|
|
|
1
1
|
//! Shared tests that are meant to be run against both local dev server and cloud
|
|
2
2
|
|
|
3
3
|
use crate::common::CoreWfStarter;
|
|
4
|
-
use std::sync::
|
|
4
|
+
use std::sync::{
|
|
5
|
+
Arc,
|
|
6
|
+
atomic::{AtomicBool, Ordering::Relaxed},
|
|
7
|
+
};
|
|
5
8
|
use temporalio_common::{
|
|
6
9
|
protos::temporal::api::{
|
|
7
10
|
enums::v1::{EventType, WorkflowTaskFailedCause::GrpcMessageTooLarge},
|
|
8
|
-
history::v1::history_event::Attributes::
|
|
11
|
+
history::v1::history_event::Attributes::{
|
|
12
|
+
WorkflowExecutionTerminatedEventAttributes, WorkflowTaskFailedEventAttributes,
|
|
13
|
+
},
|
|
9
14
|
},
|
|
10
15
|
worker::WorkerTaskTypes,
|
|
11
16
|
};
|
|
12
|
-
use
|
|
17
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
18
|
+
use temporalio_sdk::{WorkflowContext, WorkflowResult};
|
|
13
19
|
|
|
14
20
|
pub(crate) mod priority;
|
|
15
21
|
|
|
22
|
+
#[workflow]
|
|
23
|
+
struct OversizeGrpcMessageWf {
|
|
24
|
+
run_flag: Arc<AtomicBool>,
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#[workflow_methods(factory_only)]
|
|
28
|
+
impl OversizeGrpcMessageWf {
|
|
29
|
+
#[run]
|
|
30
|
+
async fn run(ctx: &mut WorkflowContext<Self>) -> WorkflowResult<Vec<u8>> {
|
|
31
|
+
if ctx.state(|wf| wf.run_flag.load(Relaxed)) {
|
|
32
|
+
Ok(vec![])
|
|
33
|
+
} else {
|
|
34
|
+
ctx.state(|wf| wf.run_flag.store(true, Relaxed));
|
|
35
|
+
let result: Vec<u8> = vec![0; 5000000];
|
|
36
|
+
Ok(result)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
16
41
|
pub(crate) async fn grpc_message_too_large() {
|
|
42
|
+
let run_flag = Arc::new(AtomicBool::new(false));
|
|
43
|
+
let run_flag_clone = run_flag.clone();
|
|
44
|
+
|
|
17
45
|
let wf_name = "oversize_grpc_message";
|
|
18
46
|
let mut starter = CoreWfStarter::new_cloud_or_local(wf_name, "")
|
|
19
47
|
.await
|
|
20
48
|
.unwrap();
|
|
49
|
+
starter.sdk_config.task_types = WorkerTaskTypes::workflow_only();
|
|
21
50
|
starter
|
|
22
|
-
.
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
51
|
+
.sdk_config
|
|
52
|
+
.register_workflow_with_factory(move || OversizeGrpcMessageWf {
|
|
53
|
+
run_flag: run_flag_clone.clone(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
let mut sdk = starter.worker().await;
|
|
57
|
+
sdk.submit_workflow(
|
|
58
|
+
OversizeGrpcMessageWf::run,
|
|
59
|
+
(),
|
|
60
|
+
starter.workflow_options.clone(),
|
|
61
|
+
)
|
|
62
|
+
.await
|
|
63
|
+
.unwrap();
|
|
64
|
+
sdk.run_until_done().await.unwrap();
|
|
65
|
+
|
|
66
|
+
let events = starter.get_history().await.events;
|
|
67
|
+
// Depending on the version of server, it may terminate the workflow, or simply be a task
|
|
68
|
+
// failure
|
|
69
|
+
assert!(
|
|
70
|
+
events.iter().any(is_oversize_grpc_event),
|
|
71
|
+
"Expected workflow task failure or termination b/c grpc message too large: {events:?}",
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
pub(crate) fn is_oversize_grpc_event(
|
|
76
|
+
e: &temporalio_common::protos::temporal::api::history::v1::HistoryEvent,
|
|
77
|
+
) -> bool {
|
|
78
|
+
// Task failure
|
|
79
|
+
e.event_type == EventType::WorkflowTaskFailed as i32
|
|
80
|
+
&& if let WorkflowTaskFailedEventAttributes(attr) = e.attributes.as_ref().unwrap() {
|
|
81
|
+
attr.cause == GrpcMessageTooLarge as i32
|
|
82
|
+
&& attr.failure.as_ref().unwrap().message == "GRPC Message too large"
|
|
30
83
|
} else {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
84
|
+
false
|
|
85
|
+
}
|
|
86
|
+
// Workflow terminated
|
|
87
|
+
||
|
|
88
|
+
e.event_type == EventType::WorkflowExecutionTerminated as i32
|
|
89
|
+
&& if let WorkflowExecutionTerminatedEventAttributes(attr) = e.attributes.as_ref().unwrap() {
|
|
90
|
+
attr.reason == "GrpcMessageTooLarge"
|
|
91
|
+
} else {
|
|
92
|
+
false
|
|
34
93
|
}
|
|
35
|
-
});
|
|
36
|
-
starter.start_with_worker(wf_name, &mut core).await;
|
|
37
|
-
core.run_until_done().await.unwrap();
|
|
38
|
-
|
|
39
|
-
assert!(starter.get_history().await.events.iter().any(|e| {
|
|
40
|
-
e.event_type == EventType::WorkflowTaskFailed as i32
|
|
41
|
-
&& if let WorkflowTaskFailedEventAttributes(attr) = e.attributes.as_ref().unwrap() {
|
|
42
|
-
attr.cause == GrpcMessageTooLarge as i32
|
|
43
|
-
&& attr.failure.as_ref().unwrap().message == "GRPC Message too large"
|
|
44
|
-
} else {
|
|
45
|
-
false
|
|
46
|
-
}
|
|
47
|
-
}))
|
|
48
94
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
use crate::common::CoreWfStarter;
|
|
2
2
|
use std::time::Duration;
|
|
3
|
-
use temporalio_client::{
|
|
4
|
-
|
|
3
|
+
use temporalio_client::{Priority, UntypedWorkflow, WorkflowGetResultOptions};
|
|
4
|
+
use temporalio_common::protos::temporal::api::{common, history::v1::history_event::Attributes};
|
|
5
|
+
use temporalio_macros::{activities, workflow, workflow_methods};
|
|
6
|
+
use temporalio_sdk::{
|
|
7
|
+
ActivityOptions, ChildWorkflowOptions, WorkflowContext, WorkflowResult,
|
|
8
|
+
activities::{ActivityContext, ActivityError},
|
|
5
9
|
};
|
|
6
|
-
use temporalio_common::protos::{
|
|
7
|
-
coresdk::AsJsonPayloadExt,
|
|
8
|
-
temporal::api::{common, history::v1::history_event::Attributes},
|
|
9
|
-
};
|
|
10
|
-
use temporalio_sdk::{ActContext, ActivityOptions, ChildWorkflowOptions, WfContext};
|
|
11
10
|
|
|
12
11
|
pub(crate) async fn priority_values_sent_to_server() {
|
|
13
12
|
let mut starter = if let Some(wfs) =
|
|
@@ -17,95 +16,121 @@ pub(crate) async fn priority_values_sent_to_server() {
|
|
|
17
16
|
} else {
|
|
18
17
|
return;
|
|
19
18
|
};
|
|
20
|
-
starter.workflow_options.priority =
|
|
21
|
-
priority_key: 1,
|
|
22
|
-
fairness_key: "fair-wf".to_string(),
|
|
23
|
-
fairness_weight: 4.2,
|
|
24
|
-
}
|
|
19
|
+
starter.workflow_options.priority = Priority {
|
|
20
|
+
priority_key: Some(1),
|
|
21
|
+
fairness_key: Some("fair-wf".to_string()),
|
|
22
|
+
fairness_weight: Some(4.2),
|
|
23
|
+
};
|
|
25
24
|
let mut worker = starter.worker().await;
|
|
26
25
|
let child_type = "child-wf";
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
struct PriorityActivities;
|
|
28
|
+
#[activities]
|
|
29
|
+
impl PriorityActivities {
|
|
30
|
+
#[activity]
|
|
31
|
+
async fn echo(ctx: ActivityContext, echo_me: String) -> Result<String, ActivityError> {
|
|
32
|
+
assert_eq!(
|
|
33
|
+
ctx.info().priority,
|
|
34
|
+
Priority {
|
|
35
|
+
priority_key: Some(5),
|
|
36
|
+
fairness_key: Some("fair-act".to_string()),
|
|
37
|
+
fairness_weight: Some(1.1)
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
Ok(echo_me)
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[workflow]
|
|
45
|
+
#[derive(Default)]
|
|
46
|
+
struct ParentWf {
|
|
47
|
+
child_type: String,
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[workflow_methods]
|
|
51
|
+
impl ParentWf {
|
|
52
|
+
#[run]
|
|
53
|
+
async fn run(ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
54
|
+
let child = ctx.child_workflow(ChildWorkflowOptions {
|
|
55
|
+
workflow_id: format!("{}-child", ctx.task_queue()),
|
|
56
|
+
workflow_type: ctx.state(|wf| wf.child_type.clone()),
|
|
33
57
|
priority: Some(Priority {
|
|
34
|
-
priority_key: 4,
|
|
35
|
-
fairness_key: "fair-child".to_string(),
|
|
36
|
-
fairness_weight: 1.23,
|
|
58
|
+
priority_key: Some(4),
|
|
59
|
+
fairness_key: Some("fair-child".to_string()),
|
|
60
|
+
fairness_weight: Some(1.23),
|
|
37
61
|
}),
|
|
38
62
|
..Default::default()
|
|
39
|
-
}
|
|
40
|
-
..Default::default()
|
|
41
|
-
});
|
|
63
|
+
});
|
|
42
64
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
65
|
+
let started = child
|
|
66
|
+
.start()
|
|
67
|
+
.await
|
|
68
|
+
.into_started()
|
|
69
|
+
.expect("Child should start OK");
|
|
70
|
+
let activity = ctx.start_activity(
|
|
71
|
+
PriorityActivities::echo,
|
|
72
|
+
"hello".to_string(),
|
|
73
|
+
ActivityOptions {
|
|
74
|
+
start_to_close_timeout: Some(Duration::from_secs(5)),
|
|
75
|
+
priority: Some(Priority {
|
|
76
|
+
priority_key: Some(5),
|
|
77
|
+
fairness_key: Some("fair-act".to_string()),
|
|
78
|
+
fairness_weight: Some(1.1),
|
|
79
|
+
}),
|
|
80
|
+
do_not_eagerly_execute: true,
|
|
81
|
+
..Default::default()
|
|
82
|
+
},
|
|
83
|
+
);
|
|
84
|
+
started.result().await;
|
|
85
|
+
let _ = activity.await;
|
|
86
|
+
Ok(())
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
#[workflow]
|
|
91
|
+
#[derive(Default)]
|
|
92
|
+
struct ChildWf;
|
|
93
|
+
|
|
94
|
+
#[workflow_methods]
|
|
95
|
+
impl ChildWf {
|
|
96
|
+
#[run(name = "child-wf")]
|
|
97
|
+
async fn run(ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
98
|
+
assert_eq!(
|
|
99
|
+
ctx.workflow_initial_info().priority,
|
|
100
|
+
Some(common::v1::Priority {
|
|
101
|
+
priority_key: 4,
|
|
102
|
+
fairness_key: "fair-child".to_string(),
|
|
103
|
+
fairness_weight: 1.23
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
Ok(())
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
worker.register_activities(PriorityActivities);
|
|
111
|
+
worker.register_workflow_with_factory::<ParentWf, _>(move || ParentWf {
|
|
112
|
+
child_type: child_type.to_owned(),
|
|
86
113
|
});
|
|
114
|
+
worker.register_workflow::<ChildWf>();
|
|
87
115
|
|
|
88
|
-
|
|
89
|
-
.
|
|
90
|
-
.await
|
|
116
|
+
worker
|
|
117
|
+
.submit_workflow(ParentWf::run, (), starter.workflow_options.clone())
|
|
118
|
+
.await
|
|
119
|
+
.unwrap();
|
|
91
120
|
worker.run_until_done().await.unwrap();
|
|
92
121
|
|
|
93
122
|
let client = starter.get_client().await;
|
|
94
|
-
let handle = client.
|
|
95
|
-
|
|
96
|
-
.
|
|
123
|
+
let handle = client.get_workflow_handle::<UntypedWorkflow>(starter.get_task_queue());
|
|
124
|
+
handle
|
|
125
|
+
.get_result(WorkflowGetResultOptions::default())
|
|
97
126
|
.await
|
|
98
127
|
.unwrap();
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
let history = client
|
|
102
|
-
.get_workflow_execution_history(starter.get_task_queue().to_owned(), None, vec![])
|
|
128
|
+
let events = handle
|
|
129
|
+
.fetch_history(Default::default())
|
|
103
130
|
.await
|
|
104
131
|
.unwrap()
|
|
105
|
-
.
|
|
106
|
-
|
|
107
|
-
let workflow_init_event = history
|
|
108
|
-
.events
|
|
132
|
+
.into_events();
|
|
133
|
+
let workflow_init_event = events
|
|
109
134
|
.iter()
|
|
110
135
|
.find_map(|e| {
|
|
111
136
|
if let Attributes::WorkflowExecutionStartedEventAttributes(e) =
|
|
@@ -121,8 +146,7 @@ pub(crate) async fn priority_values_sent_to_server() {
|
|
|
121
146
|
workflow_init_event.priority.as_ref().unwrap().priority_key,
|
|
122
147
|
1
|
|
123
148
|
);
|
|
124
|
-
let child_init_event =
|
|
125
|
-
.events
|
|
149
|
+
let child_init_event = events
|
|
126
150
|
.iter()
|
|
127
151
|
.find_map(|e| {
|
|
128
152
|
if let Attributes::StartChildWorkflowExecutionInitiatedEventAttributes(e) =
|
|
@@ -135,8 +159,7 @@ pub(crate) async fn priority_values_sent_to_server() {
|
|
|
135
159
|
})
|
|
136
160
|
.unwrap();
|
|
137
161
|
assert_eq!(child_init_event.priority.as_ref().unwrap().priority_key, 4);
|
|
138
|
-
let activity_sched_event =
|
|
139
|
-
.events
|
|
162
|
+
let activity_sched_event = events
|
|
140
163
|
.iter()
|
|
141
164
|
.find_map(|e| {
|
|
142
165
|
if let Attributes::ActivityTaskScheduledEventAttributes(e) =
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
2
|
+
|
|
3
|
+
#[workflow]
|
|
4
|
+
pub struct BadWorkflow;
|
|
5
|
+
|
|
6
|
+
#[workflow_methods]
|
|
7
|
+
impl BadWorkflow {
|
|
8
|
+
#[run]
|
|
9
|
+
pub async fn run(_ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
10
|
+
Ok(())
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// This should fail - queries must not be async
|
|
14
|
+
#[query]
|
|
15
|
+
pub async fn get_value(&self, _ctx: &WorkflowContextView) -> u32 {
|
|
16
|
+
42
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl Default for BadWorkflow {
|
|
21
|
+
fn default() -> Self {
|
|
22
|
+
Self
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
fn main() {}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
2
|
+
use temporalio_sdk::{SyncWorkflowContext, WorkflowContext, WorkflowContextView, WorkflowResult};
|
|
3
|
+
|
|
4
|
+
#[workflow]
|
|
5
|
+
pub struct MyWorkflow {
|
|
6
|
+
counter: u32,
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
#[workflow_methods]
|
|
10
|
+
impl MyWorkflow {
|
|
11
|
+
#[init]
|
|
12
|
+
pub fn new(_ctx: &WorkflowContextView, _input: String) -> Self {
|
|
13
|
+
Self { counter: 0 }
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// Async run uses &self
|
|
17
|
+
#[run]
|
|
18
|
+
pub async fn run(_ctx: &mut WorkflowContext<Self>) -> WorkflowResult<String> {
|
|
19
|
+
Ok("hi".to_owned())
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Sync signal uses &mut self
|
|
23
|
+
#[signal(name = "increment")]
|
|
24
|
+
pub fn increment_counter(&mut self, _ctx: &mut SyncWorkflowContext<Self>, amount: u32) {
|
|
25
|
+
self.counter += amount;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#[signal]
|
|
29
|
+
pub async fn async_signal(_ctx: &mut WorkflowContext<Self>) {}
|
|
30
|
+
|
|
31
|
+
// Query uses &self with read-only context
|
|
32
|
+
#[query]
|
|
33
|
+
pub fn get_counter(&self, _ctx: &WorkflowContextView) -> u32 {
|
|
34
|
+
self.counter
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[update(name = "double")]
|
|
38
|
+
pub fn double_counter(&mut self, _ctx: &mut SyncWorkflowContext<Self>) -> u32 {
|
|
39
|
+
self.counter *= 2;
|
|
40
|
+
self.counter
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#[update]
|
|
44
|
+
pub async fn async_update(_ctx: &mut WorkflowContext<Self>, val: i32) -> i32 {
|
|
45
|
+
val * 2
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
fn main() {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
2
|
+
use temporalio_sdk::{WorkflowContext, WorkflowResult};
|
|
3
|
+
|
|
4
|
+
#[workflow]
|
|
5
|
+
pub struct MinimalWorkflow;
|
|
6
|
+
|
|
7
|
+
#[workflow_methods]
|
|
8
|
+
impl MinimalWorkflow {
|
|
9
|
+
#[run]
|
|
10
|
+
pub async fn run(_ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
11
|
+
Ok(())
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl Default for MinimalWorkflow {
|
|
16
|
+
fn default() -> Self {
|
|
17
|
+
Self
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fn main() {}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
2
|
+
|
|
3
|
+
#[workflow]
|
|
4
|
+
pub struct BadWorkflow;
|
|
5
|
+
|
|
6
|
+
#[workflow_methods]
|
|
7
|
+
impl BadWorkflow {
|
|
8
|
+
#[run]
|
|
9
|
+
pub async fn run(_ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
10
|
+
Ok(())
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// This should fail - queries must use &self, not &mut self
|
|
14
|
+
#[query]
|
|
15
|
+
pub fn get_value(&mut self, _ctx: &WorkflowContextView) -> u32 {
|
|
16
|
+
42
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
impl Default for BadWorkflow {
|
|
21
|
+
fn default() -> Self {
|
|
22
|
+
Self
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
fn main() {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
use temporalio_macros::{workflow, workflow_methods};
|
|
2
|
+
|
|
3
|
+
#[workflow]
|
|
4
|
+
pub struct BadWorkflow;
|
|
5
|
+
|
|
6
|
+
#[workflow_methods]
|
|
7
|
+
impl BadWorkflow {
|
|
8
|
+
// This should fail - run must be async
|
|
9
|
+
#[run]
|
|
10
|
+
pub fn run(&self, _ctx: &mut WorkflowContext<Self>) -> WorkflowResult<()> {
|
|
11
|
+
Ok(())
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
impl Default for BadWorkflow {
|
|
16
|
+
fn default() -> Self {
|
|
17
|
+
Self
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
fn main() {}
|
|
@@ -7,6 +7,9 @@ license-file = { workspace = true }
|
|
|
7
7
|
description = "C bridge for Temporal Core SDK"
|
|
8
8
|
homepage = "https://temporal.io/"
|
|
9
9
|
repository = "https://github.com/temporalio/sdk-core"
|
|
10
|
+
keywords = ["temporal", "workflow"]
|
|
11
|
+
categories = ["development-tools"]
|
|
12
|
+
publish = false
|
|
10
13
|
|
|
11
14
|
[lib]
|
|
12
15
|
name = "temporalio_sdk_core_c_bridge"
|
|
@@ -38,16 +41,20 @@ xz2 = { version = "0.1" }
|
|
|
38
41
|
|
|
39
42
|
[dependencies.temporalio-client]
|
|
40
43
|
path = "../client"
|
|
44
|
+
version = "0.1"
|
|
41
45
|
|
|
42
46
|
[dependencies.temporalio-sdk-core]
|
|
43
47
|
path = "../sdk-core"
|
|
48
|
+
version = "0.1"
|
|
44
49
|
features = ["ephemeral-server"]
|
|
45
50
|
|
|
46
51
|
[dependencies.temporalio-common]
|
|
47
52
|
path = "../common"
|
|
48
|
-
|
|
53
|
+
version = "0.1"
|
|
54
|
+
features = ["core-based-sdk"]
|
|
49
55
|
|
|
50
56
|
[dev-dependencies]
|
|
57
|
+
base64 = "0.21.0"
|
|
51
58
|
futures-util = "0.3"
|
|
52
59
|
thiserror = { workspace = true }
|
|
53
60
|
|