@temporalio/core-bridge 1.9.2 → 1.10.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 +754 -473
- package/Cargo.toml +3 -3
- package/lib/index.d.ts +33 -2
- package/lib/index.js.map +1 -1
- 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/scripts/build.js +4 -3
- package/sdk-core/.cargo/config.toml +2 -4
- package/sdk-core/.github/workflows/heavy.yml +1 -1
- package/sdk-core/.github/workflows/per-pr.yml +6 -4
- package/sdk-core/Cargo.toml +10 -3
- package/sdk-core/README.md +4 -6
- package/sdk-core/client/Cargo.toml +13 -5
- package/sdk-core/client/src/lib.rs +123 -34
- package/sdk-core/client/src/metrics.rs +70 -18
- package/sdk-core/client/src/proxy.rs +85 -0
- package/sdk-core/client/src/raw.rs +67 -5
- package/sdk-core/client/src/worker_registry/mod.rs +5 -3
- package/sdk-core/client/src/workflow_handle/mod.rs +3 -1
- package/sdk-core/core/Cargo.toml +31 -37
- package/sdk-core/core/src/abstractions/take_cell.rs +3 -3
- package/sdk-core/core/src/abstractions.rs +176 -108
- package/sdk-core/core/src/core_tests/activity_tasks.rs +4 -13
- package/sdk-core/core/src/core_tests/determinism.rs +2 -1
- package/sdk-core/core/src/core_tests/local_activities.rs +3 -3
- package/sdk-core/core/src/core_tests/mod.rs +3 -3
- package/sdk-core/core/src/core_tests/queries.rs +42 -5
- package/sdk-core/core/src/core_tests/workers.rs +2 -3
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +115 -15
- package/sdk-core/core/src/ephemeral_server/mod.rs +109 -136
- package/sdk-core/core/src/internal_flags.rs +8 -8
- package/sdk-core/core/src/lib.rs +16 -11
- package/sdk-core/core/src/pollers/mod.rs +11 -5
- package/sdk-core/core/src/pollers/poll_buffer.rs +48 -29
- package/sdk-core/core/src/protosext/mod.rs +32 -32
- package/sdk-core/core/src/protosext/protocol_messages.rs +14 -24
- package/sdk-core/core/src/retry_logic.rs +2 -2
- package/sdk-core/core/src/telemetry/log_export.rs +10 -9
- package/sdk-core/core/src/telemetry/metrics.rs +233 -330
- package/sdk-core/core/src/telemetry/mod.rs +11 -38
- package/sdk-core/core/src/telemetry/otel.rs +355 -0
- package/sdk-core/core/src/telemetry/prometheus_server.rs +36 -23
- package/sdk-core/core/src/test_help/mod.rs +80 -59
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +6 -6
- package/sdk-core/core/src/worker/activities/local_activities.rs +46 -43
- package/sdk-core/core/src/worker/activities.rs +45 -46
- package/sdk-core/core/src/worker/client/mocks.rs +8 -7
- package/sdk-core/core/src/worker/client.rs +40 -39
- package/sdk-core/core/src/worker/mod.rs +72 -42
- package/sdk-core/core/src/worker/slot_provider.rs +28 -28
- package/sdk-core/core/src/worker/slot_supplier.rs +1 -0
- package/sdk-core/core/src/worker/tuner/fixed_size.rs +52 -0
- package/sdk-core/core/src/worker/tuner/resource_based.rs +561 -0
- package/sdk-core/core/src/worker/tuner.rs +122 -0
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +6 -6
- package/sdk-core/core/src/worker/workflow/history_update.rs +27 -53
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +4 -17
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -10
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +4 -11
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +17 -35
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +0 -8
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +1 -5
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +0 -14
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +0 -5
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -10
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +3 -10
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +12 -8
- package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +0 -10
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +6 -13
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +27 -37
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +3 -14
- package/sdk-core/core/src/worker/workflow/managed_run.rs +84 -54
- package/sdk-core/core/src/worker/workflow/mod.rs +63 -160
- package/sdk-core/core/src/worker/workflow/run_cache.rs +22 -13
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +16 -3
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +15 -12
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +39 -78
- package/sdk-core/core-api/Cargo.toml +6 -5
- package/sdk-core/core-api/src/errors.rs +8 -0
- package/sdk-core/core-api/src/telemetry/metrics.rs +75 -4
- package/sdk-core/core-api/src/telemetry.rs +7 -1
- package/sdk-core/core-api/src/worker.rs +212 -56
- package/sdk-core/fsm/Cargo.toml +3 -0
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- package/sdk-core/sdk/Cargo.toml +5 -7
- package/sdk-core/sdk/src/app_data.rs +3 -3
- package/sdk-core/sdk/src/lib.rs +5 -3
- package/sdk-core/sdk/src/workflow_context/options.rs +1 -1
- package/sdk-core/sdk/src/workflow_context.rs +10 -9
- package/sdk-core/sdk/src/workflow_future.rs +1 -1
- package/sdk-core/sdk-core-protos/Cargo.toml +8 -6
- package/sdk-core/sdk-core-protos/build.rs +1 -10
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +3 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/ci.yml +26 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +42 -20
- package/sdk-core/sdk-core-protos/protos/api_upstream/README.md +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/api-linter.yaml +36 -26
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.lock +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/google/protobuf/struct.proto +95 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +9632 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +7337 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/payload_description.txt +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +45 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +22 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/command_type.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +44 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/event_type.proto +18 -3
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +30 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/update.proto +7 -8
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/workflow.proto +23 -5
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/errordetails/v1/message.proto +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +25 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +141 -15
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/namespace/v1/message.proto +12 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +193 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +73 -6
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +46 -4
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/schedule/v1/message.proto +4 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +116 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +134 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +274 -29
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +57 -1
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +10 -12
- package/sdk-core/sdk-core-protos/src/history_builder.rs +1 -1
- package/sdk-core/sdk-core-protos/src/lib.rs +54 -51
- package/sdk-core/sdk-core-protos/src/task_token.rs +11 -2
- package/sdk-core/test-utils/Cargo.toml +7 -4
- package/sdk-core/test-utils/src/histfetch.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +44 -62
- package/sdk-core/tests/fuzzy_workflow.rs +5 -2
- package/sdk-core/tests/heavy_tests.rs +114 -17
- package/sdk-core/tests/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/tests/integ_tests/client_tests.rs +2 -2
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +38 -26
- package/sdk-core/tests/integ_tests/metrics_tests.rs +126 -17
- package/sdk-core/tests/integ_tests/polling_tests.rs +118 -2
- package/sdk-core/tests/integ_tests/update_tests.rs +3 -5
- package/sdk-core/tests/integ_tests/visibility_tests.rs +3 -3
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +3 -3
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +5 -4
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -2
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +6 -10
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +9 -7
- package/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +14 -9
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +6 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +9 -6
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +5 -5
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests.rs +115 -11
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +57 -0
- package/src/lib.rs +1 -0
- package/src/runtime.rs +51 -35
- package/ts/index.ts +67 -3
- package/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +0 -117
- package/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +0 -24
- package/sdk-core/sdk/src/payload_converter.rs +0 -11
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/Dockerfile +0 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/docker-compose.yml +0 -15
- package/sdk-core/sdk-core-protos/protos/api_upstream/.buildkite/pipeline.yml +0 -10
- package/sdk-core/test-utils/src/wf_input_saver.rs +0 -50
- package/sdk-core/tests/wf_input_replay.rs +0 -32
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
use crate::{
|
|
2
|
-
telemetry::metrics::MetricsContext,
|
|
3
|
-
worker::{
|
|
4
|
-
client::mocks::DEFAULT_TEST_CAPABILITIES,
|
|
5
|
-
workflow::{
|
|
6
|
-
workflow_stream::{WFStream, WFStreamInput},
|
|
7
|
-
LAReqSink, LocalActivityRequestSink,
|
|
8
|
-
},
|
|
9
|
-
LocalActRequest, LocalActivityResolution,
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
use crossbeam_queue::SegQueue;
|
|
13
|
-
use futures::Stream;
|
|
14
|
-
use futures_util::StreamExt;
|
|
15
|
-
use serde::{Deserialize, Serialize};
|
|
16
|
-
use std::{future, sync::Arc};
|
|
17
|
-
use temporal_sdk_core_api::worker::WorkerConfig;
|
|
18
|
-
use tokio::sync::mpsc::UnboundedSender;
|
|
19
|
-
use tokio_util::sync::CancellationToken;
|
|
20
|
-
|
|
21
|
-
/// Replay everything that happened to internal workflow state. Useful for 100% deterministic
|
|
22
|
-
/// reproduction of bugs.
|
|
23
|
-
///
|
|
24
|
-
/// Use `CoreWfStarter::enable_wf_state_input_recording` from the integration test utilities to
|
|
25
|
-
/// activate saving the data to disk, and use the `wf_input_replay` example binary to replay.
|
|
26
|
-
pub async fn replay_wf_state_inputs(config: WorkerConfig, inputs: impl Stream<Item = Vec<u8>>) {
|
|
27
|
-
use crate::worker::build_wf_basics;
|
|
28
|
-
|
|
29
|
-
let la_resp_q = Arc::new(SegQueue::new());
|
|
30
|
-
let la_resp_q_clone = la_resp_q.clone();
|
|
31
|
-
let inputs = inputs
|
|
32
|
-
.map(|bytes| {
|
|
33
|
-
rmp_serde::from_slice::<StoredWFStateInputDeSer>(&bytes)
|
|
34
|
-
.expect("Can decode wf stream input")
|
|
35
|
-
})
|
|
36
|
-
.filter_map(|si| {
|
|
37
|
-
future::ready(match si {
|
|
38
|
-
StoredWFStateInputDeSer::Stream(wfsi) => Some(wfsi),
|
|
39
|
-
StoredWFStateInputDeSer::ImmediateLASinkResolutions(lares) => {
|
|
40
|
-
la_resp_q_clone.push(lares);
|
|
41
|
-
None
|
|
42
|
-
}
|
|
43
|
-
})
|
|
44
|
-
});
|
|
45
|
-
let basics = build_wf_basics(
|
|
46
|
-
config,
|
|
47
|
-
MetricsContext::no_op(),
|
|
48
|
-
CancellationToken::new(),
|
|
49
|
-
DEFAULT_TEST_CAPABILITIES.clone(),
|
|
50
|
-
);
|
|
51
|
-
let sink = ReadingFromFileLaReqSink {
|
|
52
|
-
resolutions: la_resp_q,
|
|
53
|
-
};
|
|
54
|
-
info!("Beginning workflow stream internal state replay");
|
|
55
|
-
let stream = WFStream::build_internal(inputs, basics, sink);
|
|
56
|
-
stream
|
|
57
|
-
.for_each(|o| async move { trace!("Stream output: {:?}", o) })
|
|
58
|
-
.await;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
impl WFStream {
|
|
62
|
-
pub(super) fn prep_input(&mut self, action: &WFStreamInput) -> Option<PreppedInputWrite> {
|
|
63
|
-
// Remove the channel, we'll put it back, avoiding a clone
|
|
64
|
-
self.wf_state_inputs.take().map(|chan| PreppedInputWrite {
|
|
65
|
-
data: rmp_serde::to_vec(&StoredWFStateInputSer::Stream(action))
|
|
66
|
-
.expect("WF Inputs are serializable"),
|
|
67
|
-
chan,
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
pub(super) fn flush_write(&mut self, w: PreppedInputWrite) {
|
|
71
|
-
let _ = w.chan.send(w.data);
|
|
72
|
-
self.wf_state_inputs = Some(w.chan);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
pub(super) struct PreppedInputWrite {
|
|
76
|
-
data: Vec<u8>,
|
|
77
|
-
chan: UnboundedSender<Vec<u8>>,
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
#[derive(Serialize)]
|
|
81
|
-
enum StoredWFStateInputSer<'a> {
|
|
82
|
-
Stream(&'a WFStreamInput),
|
|
83
|
-
ImmediateLASinkResolutions(&'a Vec<LocalActivityResolution>),
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
#[derive(Deserialize)]
|
|
87
|
-
enum StoredWFStateInputDeSer {
|
|
88
|
-
Stream(WFStreamInput),
|
|
89
|
-
ImmediateLASinkResolutions(Vec<LocalActivityResolution>),
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
struct ReadingFromFileLaReqSink {
|
|
93
|
-
resolutions: Arc<SegQueue<Vec<LocalActivityResolution>>>,
|
|
94
|
-
}
|
|
95
|
-
impl LocalActivityRequestSink for ReadingFromFileLaReqSink {
|
|
96
|
-
fn sink_reqs(&self, reqs: Vec<LocalActRequest>) -> Vec<LocalActivityResolution> {
|
|
97
|
-
if !reqs.is_empty() {
|
|
98
|
-
self.resolutions
|
|
99
|
-
.pop()
|
|
100
|
-
.expect("LA sink was called, but there's no stored immediate response")
|
|
101
|
-
} else {
|
|
102
|
-
vec![]
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
impl LAReqSink {
|
|
108
|
-
pub(crate) fn write_req(&self, res: &Vec<LocalActivityResolution>) {
|
|
109
|
-
if let Some(r) = self.recorder.as_ref() {
|
|
110
|
-
r.send(
|
|
111
|
-
rmp_serde::to_vec(&StoredWFStateInputSer::ImmediateLASinkResolutions(res))
|
|
112
|
-
.expect("LA immediate resolutions are serializable"),
|
|
113
|
-
)
|
|
114
|
-
.expect("WF input serialization channel is available for immediate LA result storage");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
use tonic::{Code, Status};
|
|
2
|
-
|
|
3
|
-
#[derive(serde::Serialize, serde::Deserialize)]
|
|
4
|
-
#[serde(remote = "Status")]
|
|
5
|
-
pub(super) struct SerdeStatus {
|
|
6
|
-
#[serde(getter = "get_code")]
|
|
7
|
-
code: i32,
|
|
8
|
-
#[serde(getter = "get_owned_msg")]
|
|
9
|
-
message: String,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
fn get_owned_msg(v: &Status) -> String {
|
|
13
|
-
v.message().to_string()
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
fn get_code(v: &Status) -> i32 {
|
|
17
|
-
v.code() as i32
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
impl From<SerdeStatus> for Status {
|
|
21
|
-
fn from(v: SerdeStatus) -> Self {
|
|
22
|
-
Status::new(Code::from(v.code), v.message)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//! Very much subject to change. Defines traits for converting inputs/outputs to/from payloads
|
|
2
|
-
|
|
3
|
-
use serde::{Deserialize, Serialize};
|
|
4
|
-
|
|
5
|
-
/// Something that can be deserialized from a payload. Currently just a pass-through to
|
|
6
|
-
/// [Deserialize] which may actually be the best long-run choice.
|
|
7
|
-
pub trait FromPayload<'de>: Deserialize<'de> {}
|
|
8
|
-
|
|
9
|
-
/// Something that can be serialized into a payload. Currently just a pass-through to
|
|
10
|
-
/// [Serialize] which may actually be the best long-run choice.
|
|
11
|
-
pub trait IntoPayload: Serialize {}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
version: "3.5"
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
build:
|
|
5
|
-
build:
|
|
6
|
-
context: ..
|
|
7
|
-
dockerfile: ./.buildkite/Dockerfile
|
|
8
|
-
environment:
|
|
9
|
-
- BUILDKITE_AGENT_ACCESS_TOKEN
|
|
10
|
-
- BUILDKITE_JOB_ID
|
|
11
|
-
- BUILDKITE_BUILD_ID
|
|
12
|
-
- BUILDKITE_BUILD_NUMBER
|
|
13
|
-
volumes:
|
|
14
|
-
- ../:/temporal
|
|
15
|
-
- /usr/bin/buildkite-agent:/usr/bin/buildkite-agent
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
use anyhow::anyhow;
|
|
2
|
-
use bytes::BytesMut;
|
|
3
|
-
use futures::{stream::BoxStream, SinkExt, StreamExt};
|
|
4
|
-
use prost::bytes::Bytes;
|
|
5
|
-
use std::path::Path;
|
|
6
|
-
use temporal_sdk_core_api::worker::WorkerConfig;
|
|
7
|
-
use tokio::{fs::File, sync::mpsc::UnboundedReceiver};
|
|
8
|
-
use tokio_util::codec::{FramedRead, FramedWrite, LengthDelimitedCodec};
|
|
9
|
-
|
|
10
|
-
pub struct WFStateReplayData {
|
|
11
|
-
pub config: WorkerConfig,
|
|
12
|
-
pub inputs: BoxStream<'static, Result<BytesMut, std::io::Error>>,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
pub async fn stream_to_file(
|
|
16
|
-
config: &WorkerConfig,
|
|
17
|
-
mut rcv: UnboundedReceiver<Vec<u8>>,
|
|
18
|
-
) -> Result<(), anyhow::Error> {
|
|
19
|
-
let file = File::create("wf_inputs").await?;
|
|
20
|
-
let mut transport = FramedWrite::new(file, ldc());
|
|
21
|
-
// First write the worker config, since things like cache size affect how many evictions there
|
|
22
|
-
// will be, etc.
|
|
23
|
-
transport.send(rmp_serde::to_vec(config)?.into()).await?;
|
|
24
|
-
while let Some(v) = rcv.recv().await {
|
|
25
|
-
transport.send(Bytes::from(v)).await?;
|
|
26
|
-
}
|
|
27
|
-
Ok(())
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
pub async fn read_from_file(path: impl AsRef<Path>) -> Result<WFStateReplayData, anyhow::Error> {
|
|
31
|
-
let file = File::open(path).await?;
|
|
32
|
-
let mut framed_read = FramedRead::new(file, ldc());
|
|
33
|
-
// Deserialize the worker config first
|
|
34
|
-
let config = framed_read
|
|
35
|
-
.next()
|
|
36
|
-
.await
|
|
37
|
-
.ok_or_else(|| anyhow!("Replay data file is empty"))??;
|
|
38
|
-
let config = rmp_serde::from_slice(config.as_ref())?;
|
|
39
|
-
|
|
40
|
-
Ok(WFStateReplayData {
|
|
41
|
-
config,
|
|
42
|
-
inputs: framed_read.boxed(),
|
|
43
|
-
})
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
fn ldc() -> LengthDelimitedCodec {
|
|
47
|
-
LengthDelimitedCodec::builder()
|
|
48
|
-
.length_field_type::<u16>()
|
|
49
|
-
.new_codec()
|
|
50
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
use anyhow::Context;
|
|
2
|
-
use clap::Parser;
|
|
3
|
-
use futures_util::StreamExt;
|
|
4
|
-
use std::path::PathBuf;
|
|
5
|
-
use temporal_sdk_core::replay_wf_state_inputs;
|
|
6
|
-
use temporal_sdk_core_test_utils::{init_integ_telem, wf_input_saver::read_from_file};
|
|
7
|
-
|
|
8
|
-
#[derive(clap::Parser)]
|
|
9
|
-
#[command(author, version, about, long_about = None)]
|
|
10
|
-
struct Cli {
|
|
11
|
-
/// Path to file containing the saved wf input data
|
|
12
|
-
replay_data: PathBuf,
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
#[tokio::main]
|
|
16
|
-
async fn main() -> Result<(), anyhow::Error> {
|
|
17
|
-
init_integ_telem();
|
|
18
|
-
let Cli { replay_data } = Cli::parse();
|
|
19
|
-
let replay_dat = read_from_file(replay_data)
|
|
20
|
-
.await
|
|
21
|
-
.context("while reading replay data file")?;
|
|
22
|
-
|
|
23
|
-
replay_wf_state_inputs(
|
|
24
|
-
replay_dat.config,
|
|
25
|
-
replay_dat
|
|
26
|
-
.inputs
|
|
27
|
-
.map(|r| r.expect("Reading bytes from file works").to_vec()),
|
|
28
|
-
)
|
|
29
|
-
.await;
|
|
30
|
-
|
|
31
|
-
Ok(())
|
|
32
|
-
}
|