temporalio 1.0.0-x86_64-linux → 1.1.0-x86_64-linux
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/Gemfile +3 -0
- data/lib/temporalio/api/cloud/account/v1/message.rb +3 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +5 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +1 -1
- data/lib/temporalio/api/cloud/sink/v1/message.rb +3 -1
- data/lib/temporalio/api/deployment/v1/message.rb +1 -1
- data/lib/temporalio/api/namespace/v1/message.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +6 -0
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +5 -1
- data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
- data/lib/temporalio/client/connection/cloud_service.rb +30 -0
- data/lib/temporalio/client/connection/workflow_service.rb +30 -0
- data/lib/temporalio/client/connection.rb +14 -9
- data/lib/temporalio/client.rb +1 -1
- data/lib/temporalio/contrib/open_telemetry.rb +78 -25
- data/lib/temporalio/converters/payload_converter/composite.rb +1 -0
- data/lib/temporalio/converters/payload_converter/json_protobuf.rb +1 -1
- data/lib/temporalio/env_config.rb +1 -1
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.so +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.so +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.so +0 -0
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +1 -1
- data/lib/temporalio/internal/bridge/runtime.rb +1 -0
- data/lib/temporalio/internal/bridge/worker.rb +4 -3
- data/lib/temporalio/internal/worker/workflow_instance.rb +1 -0
- data/lib/temporalio/runtime.rb +16 -3
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/tuner.rb +0 -4
- data/lib/temporalio/worker/workflow_replayer.rb +4 -3
- data/lib/temporalio/worker.rb +4 -5
- data/lib/temporalio/workflow/info.rb +4 -0
- metadata +2 -2
|
@@ -154,8 +154,9 @@ module Temporalio
|
|
|
154
154
|
# +localhost:7233+.
|
|
155
155
|
# @param api_key [String, nil] API key for Temporal. This becomes the +Authorization+ HTTP header with +"Bearer "+
|
|
156
156
|
# prepended. This is only set if RPC metadata doesn't already have an +authorization+ key.
|
|
157
|
-
# @param tls [Boolean, TLSOptions] If false, do not use TLS. If true, use system default TLS options. If TLS
|
|
158
|
-
# options are present, those TLS options will be used.
|
|
157
|
+
# @param tls [Boolean, TLSOptions, nil] If false, do not use TLS. If true, use system default TLS options. If TLS
|
|
158
|
+
# options are present, those TLS options will be used. If nil (the default), TLS will be auto-enabled if
|
|
159
|
+
# api_key is provided.
|
|
159
160
|
# @param rpc_metadata [Hash<String, String>] Headers to use for all calls to the server. Keys here can be
|
|
160
161
|
# overriden by per-call RPC metadata keys.
|
|
161
162
|
# @param rpc_retry [RPCRetryOptions] Retry options for direct service calls (when opted in) or all high-level
|
|
@@ -173,7 +174,7 @@ module Temporalio
|
|
|
173
174
|
def initialize(
|
|
174
175
|
target_host:,
|
|
175
176
|
api_key: nil,
|
|
176
|
-
tls:
|
|
177
|
+
tls: nil,
|
|
177
178
|
rpc_metadata: {},
|
|
178
179
|
rpc_retry: RPCRetryOptions.new,
|
|
179
180
|
identity: "#{Process.pid}@#{Socket.gethostname}",
|
|
@@ -285,13 +286,17 @@ module Temporalio
|
|
|
285
286
|
),
|
|
286
287
|
identity: @options.identity || "#{Process.pid}@#{Socket.gethostname}"
|
|
287
288
|
)
|
|
288
|
-
|
|
289
|
-
|
|
289
|
+
# Auto-enable TLS when API key is provided and tls not explicitly set
|
|
290
|
+
tls = @options.tls
|
|
291
|
+
tls = true if tls.nil? && @options.api_key
|
|
292
|
+
|
|
293
|
+
if tls
|
|
294
|
+
options.tls = if tls.is_a?(TLSOptions)
|
|
290
295
|
Internal::Bridge::Client::TLSOptions.new(
|
|
291
|
-
client_cert:
|
|
292
|
-
client_private_key:
|
|
293
|
-
server_root_ca_cert:
|
|
294
|
-
domain:
|
|
296
|
+
client_cert: tls.client_cert, # steep:ignore
|
|
297
|
+
client_private_key: tls.client_private_key, # steep:ignore
|
|
298
|
+
server_root_ca_cert: tls.server_root_ca_cert, # steep:ignore
|
|
299
|
+
domain: tls.domain # steep:ignore
|
|
295
300
|
)
|
|
296
301
|
else
|
|
297
302
|
Internal::Bridge::Client::TLSOptions.new
|
data/lib/temporalio/client.rb
CHANGED
|
@@ -86,10 +86,24 @@ module Temporalio
|
|
|
86
86
|
attributes: nil,
|
|
87
87
|
outbound_input: nil
|
|
88
88
|
)
|
|
89
|
-
tracer.in_span
|
|
89
|
+
# We cannot use tracer.in_span because it always assumes we want to set the status as error on exception, but
|
|
90
|
+
# we do not want to do that for benign exceptions. This is effectively a copy of the source of in_span with
|
|
91
|
+
# that change.
|
|
92
|
+
span = nil
|
|
93
|
+
span = tracer.start_span(name, attributes:, kind:)
|
|
94
|
+
::OpenTelemetry::Trace.with_span(span) do
|
|
90
95
|
_apply_context_to_headers(outbound_input.headers) if outbound_input
|
|
91
96
|
yield
|
|
92
97
|
end
|
|
98
|
+
rescue Exception => e # rubocop:disable Lint/RescueException
|
|
99
|
+
span&.record_exception(e)
|
|
100
|
+
# Only set the status if it is not a benign application error
|
|
101
|
+
unless e.is_a?(Error::ApplicationError) && e.category == Error::ApplicationError::Category::BENIGN
|
|
102
|
+
span&.status = ::OpenTelemetry::Trace::Status.error("Unhandled exception of type: #{e.class}")
|
|
103
|
+
end
|
|
104
|
+
raise e
|
|
105
|
+
ensure
|
|
106
|
+
span&.finish
|
|
93
107
|
end
|
|
94
108
|
|
|
95
109
|
# @!visibility private
|
|
@@ -217,7 +231,7 @@ module Temporalio
|
|
|
217
231
|
|
|
218
232
|
# @!visibility private
|
|
219
233
|
def execute(input)
|
|
220
|
-
|
|
234
|
+
_attach_context(Temporalio::Workflow.info.headers)
|
|
221
235
|
Workflow.with_completed_span("RunWorkflow:#{Temporalio::Workflow.info.workflow_type}", kind: :server) do
|
|
222
236
|
super
|
|
223
237
|
ensure
|
|
@@ -231,7 +245,7 @@ module Temporalio
|
|
|
231
245
|
|
|
232
246
|
# @!visibility private
|
|
233
247
|
def handle_signal(input)
|
|
234
|
-
|
|
248
|
+
_attach_context(Temporalio::Workflow.info.headers)
|
|
235
249
|
Workflow.with_completed_span(
|
|
236
250
|
"HandleSignal:#{input.signal}",
|
|
237
251
|
links: _links_from_headers(input.headers),
|
|
@@ -246,7 +260,7 @@ module Temporalio
|
|
|
246
260
|
|
|
247
261
|
# @!visibility private
|
|
248
262
|
def handle_query(input)
|
|
249
|
-
|
|
263
|
+
_attach_context(Temporalio::Workflow.info.headers)
|
|
250
264
|
Workflow.with_completed_span(
|
|
251
265
|
"HandleQuery:#{input.query}",
|
|
252
266
|
links: _links_from_headers(input.headers),
|
|
@@ -267,7 +281,7 @@ module Temporalio
|
|
|
267
281
|
|
|
268
282
|
# @!visibility private
|
|
269
283
|
def validate_update(input)
|
|
270
|
-
|
|
284
|
+
_attach_context(Temporalio::Workflow.info.headers)
|
|
271
285
|
Workflow.with_completed_span(
|
|
272
286
|
"ValidateUpdate:#{input.update}",
|
|
273
287
|
attributes: { 'temporalUpdateID' => input.id },
|
|
@@ -290,7 +304,7 @@ module Temporalio
|
|
|
290
304
|
|
|
291
305
|
# @!visibility private
|
|
292
306
|
def handle_update(input)
|
|
293
|
-
|
|
307
|
+
_attach_context(Temporalio::Workflow.info.headers)
|
|
294
308
|
Workflow.with_completed_span(
|
|
295
309
|
"HandleUpdate:#{input.update}",
|
|
296
310
|
attributes: { 'temporalUpdateID' => input.id },
|
|
@@ -309,14 +323,30 @@ module Temporalio
|
|
|
309
323
|
end
|
|
310
324
|
end
|
|
311
325
|
|
|
326
|
+
# @!visibility private
|
|
327
|
+
def _attach_context(headers)
|
|
328
|
+
# We have to disable the durable scheduler _even_ for something simple like attach context. For most OTel
|
|
329
|
+
# implementations, such a procedure is completely deterministic, but unfortunately some implementations like
|
|
330
|
+
# DataDog monkey patch OpenTelemetry (see
|
|
331
|
+
# https://github.com/DataDog/dd-trace-rb/blob/f88393d0571806b9980bb2cf5066eba60cfea177/lib/datadog/opentelemetry/api/context.rb#L184)
|
|
332
|
+
# to make even OpenTelemetry::Context.current non-deterministic because it uses mutexes. And a simple text
|
|
333
|
+
# map propagation extraction accesses Context.current.
|
|
334
|
+
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
335
|
+
@root._attach_context(headers)
|
|
336
|
+
end
|
|
337
|
+
end
|
|
338
|
+
|
|
312
339
|
# @!visibility private
|
|
313
340
|
def _links_from_headers(headers)
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
341
|
+
# See _attach_context above for why we have to disable scheduler even for these simple operations
|
|
342
|
+
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
343
|
+
context = @root._context_from_headers(headers)
|
|
344
|
+
span = ::OpenTelemetry::Trace.current_span(context) if context
|
|
345
|
+
if span && span != ::OpenTelemetry::Trace::Span::INVALID
|
|
346
|
+
[::OpenTelemetry::Trace::Link.new(span.context)]
|
|
347
|
+
else
|
|
348
|
+
[]
|
|
349
|
+
end
|
|
320
350
|
end
|
|
321
351
|
end
|
|
322
352
|
end
|
|
@@ -345,7 +375,9 @@ module Temporalio
|
|
|
345
375
|
# @!visibility private
|
|
346
376
|
def initialize_continue_as_new_error(input)
|
|
347
377
|
# Just apply the current context to headers
|
|
348
|
-
|
|
378
|
+
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
379
|
+
@root._apply_context_to_headers(input.error.headers)
|
|
380
|
+
end
|
|
349
381
|
super
|
|
350
382
|
end
|
|
351
383
|
|
|
@@ -372,7 +404,11 @@ module Temporalio
|
|
|
372
404
|
|
|
373
405
|
# @!visibility private
|
|
374
406
|
def _apply_span_to_headers(headers, span)
|
|
375
|
-
|
|
407
|
+
# See WorkflowInbound#_attach_context comments for why we have to disable scheduler even for these simple
|
|
408
|
+
# operations
|
|
409
|
+
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
410
|
+
@root._apply_context_to_headers(headers, context: ::OpenTelemetry::Trace.context_with_span(span)) if span
|
|
411
|
+
end
|
|
376
412
|
end
|
|
377
413
|
end
|
|
378
414
|
|
|
@@ -405,9 +441,19 @@ module Temporalio
|
|
|
405
441
|
)
|
|
406
442
|
span = completed_span(name, attributes:, links:, kind:, exception:, even_during_replay:)
|
|
407
443
|
if span
|
|
408
|
-
::OpenTelemetry::Trace.with_span
|
|
444
|
+
# We cannot use ::OpenTelemetry::Trace.with_span here unfortunately. We need to disable the durable
|
|
445
|
+
# scheduler for just the span attach/detach but leave it enabled for the user code (see
|
|
446
|
+
# WorkflowInbound#_attach_current for why we have to disable scheduler even for these simple operations).
|
|
447
|
+
token = Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
448
|
+
::OpenTelemetry::Context.attach(::OpenTelemetry::Trace.context_with_span(span))
|
|
449
|
+
end
|
|
450
|
+
begin
|
|
409
451
|
# Yield with no parameters
|
|
410
452
|
yield
|
|
453
|
+
ensure
|
|
454
|
+
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
455
|
+
::OpenTelemetry::Context.detach(token)
|
|
456
|
+
end
|
|
411
457
|
end
|
|
412
458
|
else
|
|
413
459
|
yield
|
|
@@ -441,25 +487,32 @@ module Temporalio
|
|
|
441
487
|
# Do nothing if replaying and not wanted during replay
|
|
442
488
|
return nil if !even_during_replay && Temporalio::Workflow::Unsafe.replaying?
|
|
443
489
|
|
|
444
|
-
# If there is no span on the context and the user hasn't opted in to always creating, do not create. This
|
|
445
|
-
# prevents orphans if there was no span originally created from the client start-workflow call.
|
|
446
|
-
if ::OpenTelemetry::Trace.current_span == ::OpenTelemetry::Trace::Span::INVALID &&
|
|
447
|
-
!root._always_create_workflow_spans
|
|
448
|
-
return nil
|
|
449
|
-
end
|
|
450
|
-
|
|
451
490
|
# Create attributes, adding user-defined ones
|
|
452
491
|
attributes = { 'temporalWorkflowID' => Temporalio::Workflow.info.workflow_id,
|
|
453
492
|
'temporalRunID' => Temporalio::Workflow.info.run_id }.merge(attributes)
|
|
454
493
|
|
|
455
494
|
time = Temporalio::Workflow.now.dup
|
|
456
495
|
# Disable durable scheduler because 1) synchronous/non-batch span processors in OTel use network (though could
|
|
457
|
-
# have just used
|
|
496
|
+
# have just used Unsafe.io_enabled for this if not for the next point) and 2) OTel uses Ruby Timeout which we
|
|
458
497
|
# don't want to use durable timers.
|
|
459
498
|
Temporalio::Workflow::Unsafe.durable_scheduler_disabled do
|
|
499
|
+
# If there is no span on the context and the user hasn't opted in to always creating, do not create. This
|
|
500
|
+
# prevents orphans if there was no span originally created from the client start-workflow call.
|
|
501
|
+
if ::OpenTelemetry::Trace.current_span == ::OpenTelemetry::Trace::Span::INVALID &&
|
|
502
|
+
!root._always_create_workflow_spans
|
|
503
|
+
return nil
|
|
504
|
+
end
|
|
505
|
+
|
|
460
506
|
span = root.tracer.start_span(name, attributes:, links:, start_timestamp: time, kind:) # steep:ignore
|
|
461
|
-
# Record exception if present
|
|
462
|
-
|
|
507
|
+
# Record exception and set status if present
|
|
508
|
+
if exception
|
|
509
|
+
span.record_exception(exception)
|
|
510
|
+
# Only set the status if it is not a benign application error
|
|
511
|
+
unless exception.is_a?(Error::ApplicationError) &&
|
|
512
|
+
exception.category == Error::ApplicationError::Category::BENIGN
|
|
513
|
+
span.status = ::OpenTelemetry::Trace::Status.error("Unhandled exception of type: #{exception.class}")
|
|
514
|
+
end
|
|
515
|
+
end
|
|
463
516
|
# Finish the span (returns self)
|
|
464
517
|
span.finish(end_timestamp: time)
|
|
465
518
|
end
|
|
@@ -212,7 +212,7 @@ module Temporalio
|
|
|
212
212
|
# Create a client connect config from this profile
|
|
213
213
|
# @return [Array] Tuple of [positional_args, keyword_args] that can be splatted to Client.connect
|
|
214
214
|
def to_client_connect_options
|
|
215
|
-
positional_args = [address, namespace]
|
|
215
|
+
positional_args = [address, namespace]
|
|
216
216
|
tls_value = false
|
|
217
217
|
if tls
|
|
218
218
|
tls_value = tls.to_client_tls_options
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -17,7 +17,7 @@ require 'temporalio/internal/bridge/api/common/common'
|
|
|
17
17
|
require 'temporalio/internal/bridge/api/nexus/nexus'
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
descriptor_data = "\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\x1a#temporal/sdk/core/nexus/nexus.proto\"\
|
|
20
|
+
descriptor_data = "\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\x1a#temporal/sdk/core/nexus/nexus.proto\"\x94\x03\n\x12WorkflowActivation\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cis_replaying\x18\x03 \x01(\x08\x12\x16\n\x0ehistory_length\x18\x04 \x01(\r\x12@\n\x04jobs\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.WorkflowActivationJob\x12 \n\x18\x61vailable_internal_flags\x18\x06 \x03(\r\x12\x1a\n\x12history_size_bytes\x18\x07 \x01(\x04\x12!\n\x19\x63ontinue_as_new_suggested\x18\x08 \x01(\x08\x12T\n#deployment_version_for_current_task\x18\t \x01(\x0b\x32\'.coresdk.common.WorkerDeploymentVersion\x12\x18\n\x10last_sdk_version\x18\n \x01(\t\"\xe0\n\n\x15WorkflowActivationJob\x12N\n\x13initialize_workflow\x18\x01 \x01(\x0b\x32/.coresdk.workflow_activation.InitializeWorkflowH\x00\x12<\n\nfire_timer\x18\x02 \x01(\x0b\x32&.coresdk.workflow_activation.FireTimerH\x00\x12K\n\x12update_random_seed\x18\x04 \x01(\x0b\x32-.coresdk.workflow_activation.UpdateRandomSeedH\x00\x12\x44\n\x0equery_workflow\x18\x05 \x01(\x0b\x32*.coresdk.workflow_activation.QueryWorkflowH\x00\x12\x46\n\x0f\x63\x61ncel_workflow\x18\x06 \x01(\x0b\x32+.coresdk.workflow_activation.CancelWorkflowH\x00\x12\x46\n\x0fsignal_workflow\x18\x07 \x01(\x0b\x32+.coresdk.workflow_activation.SignalWorkflowH\x00\x12H\n\x10resolve_activity\x18\x08 \x01(\x0b\x32,.coresdk.workflow_activation.ResolveActivityH\x00\x12G\n\x10notify_has_patch\x18\t \x01(\x0b\x32+.coresdk.workflow_activation.NotifyHasPatchH\x00\x12q\n&resolve_child_workflow_execution_start\x18\n \x01(\x0b\x32?.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartH\x00\x12\x66\n resolve_child_workflow_execution\x18\x0b \x01(\x0b\x32:.coresdk.workflow_activation.ResolveChildWorkflowExecutionH\x00\x12\x66\n resolve_signal_external_workflow\x18\x0c \x01(\x0b\x32:.coresdk.workflow_activation.ResolveSignalExternalWorkflowH\x00\x12u\n(resolve_request_cancel_external_workflow\x18\r \x01(\x0b\x32\x41.coresdk.workflow_activation.ResolveRequestCancelExternalWorkflowH\x00\x12:\n\tdo_update\x18\x0e \x01(\x0b\x32%.coresdk.workflow_activation.DoUpdateH\x00\x12`\n\x1dresolve_nexus_operation_start\x18\x0f \x01(\x0b\x32\x37.coresdk.workflow_activation.ResolveNexusOperationStartH\x00\x12U\n\x17resolve_nexus_operation\x18\x10 \x01(\x0b\x32\x32.coresdk.workflow_activation.ResolveNexusOperationH\x00\x12I\n\x11remove_from_cache\x18\x32 \x01(\x0b\x32,.coresdk.workflow_activation.RemoveFromCacheH\x00\x42\t\n\x07variant\"\xd9\n\n\x12InitializeWorkflow\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x17\n\x0frandomness_seed\x18\x04 \x01(\x04\x12M\n\x07headers\x18\x05 \x03(\x0b\x32<.coresdk.workflow_activation.InitializeWorkflow.HeadersEntry\x12\x10\n\x08identity\x18\x06 \x01(\t\x12I\n\x14parent_workflow_info\x18\x07 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12=\n\x1aworkflow_execution_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\'\n\x1f\x63ontinued_from_execution_run_id\x18\x0b \x01(\t\x12J\n\x13\x63ontinued_initiator\x18\x0c \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\r \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1e\n\x16\x66irst_execution_run_id\x18\x0f \x01(\t\x12\x39\n\x0cretry_policy\x18\x10 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x11 \x01(\x05\x12\x15\n\rcron_schedule\x18\x12 \x01(\t\x12\x46\n\"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n\"cron_schedule_to_schedule_interval\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x15 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x16 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\nstart_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12@\n\rroot_workflow\x18\x18 \x01(\x0b\x32).temporal.api.common.v1.WorkflowExecution\x12\x32\n\x08priority\x18\x19 \x01(\x0b\x32 .temporal.api.common.v1.Priority\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\x18\n\tFireTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r\"m\n\x0fResolveActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.activity_result.ActivityResolution\x12\x10\n\x08is_local\x18\x03 \x01(\x08\"\xd1\x02\n\"ResolveChildWorkflowExecutionStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12[\n\tsucceeded\x18\x02 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartSuccessH\x00\x12X\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartFailureH\x00\x12]\n\tcancelled\x18\x04 \x01(\x0b\x32H.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelledH\x00\x42\x08\n\x06status\";\n)ResolveChildWorkflowExecutionStartSuccess\x12\x0e\n\x06run_id\x18\x01 \x01(\t\"\xa6\x01\n)ResolveChildWorkflowExecutionStartFailure\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x15\n\rworkflow_type\x18\x02 \x01(\t\x12M\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32>.coresdk.child_workflow.StartChildWorkflowExecutionFailedCause\"`\n+ResolveChildWorkflowExecutionStartCancelled\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"i\n\x1dResolveChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.child_workflow.ChildWorkflowResult\"+\n\x10UpdateRandomSeed\x12\x17\n\x0frandomness_seed\x18\x01 \x01(\x04\"\x84\x02\n\rQueryWorkflow\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12\x12\n\nquery_type\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12H\n\x07headers\x18\x05 \x03(\x0b\x32\x37.coresdk.workflow_activation.QueryWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\" \n\x0e\x43\x61ncelWorkflow\x12\x0e\n\x06reason\x18\x01 \x01(\t\"\x83\x02\n\x0eSignalWorkflow\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12.\n\x05input\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x10\n\x08identity\x18\x03 \x01(\t\x12I\n\x07headers\x18\x05 \x03(\x0b\x32\x38.coresdk.workflow_activation.SignalWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\"\n\x0eNotifyHasPatch\x12\x10\n\x08patch_id\x18\x01 \x01(\t\"_\n\x1dResolveSignalExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"f\n$ResolveRequestCancelExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"\xcb\x02\n\x08\x44oUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1c\n\x14protocol_instance_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x43\n\x07headers\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.DoUpdate.HeadersEntry\x12*\n\x04meta\x18\x06 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x15\n\rrun_validator\x18\x07 \x01(\x08\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\x9a\x01\n\x1aResolveNexusOperationStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x19\n\x0foperation_token\x18\x02 \x01(\tH\x00\x12\x16\n\x0cstarted_sync\x18\x03 \x01(\x08H\x00\x12\x32\n\x06\x66\x61iled\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\x08\n\x06status\"Y\n\x15ResolveNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x33\n\x06result\x18\x02 \x01(\x0b\x32#.coresdk.nexus.NexusOperationResult\"\xe0\x02\n\x0fRemoveFromCache\x12\x0f\n\x07message\x18\x01 \x01(\t\x12K\n\x06reason\x18\x02 \x01(\x0e\x32;.coresdk.workflow_activation.RemoveFromCache.EvictionReason\"\xee\x01\n\x0e\x45victionReason\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nCACHE_FULL\x10\x01\x12\x0e\n\nCACHE_MISS\x10\x02\x12\x12\n\x0eNONDETERMINISM\x10\x03\x12\r\n\tLANG_FAIL\x10\x04\x12\x12\n\x0eLANG_REQUESTED\x10\x05\x12\x12\n\x0eTASK_NOT_FOUND\x10\x06\x12\x15\n\x11UNHANDLED_COMMAND\x10\x07\x12\t\n\x05\x46\x41TAL\x10\x08\x12\x1f\n\x1bPAGINATION_OR_HISTORY_FETCH\x10\t\x12\x1d\n\x19WORKFLOW_EXECUTION_ENDING\x10\nB8\xea\x02\x35Temporalio::Internal::Bridge::Api::WorkflowActivationb\x06proto3"
|
|
21
21
|
|
|
22
22
|
pool = ::Google::Protobuf::DescriptorPool.generated_pool
|
|
23
23
|
pool.add_serialized_file(descriptor_data)
|
|
@@ -7,8 +7,6 @@ module Temporalio
|
|
|
7
7
|
module Bridge
|
|
8
8
|
class Worker
|
|
9
9
|
Options = Struct.new(
|
|
10
|
-
:activity,
|
|
11
|
-
:workflow,
|
|
12
10
|
:namespace,
|
|
13
11
|
:task_queue,
|
|
14
12
|
:tuner,
|
|
@@ -17,7 +15,10 @@ module Temporalio
|
|
|
17
15
|
:workflow_task_poller_behavior,
|
|
18
16
|
:nonsticky_to_sticky_poll_ratio,
|
|
19
17
|
:activity_task_poller_behavior,
|
|
20
|
-
:
|
|
18
|
+
:enable_workflows,
|
|
19
|
+
:enable_local_activities,
|
|
20
|
+
:enable_remote_activities,
|
|
21
|
+
:enable_nexus,
|
|
21
22
|
:sticky_queue_schedule_to_start_timeout,
|
|
22
23
|
:max_heartbeat_throttle_interval,
|
|
23
24
|
:default_heartbeat_throttle_interval,
|
|
@@ -133,6 +133,7 @@ module Temporalio
|
|
|
133
133
|
last_result: if @init_job.last_completion_result
|
|
134
134
|
@payload_converter.from_payloads(@init_job.last_completion_result).first
|
|
135
135
|
end,
|
|
136
|
+
has_last_result?: !@init_job.last_completion_result.nil?,
|
|
136
137
|
namespace: details.namespace,
|
|
137
138
|
parent: if @init_job.parent_workflow_info
|
|
138
139
|
Workflow::Info::ParentInfo.new(
|
data/lib/temporalio/runtime.rb
CHANGED
|
@@ -101,7 +101,8 @@ module Temporalio
|
|
|
101
101
|
# @!visibility private
|
|
102
102
|
def _to_bridge
|
|
103
103
|
# @type self: LoggingFilterOptions
|
|
104
|
-
"#{other_level},
|
|
104
|
+
"#{other_level},temporalio_sdk_core=#{core_level},temporalio_client=#{core_level}," \
|
|
105
|
+
"temporalio_sdk=#{core_level},temporalio_bridge=#{core_level}"
|
|
105
106
|
end
|
|
106
107
|
end
|
|
107
108
|
|
|
@@ -329,12 +330,24 @@ module Temporalio
|
|
|
329
330
|
# pool, this also consumes a Ruby thread for its lifetime.
|
|
330
331
|
#
|
|
331
332
|
# @param telemetry [TelemetryOptions] Telemetry options to set.
|
|
332
|
-
|
|
333
|
+
# @param worker_heartbeat_interval [Float, nil] Interval for worker heartbeats in seconds. Can be nil to disable
|
|
334
|
+
# heartbeating. Interval must be between 1s and 60s.
|
|
335
|
+
def initialize(
|
|
336
|
+
telemetry: TelemetryOptions.new,
|
|
337
|
+
worker_heartbeat_interval: 60
|
|
338
|
+
)
|
|
339
|
+
if !worker_heartbeat_interval.nil? && !worker_heartbeat_interval.positive?
|
|
340
|
+
raise 'Worker heartbeat interval must be positive'
|
|
341
|
+
end
|
|
342
|
+
|
|
333
343
|
# Set runtime on the buffer which will fail if the buffer is used on another runtime
|
|
334
344
|
telemetry.metrics&.buffer&._set_runtime(self)
|
|
335
345
|
|
|
336
346
|
@core_runtime = Internal::Bridge::Runtime.new(
|
|
337
|
-
Internal::Bridge::Runtime::Options.new(
|
|
347
|
+
Internal::Bridge::Runtime::Options.new(
|
|
348
|
+
telemetry: telemetry._to_bridge,
|
|
349
|
+
worker_heartbeat_interval:
|
|
350
|
+
)
|
|
338
351
|
)
|
|
339
352
|
@metric_meter = Internal::Metric::Meter.create_from_runtime(self) || Metric::Meter.null
|
|
340
353
|
# We need a thread to run the command loop
|
data/lib/temporalio/version.rb
CHANGED
|
@@ -32,8 +32,6 @@ module Temporalio
|
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
# A slot supplier that will dynamically adjust the number of slots based on resource usage.
|
|
35
|
-
#
|
|
36
|
-
# @note WARNING: This API is experimental.
|
|
37
35
|
class ResourceBased < SlotSupplier
|
|
38
36
|
attr_reader :tuner_options, :slot_options
|
|
39
37
|
|
|
@@ -66,8 +64,6 @@ module Temporalio
|
|
|
66
64
|
#
|
|
67
65
|
# Users should be cautious when implementing this and make sure it is heavily tested and the documentation for
|
|
68
66
|
# every method is well understood.
|
|
69
|
-
#
|
|
70
|
-
# @note WARNING: This API is experimental.
|
|
71
67
|
class Custom < SlotSupplier
|
|
72
68
|
# Context provided for slot reservation on custom slot supplier.
|
|
73
69
|
#
|
|
@@ -197,8 +197,6 @@ module Temporalio
|
|
|
197
197
|
@bridge_replayer, @bridge_worker = Internal::Bridge::Worker::WorkflowReplayer.new(
|
|
198
198
|
options.runtime._core_runtime,
|
|
199
199
|
Internal::Bridge::Worker::Options.new(
|
|
200
|
-
activity: false,
|
|
201
|
-
workflow: true,
|
|
202
200
|
namespace: options.namespace,
|
|
203
201
|
task_queue: options.task_queue,
|
|
204
202
|
tuner: Tuner.create_fixed(
|
|
@@ -211,7 +209,10 @@ module Temporalio
|
|
|
211
209
|
nonsticky_to_sticky_poll_ratio: 1.0,
|
|
212
210
|
activity_task_poller_behavior:
|
|
213
211
|
Temporalio::Worker::PollerBehavior::SimpleMaximum.new(1)._to_bridge_options,
|
|
214
|
-
|
|
212
|
+
enable_workflows: true,
|
|
213
|
+
enable_local_activities: false,
|
|
214
|
+
enable_remote_activities: false,
|
|
215
|
+
enable_nexus: false,
|
|
215
216
|
sticky_queue_schedule_to_start_timeout: 1.0,
|
|
216
217
|
max_heartbeat_throttle_interval: 1.0,
|
|
217
218
|
default_heartbeat_throttle_interval: 1.0,
|
data/lib/temporalio/worker.rb
CHANGED
|
@@ -465,8 +465,6 @@ module Temporalio
|
|
|
465
465
|
@bridge_worker = Internal::Bridge::Worker.new(
|
|
466
466
|
client.connection._core_client,
|
|
467
467
|
Internal::Bridge::Worker::Options.new(
|
|
468
|
-
activity: !activities.empty?,
|
|
469
|
-
workflow: !workflows.empty?,
|
|
470
468
|
namespace: client.namespace,
|
|
471
469
|
task_queue:,
|
|
472
470
|
tuner: tuner._to_bridge_options,
|
|
@@ -475,9 +473,10 @@ module Temporalio
|
|
|
475
473
|
workflow_task_poller_behavior: workflow_task_poller_behavior._to_bridge_options,
|
|
476
474
|
nonsticky_to_sticky_poll_ratio:,
|
|
477
475
|
activity_task_poller_behavior: activity_task_poller_behavior._to_bridge_options,
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
476
|
+
enable_workflows: !workflows.empty?,
|
|
477
|
+
enable_local_activities: !workflows.empty? && !activities.empty?,
|
|
478
|
+
enable_remote_activities: !activities.empty? && !no_remote_activities,
|
|
479
|
+
enable_nexus: false,
|
|
481
480
|
sticky_queue_schedule_to_start_timeout:,
|
|
482
481
|
max_heartbeat_throttle_interval:,
|
|
483
482
|
default_heartbeat_throttle_interval:,
|
|
@@ -11,6 +11,7 @@ module Temporalio
|
|
|
11
11
|
:headers,
|
|
12
12
|
:last_failure,
|
|
13
13
|
:last_result,
|
|
14
|
+
:has_last_result?,
|
|
14
15
|
:namespace,
|
|
15
16
|
:parent,
|
|
16
17
|
:priority,
|
|
@@ -44,6 +45,9 @@ module Temporalio
|
|
|
44
45
|
# @return [Exception, nil] Failure if this workflow run is a continuation of a failure.
|
|
45
46
|
# @!attribute last_result
|
|
46
47
|
# @return [Object, nil] Successful result if this workflow is a continuation of a success.
|
|
48
|
+
# @!attribute has_last_result?
|
|
49
|
+
# @return [Boolean] Successful result if this workflow is a continuation of a success.
|
|
50
|
+
|
|
47
51
|
# @!attribute namespace
|
|
48
52
|
# @return [String] Namespace for the workflow.
|
|
49
53
|
# @!attribute parent
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: temporalio
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: x86_64-linux
|
|
6
6
|
authors:
|
|
7
7
|
- Temporal Technologies Inc
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-
|
|
11
|
+
date: 2025-12-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: google-protobuf
|