temporalio 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +175 -4
- data/bridge/Cargo.lock +44 -21
- data/bridge/Cargo.toml +1 -0
- data/bridge/sdk-core/Cargo.toml +1 -1
- data/bridge/sdk-core/README.md +1 -4
- data/bridge/sdk-core/client/Cargo.toml +1 -1
- data/bridge/sdk-core/client/src/lib.rs +12 -20
- data/bridge/sdk-core/client/src/raw.rs +9 -8
- data/bridge/sdk-core/client/src/retry.rs +100 -23
- data/bridge/sdk-core/core/Cargo.toml +7 -7
- data/bridge/sdk-core/core/benches/workflow_replay.rs +13 -10
- data/bridge/sdk-core/core/src/abstractions.rs +22 -22
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +146 -43
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +419 -9
- data/bridge/sdk-core/core/src/core_tests/queries.rs +247 -89
- data/bridge/sdk-core/core/src/core_tests/workers.rs +2 -2
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +47 -27
- data/bridge/sdk-core/core/src/lib.rs +139 -32
- data/bridge/sdk-core/core/src/protosext/mod.rs +1 -1
- data/bridge/sdk-core/core/src/replay/mod.rs +185 -41
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +190 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +184 -139
- data/bridge/sdk-core/core/src/telemetry/mod.rs +310 -315
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +4 -3
- data/bridge/sdk-core/core/src/test_help/mod.rs +23 -9
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +12 -6
- data/bridge/sdk-core/core/src/worker/activities.rs +40 -23
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +1 -1
- data/bridge/sdk-core/core/src/worker/client.rs +30 -4
- data/bridge/sdk-core/core/src/worker/mod.rs +23 -19
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +10 -19
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +99 -25
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +3 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +2 -6
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +24 -22
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +12 -38
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +178 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +8 -2
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +1 -5
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +233 -217
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +1 -6
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +4 -4
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +13 -5
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +86 -29
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +2 -2
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +56 -11
- data/bridge/sdk-core/core-api/Cargo.toml +4 -3
- data/bridge/sdk-core/core-api/src/lib.rs +1 -43
- data/bridge/sdk-core/core-api/src/telemetry.rs +147 -0
- data/bridge/sdk-core/core-api/src/worker.rs +13 -0
- data/bridge/sdk-core/etc/deps.svg +115 -140
- data/bridge/sdk-core/etc/regen-depgraph.sh +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -3
- data/bridge/sdk-core/protos/api_upstream/build/go.mod +7 -0
- data/bridge/sdk-core/protos/api_upstream/build/go.sum +5 -0
- data/bridge/sdk-core/protos/api_upstream/{temporal/api/update/v1/message.proto → build/tools.go} +6 -23
- data/bridge/sdk-core/protos/api_upstream/go.mod +6 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +20 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +5 -3
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +23 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/{cluster.proto → interaction_type.proto} +10 -11
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +2 -13
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +26 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/interaction/v1/message.proto +87 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +21 -61
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -21
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +110 -31
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +60 -16
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +17 -3
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +2 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +8 -1
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- data/bridge/sdk-core/sdk/Cargo.toml +2 -2
- data/bridge/sdk-core/sdk/src/interceptors.rs +36 -3
- data/bridge/sdk-core/sdk/src/lib.rs +7 -5
- data/bridge/sdk-core/sdk/src/workflow_context.rs +13 -2
- data/bridge/sdk-core/sdk/src/workflow_future.rs +3 -7
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +1 -1
- data/bridge/sdk-core/sdk-core-protos/build.rs +0 -1
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +65 -18
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +22 -22
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +104 -44
- data/bridge/sdk-core/test-utils/Cargo.toml +2 -1
- data/bridge/sdk-core/test-utils/src/lib.rs +81 -29
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +5 -2
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +37 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +0 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +167 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +53 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +106 -20
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +18 -8
- data/bridge/sdk-core/tests/main.rs +6 -4
- data/bridge/src/connection.rs +81 -62
- data/bridge/src/lib.rs +92 -33
- data/bridge/src/runtime.rs +9 -2
- data/bridge/src/worker.rs +53 -2
- data/lib/bridge.so +0 -0
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +8 -6
- data/lib/gen/temporal/api/command/v1/message_pb.rb +17 -9
- data/lib/gen/temporal/api/common/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +3 -1
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +3 -2
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +7 -1
- data/lib/gen/temporal/api/enums/v1/interaction_type_pb.rb +25 -0
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +1 -6
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +1 -1
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/history/v1/message_pb.rb +19 -18
- data/lib/gen/temporal/api/interaction/v1/message_pb.rb +49 -0
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +11 -51
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/api/query/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +22 -1
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +2 -2
- data/lib/gen/temporal/api/version/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +27 -10
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +1 -0
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +5 -1
- data/lib/temporalio/activity/context.rb +97 -0
- data/lib/temporalio/activity/info.rb +67 -0
- data/lib/temporalio/activity.rb +85 -0
- data/lib/temporalio/bridge/error.rb +8 -0
- data/lib/temporalio/bridge.rb +14 -0
- data/lib/{temporal → temporalio}/client/implementation.rb +49 -48
- data/lib/{temporal → temporalio}/client/workflow_handle.rb +35 -35
- data/lib/{temporal → temporalio}/client.rb +19 -32
- data/lib/{temporal → temporalio}/connection.rb +238 -223
- data/lib/{temporal → temporalio}/data_converter.rb +76 -35
- data/lib/{temporal → temporalio}/error/failure.rb +6 -6
- data/lib/{temporal → temporalio}/error/workflow_failure.rb +4 -2
- data/lib/{temporal → temporalio}/errors.rb +19 -1
- data/lib/{temporal → temporalio}/failure_converter/base.rb +5 -5
- data/lib/{temporal → temporalio}/failure_converter/basic.rb +58 -52
- data/lib/temporalio/failure_converter.rb +7 -0
- data/lib/{temporal → temporalio}/interceptor/chain.rb +2 -1
- data/lib/{temporal → temporalio}/interceptor/client.rb +22 -1
- data/lib/{temporal → temporalio}/payload_codec/base.rb +5 -5
- data/lib/{temporal → temporalio}/payload_converter/base.rb +3 -3
- data/lib/{temporal → temporalio}/payload_converter/bytes.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/composite.rb +7 -5
- data/lib/{temporal → temporalio}/payload_converter/encoding_base.rb +4 -4
- data/lib/{temporal → temporalio}/payload_converter/json.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/nil.rb +4 -3
- data/lib/temporalio/payload_converter.rb +14 -0
- data/lib/{temporal → temporalio}/retry_policy.rb +4 -4
- data/lib/{temporal → temporalio}/retry_state.rb +1 -1
- data/lib/temporalio/runtime.rb +25 -0
- data/lib/{temporal → temporalio}/timeout_type.rb +2 -2
- data/lib/temporalio/version.rb +3 -0
- data/lib/temporalio/worker/activity_runner.rb +92 -0
- data/lib/temporalio/worker/activity_worker.rb +138 -0
- data/lib/temporalio/worker/reactor.rb +46 -0
- data/lib/temporalio/worker/runner.rb +63 -0
- data/lib/temporalio/worker/sync_worker.rb +88 -0
- data/lib/temporalio/worker/thread_pool_executor.rb +51 -0
- data/lib/temporalio/worker.rb +198 -0
- data/lib/{temporal → temporalio}/workflow/execution_info.rb +4 -4
- data/lib/{temporal → temporalio}/workflow/execution_status.rb +1 -1
- data/lib/{temporal → temporalio}/workflow/id_reuse_policy.rb +6 -6
- data/lib/{temporal → temporalio}/workflow/query_reject_condition.rb +5 -5
- data/lib/temporalio.rb +12 -3
- data/temporalio.gemspec +7 -3
- metadata +79 -56
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +0 -24
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- data/bridge/sdk-core/bridge-ffi/build.rs +0 -25
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -249
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +0 -825
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +0 -211
- data/bridge/sdk-core/core/src/log_export.rs +0 -62
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- data/bridge/sdk-core/sdk/src/conversions.rs +0 -8
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +0 -67
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +0 -26
- data/lib/gen/temporal/api/update/v1/message_pb.rb +0 -26
- data/lib/temporal/bridge.rb +0 -14
- data/lib/temporal/failure_converter.rb +0 -8
- data/lib/temporal/payload_converter.rb +0 -14
- data/lib/temporal/runtime.rb +0 -22
- data/lib/temporal/version.rb +0 -3
- data/lib/temporal.rb +0 -8
|
@@ -66,7 +66,7 @@ pub mod coresdk {
|
|
|
66
66
|
"ActivityTaskCompletion(token: {}",
|
|
67
67
|
fmt_tt(&self.task_token),
|
|
68
68
|
)?;
|
|
69
|
-
if let Some(r) = self.result.as_ref() {
|
|
69
|
+
if let Some(r) = self.result.as_ref().and_then(|r| r.status.as_ref()) {
|
|
70
70
|
write!(f, ", {}", r)?;
|
|
71
71
|
} else {
|
|
72
72
|
write!(f, ", missing result")?;
|
|
@@ -120,21 +120,20 @@ pub mod coresdk {
|
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
impl Display for
|
|
123
|
+
impl Display for aer::Status {
|
|
124
124
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
125
125
|
write!(f, "ActivityExecutionResult(")?;
|
|
126
|
-
match self
|
|
127
|
-
|
|
128
|
-
Some(aer::Status::Completed(v)) => {
|
|
126
|
+
match self {
|
|
127
|
+
aer::Status::Completed(v) => {
|
|
129
128
|
write!(f, "{})", v)
|
|
130
129
|
}
|
|
131
|
-
|
|
130
|
+
aer::Status::Failed(v) => {
|
|
132
131
|
write!(f, "{})", v)
|
|
133
132
|
}
|
|
134
|
-
|
|
133
|
+
aer::Status::Cancelled(v) => {
|
|
135
134
|
write!(f, "{})", v)
|
|
136
135
|
}
|
|
137
|
-
|
|
136
|
+
aer::Status::WillCompleteAsync(_) => {
|
|
138
137
|
write!(f, "Will complete async)")
|
|
139
138
|
}
|
|
140
139
|
}
|
|
@@ -198,11 +197,15 @@ pub mod coresdk {
|
|
|
198
197
|
matches!(self.status, Some(activity_resolution::Status::Failed(_)))
|
|
199
198
|
}
|
|
200
199
|
|
|
201
|
-
pub fn timed_out(&self) ->
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
200
|
+
pub fn timed_out(&self) -> Option<crate::temporal::api::enums::v1::TimeoutType> {
|
|
201
|
+
match self.status {
|
|
202
|
+
Some(activity_resolution::Status::Failed(Failure {
|
|
203
|
+
failure: Some(ref f),
|
|
204
|
+
})) => f
|
|
205
|
+
.is_timeout()
|
|
206
|
+
.or_else(|| f.cause.as_ref().and_then(|c| c.is_timeout())),
|
|
207
|
+
_ => None,
|
|
208
|
+
}
|
|
206
209
|
}
|
|
207
210
|
|
|
208
211
|
pub fn cancelled(&self) -> bool {
|
|
@@ -244,10 +247,6 @@ pub mod coresdk {
|
|
|
244
247
|
}
|
|
245
248
|
}
|
|
246
249
|
|
|
247
|
-
pub mod bridge {
|
|
248
|
-
tonic::include_proto!("coresdk.bridge");
|
|
249
|
-
}
|
|
250
|
-
|
|
251
250
|
pub mod common {
|
|
252
251
|
tonic::include_proto!("coresdk.common");
|
|
253
252
|
use super::external_data::LocalActivityMarkerData;
|
|
@@ -405,6 +404,7 @@ pub mod coresdk {
|
|
|
405
404
|
query::v1::WorkflowQuery,
|
|
406
405
|
},
|
|
407
406
|
};
|
|
407
|
+
use prost_types::Timestamp;
|
|
408
408
|
use std::{
|
|
409
409
|
collections::HashMap,
|
|
410
410
|
fmt::{Display, Formatter},
|
|
@@ -600,6 +600,7 @@ pub mod coresdk {
|
|
|
600
600
|
attrs: WorkflowExecutionStartedEventAttributes,
|
|
601
601
|
workflow_id: String,
|
|
602
602
|
randomness_seed: u64,
|
|
603
|
+
start_time: Timestamp,
|
|
603
604
|
) -> StartWorkflow {
|
|
604
605
|
StartWorkflow {
|
|
605
606
|
workflow_type: attrs.workflow_type.map(|wt| wt.name).unwrap_or_default(),
|
|
@@ -633,6 +634,7 @@ pub mod coresdk {
|
|
|
633
634
|
cron_schedule_to_schedule_interval: attrs.first_workflow_task_backoff,
|
|
634
635
|
memo: attrs.memo,
|
|
635
636
|
search_attributes: attrs.search_attributes,
|
|
637
|
+
start_time: Some(start_time),
|
|
636
638
|
}
|
|
637
639
|
}
|
|
638
640
|
}
|
|
@@ -800,6 +802,16 @@ pub mod coresdk {
|
|
|
800
802
|
}
|
|
801
803
|
}
|
|
802
804
|
|
|
805
|
+
impl Display for ModifyWorkflowProperties {
|
|
806
|
+
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
807
|
+
write!(
|
|
808
|
+
f,
|
|
809
|
+
"ModifyWorkflowProperties(upserted memo keys: {:?})",
|
|
810
|
+
self.upserted_memo.as_ref().map(|m| m.fields.keys())
|
|
811
|
+
)
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
803
815
|
impl QueryResult {
|
|
804
816
|
/// Helper to construct the Temporal API query result types.
|
|
805
817
|
pub fn into_components(self) -> (String, QueryResultType, Option<Payloads>, String) {
|
|
@@ -1095,8 +1107,11 @@ pub mod coresdk {
|
|
|
1095
1107
|
}
|
|
1096
1108
|
|
|
1097
1109
|
impl Failure {
|
|
1098
|
-
pub fn is_timeout(&self) ->
|
|
1099
|
-
|
|
1110
|
+
pub fn is_timeout(&self) -> Option<crate::temporal::api::enums::v1::TimeoutType> {
|
|
1111
|
+
match &self.failure_info {
|
|
1112
|
+
Some(FailureInfo::TimeoutFailureInfo(ti)) => Some(ti.timeout_type()),
|
|
1113
|
+
_ => None,
|
|
1114
|
+
}
|
|
1100
1115
|
}
|
|
1101
1116
|
|
|
1102
1117
|
pub fn application_failure(message: String, non_retryable: bool) -> Self {
|
|
@@ -1182,7 +1197,22 @@ pub mod coresdk {
|
|
|
1182
1197
|
|
|
1183
1198
|
impl From<anyhow::Error> for Failure {
|
|
1184
1199
|
fn from(ae: anyhow::Error) -> Self {
|
|
1185
|
-
|
|
1200
|
+
Self {
|
|
1201
|
+
failure_info: Some(FailureInfo::ApplicationFailureInfo(
|
|
1202
|
+
ApplicationFailureInfo {
|
|
1203
|
+
..Default::default()
|
|
1204
|
+
},
|
|
1205
|
+
)),
|
|
1206
|
+
..ae.chain()
|
|
1207
|
+
.rfold(None, |cause, e| {
|
|
1208
|
+
Some(Self {
|
|
1209
|
+
message: e.to_string(),
|
|
1210
|
+
cause: cause.map(Box::new),
|
|
1211
|
+
..Default::default()
|
|
1212
|
+
})
|
|
1213
|
+
})
|
|
1214
|
+
.unwrap_or_default()
|
|
1215
|
+
}
|
|
1186
1216
|
}
|
|
1187
1217
|
}
|
|
1188
1218
|
|
|
@@ -1320,11 +1350,6 @@ pub mod coresdk {
|
|
|
1320
1350
|
// This is disgusting, but unclear to me how to avoid it. TODO: Discuss w/ prost maintainer
|
|
1321
1351
|
pub mod temporal {
|
|
1322
1352
|
pub mod api {
|
|
1323
|
-
pub mod cluster {
|
|
1324
|
-
pub mod v1 {
|
|
1325
|
-
tonic::include_proto!("temporal.api.cluster.v1");
|
|
1326
|
-
}
|
|
1327
|
-
}
|
|
1328
1353
|
pub mod batch {
|
|
1329
1354
|
pub mod v1 {
|
|
1330
1355
|
tonic::include_proto!("temporal.api.batch.v1");
|
|
@@ -1414,6 +1439,16 @@ pub mod temporal {
|
|
|
1414
1439
|
}
|
|
1415
1440
|
}
|
|
1416
1441
|
|
|
1442
|
+
impl From<workflow_commands::ModifyWorkflowProperties> for command::Attributes {
|
|
1443
|
+
fn from(s: workflow_commands::ModifyWorkflowProperties) -> Self {
|
|
1444
|
+
Self::ModifyWorkflowPropertiesCommandAttributes(
|
|
1445
|
+
ModifyWorkflowPropertiesCommandAttributes {
|
|
1446
|
+
upserted_memo: s.upserted_memo.map(Into::into),
|
|
1447
|
+
},
|
|
1448
|
+
)
|
|
1449
|
+
}
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1417
1452
|
impl From<workflow_commands::CancelTimer> for command::Attributes {
|
|
1418
1453
|
fn from(s: workflow_commands::CancelTimer) -> Self {
|
|
1419
1454
|
Self::CancelTimerCommandAttributes(CancelTimerCommandAttributes {
|
|
@@ -1647,14 +1682,7 @@ pub mod temporal {
|
|
|
1647
1682
|
|
|
1648
1683
|
impl History {
|
|
1649
1684
|
pub fn extract_run_id_from_start(&self) -> Result<&str, anyhow::Error> {
|
|
1650
|
-
|
|
1651
|
-
history_event::Attributes::WorkflowExecutionStartedEventAttributes(wes),
|
|
1652
|
-
) = self.events.get(0).and_then(|x| x.attributes.as_ref())
|
|
1653
|
-
{
|
|
1654
|
-
Ok(&wes.original_execution_run_id)
|
|
1655
|
-
} else {
|
|
1656
|
-
bail!("First event is not WorkflowExecutionStarted?!?")
|
|
1657
|
-
}
|
|
1685
|
+
extract_original_run_id_from_events(&self.events)
|
|
1658
1686
|
}
|
|
1659
1687
|
|
|
1660
1688
|
/// Returns the event id of the final event in the history. Will return 0 if
|
|
@@ -1664,6 +1692,18 @@ pub mod temporal {
|
|
|
1664
1692
|
}
|
|
1665
1693
|
}
|
|
1666
1694
|
|
|
1695
|
+
pub fn extract_original_run_id_from_events(
|
|
1696
|
+
events: &[HistoryEvent],
|
|
1697
|
+
) -> Result<&str, anyhow::Error> {
|
|
1698
|
+
if let Some(Attributes::WorkflowExecutionStartedEventAttributes(wes)) =
|
|
1699
|
+
events.get(0).and_then(|x| x.attributes.as_ref())
|
|
1700
|
+
{
|
|
1701
|
+
Ok(&wes.original_execution_run_id)
|
|
1702
|
+
} else {
|
|
1703
|
+
bail!("First event is not WorkflowExecutionStarted?!?")
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1667
1707
|
impl HistoryEvent {
|
|
1668
1708
|
/// Returns true if this is an event created to mirror a command
|
|
1669
1709
|
pub fn is_command_event(&self) -> bool {
|
|
@@ -1749,6 +1789,11 @@ pub mod temporal {
|
|
|
1749
1789
|
}
|
|
1750
1790
|
}
|
|
1751
1791
|
}
|
|
1792
|
+
pub mod interaction {
|
|
1793
|
+
pub mod v1 {
|
|
1794
|
+
tonic::include_proto!("temporal.api.interaction.v1");
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1752
1797
|
pub mod namespace {
|
|
1753
1798
|
pub mod v1 {
|
|
1754
1799
|
tonic::include_proto!("temporal.api.namespace.v1");
|
|
@@ -1794,11 +1839,6 @@ pub mod temporal {
|
|
|
1794
1839
|
tonic::include_proto!("temporal.api.testservice.v1");
|
|
1795
1840
|
}
|
|
1796
1841
|
}
|
|
1797
|
-
pub mod update {
|
|
1798
|
-
pub mod v1 {
|
|
1799
|
-
tonic::include_proto!("temporal.api.update.v1");
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
1842
|
pub mod version {
|
|
1803
1843
|
pub mod v1 {
|
|
1804
1844
|
tonic::include_proto!("temporal.api.version.v1");
|
|
@@ -1820,12 +1860,12 @@ pub mod temporal {
|
|
|
1820
1860
|
tonic::include_proto!("temporal.api.workflowservice.v1");
|
|
1821
1861
|
|
|
1822
1862
|
macro_rules! sched_to_start_impl {
|
|
1823
|
-
() => {
|
|
1824
|
-
/// Return the duration of the task schedule time to its
|
|
1825
|
-
/// are set and time went forward.
|
|
1863
|
+
($sched_field:ident) => {
|
|
1864
|
+
/// Return the duration of the task schedule time (current attempt) to its
|
|
1865
|
+
/// start time if both are set and time went forward.
|
|
1826
1866
|
pub fn sched_to_start(&self) -> Option<Duration> {
|
|
1827
1867
|
if let Some((sch, st)) =
|
|
1828
|
-
self.
|
|
1868
|
+
self.$sched_field.clone().zip(self.started_time.clone())
|
|
1829
1869
|
{
|
|
1830
1870
|
let sch: Result<SystemTime, _> = sch.try_into();
|
|
1831
1871
|
let st: Result<SystemTime, _> = st.try_into();
|
|
@@ -1839,7 +1879,7 @@ pub mod temporal {
|
|
|
1839
1879
|
}
|
|
1840
1880
|
|
|
1841
1881
|
impl PollWorkflowTaskQueueResponse {
|
|
1842
|
-
sched_to_start_impl!();
|
|
1882
|
+
sched_to_start_impl!(scheduled_time);
|
|
1843
1883
|
}
|
|
1844
1884
|
|
|
1845
1885
|
impl Display for PollWorkflowTaskQueueResponse {
|
|
@@ -1881,7 +1921,7 @@ pub mod temporal {
|
|
|
1881
1921
|
}
|
|
1882
1922
|
|
|
1883
1923
|
impl PollActivityTaskQueueResponse {
|
|
1884
|
-
sched_to_start_impl!();
|
|
1924
|
+
sched_to_start_impl!(current_attempt_scheduled_time);
|
|
1885
1925
|
}
|
|
1886
1926
|
|
|
1887
1927
|
impl QueryWorkflowResponse {
|
|
@@ -1908,3 +1948,23 @@ pub mod grpc {
|
|
|
1908
1948
|
}
|
|
1909
1949
|
}
|
|
1910
1950
|
}
|
|
1951
|
+
|
|
1952
|
+
#[cfg(test)]
|
|
1953
|
+
mod tests {
|
|
1954
|
+
use crate::temporal::api::failure::v1::Failure;
|
|
1955
|
+
use anyhow::anyhow;
|
|
1956
|
+
|
|
1957
|
+
#[test]
|
|
1958
|
+
fn anyhow_to_failure_conversion() {
|
|
1959
|
+
let no_causes: Failure = anyhow!("no causes").into();
|
|
1960
|
+
assert_eq!(no_causes.cause, None);
|
|
1961
|
+
assert_eq!(no_causes.message, "no causes");
|
|
1962
|
+
let orig = anyhow!("fail 1");
|
|
1963
|
+
let mid = orig.context("fail 2");
|
|
1964
|
+
let top = mid.context("fail 3");
|
|
1965
|
+
let as_fail: Failure = top.into();
|
|
1966
|
+
assert_eq!(as_fail.message, "fail 3");
|
|
1967
|
+
assert_eq!(as_fail.cause.as_ref().unwrap().message, "fail 2");
|
|
1968
|
+
assert_eq!(as_fail.cause.unwrap().cause.unwrap().message, "fail 1");
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
@@ -6,7 +6,7 @@ extern crate tracing;
|
|
|
6
6
|
|
|
7
7
|
pub mod canned_histories;
|
|
8
8
|
|
|
9
|
-
use crate::stream::TryStreamExt;
|
|
9
|
+
use crate::stream::{Stream, TryStreamExt};
|
|
10
10
|
use futures::{future, stream, stream::FuturesUnordered, StreamExt};
|
|
11
11
|
use parking_lot::Mutex;
|
|
12
12
|
use prost::Message;
|
|
@@ -18,14 +18,23 @@ use std::{
|
|
|
18
18
|
use temporal_client::{
|
|
19
19
|
Client, RetryClient, WorkflowClientTrait, WorkflowExecutionInfo, WorkflowOptions,
|
|
20
20
|
};
|
|
21
|
-
use temporal_sdk::{
|
|
21
|
+
use temporal_sdk::{
|
|
22
|
+
interceptors::{FailOnNondeterminismInterceptor, WorkerInterceptor},
|
|
23
|
+
IntoActivityFunc, Worker, WorkflowFunction,
|
|
24
|
+
};
|
|
22
25
|
use temporal_sdk_core::{
|
|
23
26
|
ephemeral_server::{EphemeralExe, EphemeralExeVersion},
|
|
24
|
-
init_replay_worker, init_worker,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
init_replay_worker, init_worker,
|
|
28
|
+
replay::HistoryForReplay,
|
|
29
|
+
ClientOptions, ClientOptionsBuilder, CoreRuntime, WorkerConfig, WorkerConfigBuilder,
|
|
30
|
+
};
|
|
31
|
+
use temporal_sdk_core_api::{
|
|
32
|
+
telemetry::{
|
|
33
|
+
Logger, MetricsExporter, OtelCollectorOptions, TelemetryOptions, TelemetryOptionsBuilder,
|
|
34
|
+
TraceExportConfig, TraceExporter,
|
|
35
|
+
},
|
|
36
|
+
Worker as CoreWorker,
|
|
27
37
|
};
|
|
28
|
-
use temporal_sdk_core_api::Worker as CoreWorker;
|
|
29
38
|
use temporal_sdk_core_protos::{
|
|
30
39
|
coresdk::{
|
|
31
40
|
workflow_commands::{
|
|
@@ -61,21 +70,43 @@ pub async fn init_core_and_create_wf(test_name: &str) -> CoreWfStarter {
|
|
|
61
70
|
starter
|
|
62
71
|
}
|
|
63
72
|
|
|
64
|
-
/// Create a worker replay instance preloaded with
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
73
|
+
/// Create a worker replay instance preloaded with provided histories. Returns the worker impl.
|
|
74
|
+
pub fn init_core_replay_preloaded<I>(test_name: &str, histories: I) -> Arc<dyn CoreWorker>
|
|
75
|
+
where
|
|
76
|
+
I: IntoIterator<Item = HistoryForReplay> + 'static,
|
|
77
|
+
<I as IntoIterator>::IntoIter: Send,
|
|
78
|
+
{
|
|
79
|
+
init_core_replay_stream(test_name, stream::iter(histories))
|
|
80
|
+
}
|
|
81
|
+
pub fn init_core_replay_stream<I>(test_name: &str, histories: I) -> Arc<dyn CoreWorker>
|
|
82
|
+
where
|
|
83
|
+
I: Stream<Item = HistoryForReplay> + Send + 'static,
|
|
84
|
+
{
|
|
71
85
|
let worker_cfg = WorkerConfigBuilder::default()
|
|
72
86
|
.namespace(NAMESPACE)
|
|
73
87
|
.task_queue(test_name)
|
|
74
88
|
.worker_build_id("test_bin_id")
|
|
75
89
|
.build()
|
|
76
90
|
.expect("Configuration options construct properly");
|
|
77
|
-
let worker =
|
|
78
|
-
|
|
91
|
+
let worker =
|
|
92
|
+
init_replay_worker(worker_cfg, histories).expect("Replay worker must init properly");
|
|
93
|
+
Arc::new(worker)
|
|
94
|
+
}
|
|
95
|
+
pub fn replay_sdk_worker<I>(histories: I) -> Worker
|
|
96
|
+
where
|
|
97
|
+
I: IntoIterator<Item = HistoryForReplay> + 'static,
|
|
98
|
+
<I as IntoIterator>::IntoIter: Send,
|
|
99
|
+
{
|
|
100
|
+
replay_sdk_worker_stream(stream::iter(histories))
|
|
101
|
+
}
|
|
102
|
+
pub fn replay_sdk_worker_stream<I>(histories: I) -> Worker
|
|
103
|
+
where
|
|
104
|
+
I: Stream<Item = HistoryForReplay> + Send + 'static,
|
|
105
|
+
{
|
|
106
|
+
let core = init_core_replay_stream("replay_worker_test", histories);
|
|
107
|
+
let mut worker = Worker::new_from_core(core, "replay_q".to_string());
|
|
108
|
+
worker.set_worker_interceptor(Box::new(FailOnNondeterminismInterceptor {}));
|
|
109
|
+
worker
|
|
79
110
|
}
|
|
80
111
|
|
|
81
112
|
/// Load history from a file containing the protobuf serialization of it
|
|
@@ -87,11 +118,21 @@ pub async fn history_from_proto_binary(path_from_root: &str) -> Result<History,
|
|
|
87
118
|
Ok(History::decode(&*bytes)?)
|
|
88
119
|
}
|
|
89
120
|
|
|
121
|
+
static INTEG_TESTS_RT: once_cell::sync::OnceCell<CoreRuntime> = once_cell::sync::OnceCell::new();
|
|
122
|
+
pub fn init_integ_telem() {
|
|
123
|
+
INTEG_TESTS_RT.get_or_init(|| {
|
|
124
|
+
let telemetry_options = get_integ_telem_options();
|
|
125
|
+
let rt =
|
|
126
|
+
CoreRuntime::new_assume_tokio(telemetry_options).expect("Core runtime inits cleanly");
|
|
127
|
+
let _ = tracing::subscriber::set_global_default(rt.trace_subscriber());
|
|
128
|
+
rt
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
|
|
90
132
|
/// Implements a builder pattern to help integ tests initialize core and create workflows
|
|
91
133
|
pub struct CoreWfStarter {
|
|
92
134
|
/// Used for both the task queue and workflow id
|
|
93
135
|
task_queue_name: String,
|
|
94
|
-
telemetry_options: TelemetryOptions,
|
|
95
136
|
pub worker_config: WorkerConfig,
|
|
96
137
|
wft_timeout: Option<Duration>,
|
|
97
138
|
initted_worker: OnceCell<InitializedWorker>,
|
|
@@ -110,9 +151,9 @@ impl CoreWfStarter {
|
|
|
110
151
|
}
|
|
111
152
|
|
|
112
153
|
pub fn new_tq_name(task_queue: &str) -> Self {
|
|
154
|
+
init_integ_telem();
|
|
113
155
|
Self {
|
|
114
156
|
task_queue_name: task_queue.to_owned(),
|
|
115
|
-
telemetry_options: get_integ_telem_options(),
|
|
116
157
|
worker_config: WorkerConfigBuilder::default()
|
|
117
158
|
.namespace(NAMESPACE)
|
|
118
159
|
.task_queue(task_queue)
|
|
@@ -181,19 +222,21 @@ impl CoreWfStarter {
|
|
|
181
222
|
&mut self,
|
|
182
223
|
wf_id: impl Into<String>,
|
|
183
224
|
run_id: impl Into<String>,
|
|
184
|
-
// TODO: Need not be passed in
|
|
185
225
|
worker: &mut Worker,
|
|
186
226
|
) -> Result<(), anyhow::Error> {
|
|
227
|
+
let wf_id = wf_id.into();
|
|
187
228
|
// Fetch history and replay it
|
|
188
229
|
let history = self
|
|
189
230
|
.get_client()
|
|
190
231
|
.await
|
|
191
|
-
.get_workflow_execution_history(wf_id.
|
|
232
|
+
.get_workflow_execution_history(wf_id.clone(), Some(run_id.into()), vec![])
|
|
192
233
|
.await?
|
|
193
234
|
.history
|
|
194
235
|
.expect("history field must be populated");
|
|
195
|
-
let
|
|
236
|
+
let with_id = HistoryForReplay::new(history, wf_id);
|
|
237
|
+
let replay_worker = init_core_replay_preloaded(worker.task_queue(), [with_id]);
|
|
196
238
|
worker.with_new_core_worker(replay_worker);
|
|
239
|
+
worker.set_worker_interceptor(Box::new(FailOnNondeterminismInterceptor {}));
|
|
197
240
|
worker.run().await.unwrap();
|
|
198
241
|
Ok(())
|
|
199
242
|
}
|
|
@@ -239,14 +282,18 @@ impl CoreWfStarter {
|
|
|
239
282
|
async fn get_or_init(&mut self) -> &InitializedWorker {
|
|
240
283
|
self.initted_worker
|
|
241
284
|
.get_or_init(|| async {
|
|
242
|
-
telemetry_init(&self.telemetry_options).expect("Telemetry inits cleanly");
|
|
243
285
|
let client = Arc::new(
|
|
244
286
|
get_integ_server_options()
|
|
245
287
|
.connect(self.worker_config.namespace.clone(), None, None)
|
|
246
288
|
.await
|
|
247
289
|
.expect("Must connect"),
|
|
248
290
|
);
|
|
249
|
-
let worker = init_worker(
|
|
291
|
+
let worker = init_worker(
|
|
292
|
+
INTEG_TESTS_RT.get().unwrap(),
|
|
293
|
+
self.worker_config.clone(),
|
|
294
|
+
client.clone(),
|
|
295
|
+
)
|
|
296
|
+
.expect("Worker inits cleanly");
|
|
250
297
|
InitializedWorker {
|
|
251
298
|
worker: Arc::new(worker),
|
|
252
299
|
client,
|
|
@@ -442,7 +489,6 @@ impl WorkerInterceptor for TestWorkerCompletionIceptor {
|
|
|
442
489
|
|
|
443
490
|
/// Returns the client options used to connect to the server used for integration tests.
|
|
444
491
|
pub fn get_integ_server_options() -> ClientOptions {
|
|
445
|
-
telemetry_init(&get_integ_telem_options()).expect("Telemetry inits cleanly");
|
|
446
492
|
let temporal_server_address = match env::var(INTEG_SERVER_TARGET_ENV_VAR) {
|
|
447
493
|
Ok(addr) => addr,
|
|
448
494
|
Err(_) => "http://localhost:7233".to_owned(),
|
|
@@ -459,6 +505,8 @@ pub fn get_integ_server_options() -> ClientOptions {
|
|
|
459
505
|
|
|
460
506
|
pub fn get_integ_telem_options() -> TelemetryOptions {
|
|
461
507
|
let mut ob = TelemetryOptionsBuilder::default();
|
|
508
|
+
let filter_string =
|
|
509
|
+
env::var("RUST_LOG").unwrap_or_else(|_| "temporal_sdk_core=INFO".to_string());
|
|
462
510
|
if let Some(url) = env::var(OTEL_URL_ENV_VAR)
|
|
463
511
|
.ok()
|
|
464
512
|
.map(|x| x.parse::<Url>().unwrap())
|
|
@@ -466,8 +514,12 @@ pub fn get_integ_telem_options() -> TelemetryOptions {
|
|
|
466
514
|
let opts = OtelCollectorOptions {
|
|
467
515
|
url,
|
|
468
516
|
headers: Default::default(),
|
|
517
|
+
metric_periodicity: None,
|
|
469
518
|
};
|
|
470
|
-
ob.tracing(
|
|
519
|
+
ob.tracing(TraceExportConfig {
|
|
520
|
+
filter: filter_string.clone(),
|
|
521
|
+
exporter: TraceExporter::Otel(opts.clone()),
|
|
522
|
+
});
|
|
471
523
|
ob.metrics(MetricsExporter::Otel(opts));
|
|
472
524
|
}
|
|
473
525
|
if let Some(addr) = env::var(PROM_ENABLE_ENV_VAR)
|
|
@@ -476,10 +528,11 @@ pub fn get_integ_telem_options() -> TelemetryOptions {
|
|
|
476
528
|
{
|
|
477
529
|
ob.metrics(MetricsExporter::Prometheus(addr));
|
|
478
530
|
}
|
|
479
|
-
ob.
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
531
|
+
ob.logging(Logger::Console {
|
|
532
|
+
filter: filter_string,
|
|
533
|
+
})
|
|
534
|
+
.build()
|
|
535
|
+
.unwrap()
|
|
483
536
|
}
|
|
484
537
|
|
|
485
538
|
pub fn default_cached_download() -> EphemeralExe {
|
|
@@ -504,7 +557,6 @@ pub fn schedule_activity_cmd(
|
|
|
504
557
|
seq,
|
|
505
558
|
activity_id: activity_id.to_string(),
|
|
506
559
|
activity_type: "test_activity".to_string(),
|
|
507
|
-
namespace: NAMESPACE.to_owned(),
|
|
508
560
|
task_queue: task_q.to_owned(),
|
|
509
561
|
schedule_to_start_timeout: Some(activity_timeout.try_into().expect("duration fits")),
|
|
510
562
|
start_to_close_timeout: Some(activity_timeout.try_into().expect("duration fits")),
|
|
@@ -13,7 +13,10 @@ use temporal_sdk_core_protos::{
|
|
|
13
13
|
workflow_completion::WorkflowActivationCompletion,
|
|
14
14
|
ActivityHeartbeat, ActivityTaskCompletion, AsJsonPayloadExt, IntoCompletion,
|
|
15
15
|
},
|
|
16
|
-
temporal::api::
|
|
16
|
+
temporal::api::{
|
|
17
|
+
common::v1::{Payload, RetryPolicy},
|
|
18
|
+
enums::v1::TimeoutType,
|
|
19
|
+
},
|
|
17
20
|
};
|
|
18
21
|
use temporal_sdk_core_test_utils::{
|
|
19
22
|
init_core_and_create_wf, schedule_activity_cmd, CoreWfStarter, WorkerTestHelpers,
|
|
@@ -196,7 +199,7 @@ async fn activity_doesnt_heartbeat_hits_timeout_then_completes() {
|
|
|
196
199
|
..Default::default()
|
|
197
200
|
})
|
|
198
201
|
.await;
|
|
199
|
-
|
|
202
|
+
assert_eq!(res.timed_out(), Some(TimeoutType::Heartbeat));
|
|
200
203
|
Ok(().into())
|
|
201
204
|
});
|
|
202
205
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
use temporal_client::WorkflowService;
|
|
2
|
+
use temporal_sdk_core::CoreRuntime;
|
|
3
|
+
use temporal_sdk_core_api::telemetry::MetricsExporter;
|
|
4
|
+
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::ListNamespacesRequest;
|
|
5
|
+
use temporal_sdk_core_test_utils::{get_integ_server_options, get_integ_telem_options};
|
|
6
|
+
|
|
7
|
+
#[tokio::test]
|
|
8
|
+
async fn prometheus_metrics_exported() {
|
|
9
|
+
let mut telemopts = get_integ_telem_options();
|
|
10
|
+
let addr = "127.0.0.1:10919";
|
|
11
|
+
telemopts.metrics = Some(MetricsExporter::Prometheus(addr.parse().unwrap()));
|
|
12
|
+
let rt = CoreRuntime::new_assume_tokio(telemopts).unwrap();
|
|
13
|
+
let opts = get_integ_server_options();
|
|
14
|
+
let mut raw_client = opts
|
|
15
|
+
.connect_no_namespace(rt.metric_meter(), None)
|
|
16
|
+
.await
|
|
17
|
+
.unwrap();
|
|
18
|
+
assert!(raw_client.get_client().capabilities().is_some());
|
|
19
|
+
|
|
20
|
+
let _ = raw_client
|
|
21
|
+
.list_namespaces(ListNamespacesRequest::default())
|
|
22
|
+
.await
|
|
23
|
+
.unwrap();
|
|
24
|
+
|
|
25
|
+
let body = reqwest::get(format!("http://{}/metrics", addr))
|
|
26
|
+
.await
|
|
27
|
+
.unwrap()
|
|
28
|
+
.text()
|
|
29
|
+
.await
|
|
30
|
+
.unwrap();
|
|
31
|
+
assert!(body.contains(
|
|
32
|
+
"request_latency_count{operation=\"ListNamespaces\",service_name=\"temporal-core-sdk\"} 1"
|
|
33
|
+
));
|
|
34
|
+
assert!(body.contains(
|
|
35
|
+
"request_latency_count{operation=\"GetSystemInfo\",service_name=\"temporal-core-sdk\"} 1"
|
|
36
|
+
));
|
|
37
|
+
}
|
|
@@ -3,7 +3,6 @@ use futures::future::join_all;
|
|
|
3
3
|
use std::time::Duration;
|
|
4
4
|
use temporal_client::WorkflowOptions;
|
|
5
5
|
use temporal_sdk::{WfContext, WorkflowResult};
|
|
6
|
-
use temporal_sdk_core_api::errors::PollWfError;
|
|
7
6
|
use temporal_sdk_core_protos::coresdk::{
|
|
8
7
|
activity_task::activity_task as act_task,
|
|
9
8
|
workflow_activation::{workflow_activation_job, FireTimer, WorkflowActivationJob},
|
|
@@ -132,15 +131,3 @@ async fn can_paginate_long_history() {
|
|
|
132
131
|
.unwrap();
|
|
133
132
|
worker.run_until_done().await.unwrap();
|
|
134
133
|
}
|
|
135
|
-
|
|
136
|
-
// TODO: Takes ages now, fix somehow
|
|
137
|
-
#[tokio::test]
|
|
138
|
-
async fn poll_of_nonexistent_namespace_is_fatal() {
|
|
139
|
-
let mut starter = CoreWfStarter::new("whatever_yo");
|
|
140
|
-
starter.worker_config.namespace = "I do not exist".to_string();
|
|
141
|
-
let worker = starter.get_worker().await;
|
|
142
|
-
assert_matches!(
|
|
143
|
-
worker.poll_workflow_activation().await,
|
|
144
|
-
Err(PollWfError::TonicError(_))
|
|
145
|
-
);
|
|
146
|
-
}
|