temporalio 0.3.0-arm64-darwin → 0.5.0-arm64-darwin
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/.yardopts +1 -1
- data/Gemfile +4 -0
- data/Rakefile +1 -1
- data/lib/temporalio/activity/cancellation_details.rb +58 -0
- data/lib/temporalio/activity/context.rb +23 -1
- data/lib/temporalio/activity/definition.rb +63 -8
- data/lib/temporalio/activity/info.rb +28 -4
- data/lib/temporalio/activity.rb +2 -0
- data/lib/temporalio/api/activity/v1/message.rb +1 -1
- data/lib/temporalio/api/batch/v1/message.rb +9 -2
- data/lib/temporalio/api/cloud/account/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +11 -2
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +2 -2
- data/lib/temporalio/api/cloud/identity/v1/message.rb +7 -2
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +6 -2
- data/lib/temporalio/api/cloud/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/cloud/operation/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/region/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/resource/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/sink/v1/message.rb +1 -1
- data/lib/temporalio/api/cloud/usage/v1/message.rb +1 -1
- data/lib/temporalio/api/command/v1/message.rb +2 -2
- data/lib/temporalio/api/common/v1/grpc_status.rb +1 -1
- data/lib/temporalio/api/common/v1/message.rb +4 -2
- data/lib/temporalio/api/deployment/v1/message.rb +39 -0
- data/lib/temporalio/api/enums/v1/batch_operation.rb +2 -2
- data/lib/temporalio/api/enums/v1/command_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/common.rb +5 -2
- data/lib/temporalio/api/enums/v1/deployment.rb +24 -0
- data/lib/temporalio/api/enums/v1/event_type.rb +2 -2
- data/lib/temporalio/api/enums/v1/failed_cause.rb +2 -2
- data/lib/temporalio/api/enums/v1/namespace.rb +1 -1
- data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
- data/lib/temporalio/api/enums/v1/query.rb +1 -1
- data/lib/temporalio/api/enums/v1/reset.rb +2 -2
- data/lib/temporalio/api/enums/v1/schedule.rb +1 -1
- data/lib/temporalio/api/enums/v1/task_queue.rb +1 -1
- data/lib/temporalio/api/enums/v1/update.rb +1 -1
- data/lib/temporalio/api/enums/v1/workflow.rb +3 -2
- data/lib/temporalio/api/errordetails/v1/message.rb +4 -2
- data/lib/temporalio/api/export/v1/message.rb +1 -1
- data/lib/temporalio/api/failure/v1/message.rb +5 -2
- data/lib/temporalio/api/filter/v1/message.rb +1 -1
- data/lib/temporalio/api/history/v1/message.rb +6 -2
- data/lib/temporalio/api/namespace/v1/message.rb +1 -1
- data/lib/temporalio/api/nexus/v1/message.rb +3 -2
- data/lib/temporalio/api/operatorservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +162 -7
- data/lib/temporalio/api/protocol/v1/message.rb +1 -1
- data/lib/temporalio/api/query/v1/message.rb +3 -2
- data/lib/temporalio/api/replication/v1/message.rb +1 -1
- data/lib/temporalio/api/rules/v1/message.rb +27 -0
- data/lib/temporalio/api/schedule/v1/message.rb +2 -2
- data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +1 -1
- data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/user_metadata.rb +1 -1
- data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +1 -1
- data/lib/temporalio/api/taskqueue/v1/message.rb +5 -2
- data/lib/temporalio/api/testservice/v1/request_response.rb +1 -1
- data/lib/temporalio/api/testservice/v1/service.rb +1 -1
- data/lib/temporalio/api/update/v1/message.rb +1 -1
- data/lib/temporalio/api/version/v1/message.rb +1 -1
- data/lib/temporalio/api/worker/v1/message.rb +30 -0
- data/lib/temporalio/api/workflow/v1/message.rb +22 -2
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +58 -12
- data/lib/temporalio/api/workflowservice/v1/service.rb +2 -2
- data/lib/temporalio/api.rb +1 -0
- data/lib/temporalio/client/async_activity_handle.rb +12 -4
- data/lib/temporalio/client/connection/cloud_service.rb +60 -0
- data/lib/temporalio/client/connection/workflow_service.rb +343 -28
- data/lib/temporalio/client/interceptor.rb +64 -7
- data/lib/temporalio/client/schedule.rb +35 -3
- data/lib/temporalio/client/with_start_workflow_operation.rb +123 -0
- data/lib/temporalio/client/workflow_execution.rb +19 -0
- data/lib/temporalio/client/workflow_handle.rb +47 -7
- data/lib/temporalio/client/workflow_update_handle.rb +9 -3
- data/lib/temporalio/client.rb +231 -4
- data/lib/temporalio/common_enums.rb +14 -0
- data/lib/temporalio/contrib/open_telemetry.rb +474 -0
- data/lib/temporalio/converters/data_converter.rb +18 -8
- data/lib/temporalio/converters/failure_converter.rb +6 -3
- data/lib/temporalio/converters/payload_converter/binary_null.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_plain.rb +2 -2
- data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter/composite.rb +6 -4
- data/lib/temporalio/converters/payload_converter/encoding.rb +4 -2
- data/lib/temporalio/converters/payload_converter/json_plain.rb +2 -2
- data/lib/temporalio/converters/payload_converter/json_protobuf.rb +2 -2
- data/lib/temporalio/converters/payload_converter.rb +16 -6
- data/lib/temporalio/error/failure.rb +19 -1
- data/lib/temporalio/error.rb +2 -1
- data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.bundle +0 -0
- data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +1 -1
- data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +3 -2
- data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +1 -1
- data/lib/temporalio/internal/bridge/api/common/common.rb +3 -2
- data/lib/temporalio/internal/bridge/api/core_interface.rb +1 -1
- data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +1 -1
- data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +2 -2
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +3 -2
- data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +3 -2
- data/lib/temporalio/internal/bridge/runtime.rb +3 -0
- data/lib/temporalio/internal/bridge/testing.rb +3 -0
- data/lib/temporalio/internal/bridge/worker.rb +28 -4
- data/lib/temporalio/internal/bridge.rb +1 -1
- data/lib/temporalio/internal/client/implementation.rb +281 -51
- data/lib/temporalio/internal/proto_utils.rb +38 -6
- data/lib/temporalio/internal/worker/activity_worker.rb +112 -27
- data/lib/temporalio/internal/worker/multi_runner.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +8 -6
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +100 -5
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +7 -2
- data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +2 -2
- data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +64 -18
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +39 -40
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +22 -2
- data/lib/temporalio/internal/worker/workflow_instance.rb +134 -55
- data/lib/temporalio/internal/worker/workflow_worker.rb +74 -21
- data/lib/temporalio/priority.rb +59 -0
- data/lib/temporalio/runtime/metric_buffer.rb +94 -0
- data/lib/temporalio/runtime.rb +48 -10
- data/lib/temporalio/search_attributes.rb +13 -0
- data/lib/temporalio/testing/activity_environment.rb +59 -16
- data/lib/temporalio/testing/workflow_environment.rb +29 -6
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/versioning_override.rb +56 -0
- data/lib/temporalio/worker/deployment_options.rb +45 -0
- data/lib/temporalio/worker/illegal_workflow_call_validator.rb +64 -0
- data/lib/temporalio/worker/interceptor.rb +16 -1
- data/lib/temporalio/worker/poller_behavior.rb +61 -0
- data/lib/temporalio/worker/thread_pool.rb +6 -6
- data/lib/temporalio/worker/tuner.rb +38 -0
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +14 -8
- data/lib/temporalio/worker/workflow_executor.rb +1 -1
- data/lib/temporalio/worker/workflow_replayer.rb +349 -0
- data/lib/temporalio/worker.rb +117 -75
- data/lib/temporalio/worker_deployment_version.rb +67 -0
- data/lib/temporalio/workflow/child_workflow_handle.rb +10 -2
- data/lib/temporalio/workflow/definition.rb +217 -35
- data/lib/temporalio/workflow/external_workflow_handle.rb +3 -1
- data/lib/temporalio/workflow/future.rb +2 -2
- data/lib/temporalio/workflow/info.rb +26 -1
- data/lib/temporalio/workflow.rb +119 -15
- data/lib/temporalio/workflow_history.rb +26 -1
- data/lib/temporalio.rb +1 -0
- data/temporalio.gemspec +3 -1
- metadata +34 -4
data/lib/temporalio/client.rb
CHANGED
@@ -8,17 +8,22 @@ require 'temporalio/client/connection'
|
|
8
8
|
require 'temporalio/client/interceptor'
|
9
9
|
require 'temporalio/client/schedule'
|
10
10
|
require 'temporalio/client/schedule_handle'
|
11
|
+
require 'temporalio/client/with_start_workflow_operation'
|
11
12
|
require 'temporalio/client/workflow_execution'
|
12
13
|
require 'temporalio/client/workflow_execution_count'
|
13
14
|
require 'temporalio/client/workflow_handle'
|
14
15
|
require 'temporalio/client/workflow_query_reject_condition'
|
16
|
+
require 'temporalio/client/workflow_update_handle'
|
17
|
+
require 'temporalio/client/workflow_update_wait_stage'
|
15
18
|
require 'temporalio/common_enums'
|
16
19
|
require 'temporalio/converters'
|
17
20
|
require 'temporalio/error'
|
18
21
|
require 'temporalio/internal/client/implementation'
|
22
|
+
require 'temporalio/priority'
|
19
23
|
require 'temporalio/retry_policy'
|
20
24
|
require 'temporalio/runtime'
|
21
25
|
require 'temporalio/search_attributes'
|
26
|
+
require 'temporalio/versioning_override'
|
22
27
|
require 'temporalio/workflow/definition'
|
23
28
|
|
24
29
|
module Temporalio
|
@@ -45,6 +50,16 @@ module Temporalio
|
|
45
50
|
# Options as returned from {options} for +**to_h+ splat use in {initialize}. See {initialize} for details.
|
46
51
|
class Options; end # rubocop:disable Lint/EmptyClass
|
47
52
|
|
53
|
+
ListWorkflowPage = Data.define(:executions, :next_page_token)
|
54
|
+
|
55
|
+
# A page of workflow executions returned by {Client#list_workflow_page}.
|
56
|
+
#
|
57
|
+
# @!attribute executions
|
58
|
+
# @return [Array<WorkflowExecution>] List of workflow executions in this page.
|
59
|
+
# @!attribute next_page_token
|
60
|
+
# @return [String, nil] Token for the next page of results. nil if there are no more results.
|
61
|
+
class ListWorkflowPage; end # rubocop:disable Lint/EmptyClass
|
62
|
+
|
48
63
|
# Connect to Temporal server. This is a shortcut for +Connection.new+ followed by +Client.new+.
|
49
64
|
#
|
50
65
|
# @param target_host [String] +host:port+ for the Temporal server. For local development, this is often
|
@@ -155,7 +170,7 @@ module Temporalio
|
|
155
170
|
default_workflow_query_reject_condition:
|
156
171
|
).freeze
|
157
172
|
# Initialize interceptors
|
158
|
-
@impl = interceptors.reverse_each.reduce(Internal::Client::Implementation.new(self)) do |acc, int|
|
173
|
+
@impl = interceptors.reverse_each.reduce(Internal::Client::Implementation.new(self)) do |acc, int| # steep:ignore
|
159
174
|
int.intercept_client(acc)
|
160
175
|
end
|
161
176
|
end
|
@@ -191,6 +206,12 @@ module Temporalio
|
|
191
206
|
# @param args [Array<Object>] Arguments to the workflow.
|
192
207
|
# @param id [String] Unique identifier for the workflow execution.
|
193
208
|
# @param task_queue [String] Task queue to run the workflow on.
|
209
|
+
# @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear in
|
210
|
+
# CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
|
211
|
+
# @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can
|
212
|
+
# be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
|
213
|
+
# updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is currently
|
214
|
+
# experimental.
|
194
215
|
# @param execution_timeout [Float, nil] Total workflow execution timeout in seconds including retries and continue
|
195
216
|
# as new.
|
196
217
|
# @param run_timeout [Float, nil] Timeout of a single workflow run in seconds.
|
@@ -207,6 +228,13 @@ module Temporalio
|
|
207
228
|
# with `cron_schedule`.
|
208
229
|
# @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
|
209
230
|
# server to start it on a local worker running with this same client. This is currently experimental.
|
231
|
+
# @param versioning_override [VersioningOverride, nil] Override the version of the workflow.
|
232
|
+
# This is currently experimental.
|
233
|
+
# @param priority [Priority] Priority of the workflow. This is currently experimental.
|
234
|
+
# @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
|
235
|
+
# workflow definition has arg hints, those are used by default.
|
236
|
+
# @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
|
237
|
+
# definition has result hint, it is used by default.
|
210
238
|
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
211
239
|
#
|
212
240
|
# @return [WorkflowHandle] A workflow handle to the started workflow.
|
@@ -217,6 +245,8 @@ module Temporalio
|
|
217
245
|
*args,
|
218
246
|
id:,
|
219
247
|
task_queue:,
|
248
|
+
static_summary: nil,
|
249
|
+
static_details: nil,
|
220
250
|
execution_timeout: nil,
|
221
251
|
run_timeout: nil,
|
222
252
|
task_timeout: nil,
|
@@ -228,13 +258,22 @@ module Temporalio
|
|
228
258
|
search_attributes: nil,
|
229
259
|
start_delay: nil,
|
230
260
|
request_eager_start: false,
|
261
|
+
versioning_override: nil,
|
262
|
+
priority: Priority.default,
|
263
|
+
arg_hints: nil,
|
264
|
+
result_hint: nil,
|
231
265
|
rpc_options: nil
|
232
266
|
)
|
267
|
+
# Take hints from definition if there is a definition
|
268
|
+
workflow, defn_arg_hints, defn_result_hint =
|
269
|
+
Workflow::Definition._workflow_type_and_hints_from_workflow_parameter(workflow)
|
233
270
|
@impl.start_workflow(Interceptor::StartWorkflowInput.new(
|
234
271
|
workflow:,
|
235
272
|
args:,
|
236
273
|
workflow_id: id,
|
237
274
|
task_queue:,
|
275
|
+
static_summary:,
|
276
|
+
static_details:,
|
238
277
|
execution_timeout:,
|
239
278
|
run_timeout:,
|
240
279
|
task_timeout:,
|
@@ -247,6 +286,10 @@ module Temporalio
|
|
247
286
|
start_delay:,
|
248
287
|
request_eager_start:,
|
249
288
|
headers: {},
|
289
|
+
versioning_override:,
|
290
|
+
priority:,
|
291
|
+
arg_hints: arg_hints || defn_arg_hints,
|
292
|
+
result_hint: result_hint || defn_result_hint,
|
250
293
|
rpc_options:
|
251
294
|
))
|
252
295
|
end
|
@@ -257,6 +300,12 @@ module Temporalio
|
|
257
300
|
# @param args [Array<Object>] Arguments to the workflow.
|
258
301
|
# @param id [String] Unique identifier for the workflow execution.
|
259
302
|
# @param task_queue [String] Task queue to run the workflow on.
|
303
|
+
# @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear in
|
304
|
+
# CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
|
305
|
+
# @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can
|
306
|
+
# be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
|
307
|
+
# updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is currently
|
308
|
+
# experimental.
|
260
309
|
# @param execution_timeout [Float, nil] Total workflow execution timeout in seconds including retries and continue
|
261
310
|
# as new.
|
262
311
|
# @param run_timeout [Float, nil] Timeout of a single workflow run in seconds.
|
@@ -273,6 +322,13 @@ module Temporalio
|
|
273
322
|
# with `cron_schedule`.
|
274
323
|
# @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
|
275
324
|
# server to start it on a local worker running with this same client. This is currently experimental.
|
325
|
+
# @param versioning_override [VersioningOverride, nil] Override the version of the workflow.
|
326
|
+
# This is currently experimental.
|
327
|
+
# @param priority [Priority] Priority for the workflow. This is currently experimental.
|
328
|
+
# @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
|
329
|
+
# workflow definition has arg hints, those are used by default.
|
330
|
+
# @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
|
331
|
+
# definition has result hint, it is used by default.
|
276
332
|
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
277
333
|
#
|
278
334
|
# @return [Object] Successful result of the workflow.
|
@@ -284,6 +340,8 @@ module Temporalio
|
|
284
340
|
*args,
|
285
341
|
id:,
|
286
342
|
task_queue:,
|
343
|
+
static_summary: nil,
|
344
|
+
static_details: nil,
|
287
345
|
execution_timeout: nil,
|
288
346
|
run_timeout: nil,
|
289
347
|
task_timeout: nil,
|
@@ -295,6 +353,10 @@ module Temporalio
|
|
295
353
|
search_attributes: nil,
|
296
354
|
start_delay: nil,
|
297
355
|
request_eager_start: false,
|
356
|
+
versioning_override: nil,
|
357
|
+
priority: Priority.default,
|
358
|
+
arg_hints: nil,
|
359
|
+
result_hint: nil,
|
298
360
|
rpc_options: nil
|
299
361
|
)
|
300
362
|
start_workflow(
|
@@ -302,6 +364,8 @@ module Temporalio
|
|
302
364
|
*args,
|
303
365
|
id:,
|
304
366
|
task_queue:,
|
367
|
+
static_summary:,
|
368
|
+
static_details:,
|
305
369
|
execution_timeout:,
|
306
370
|
run_timeout:,
|
307
371
|
task_timeout:,
|
@@ -313,6 +377,10 @@ module Temporalio
|
|
313
377
|
search_attributes:,
|
314
378
|
start_delay:,
|
315
379
|
request_eager_start:,
|
380
|
+
versioning_override:,
|
381
|
+
priority:,
|
382
|
+
arg_hints:,
|
383
|
+
result_hint:,
|
316
384
|
rpc_options:
|
317
385
|
).result
|
318
386
|
end
|
@@ -324,14 +392,140 @@ module Temporalio
|
|
324
392
|
# interactions occur on the latest of the workflow ID.
|
325
393
|
# @param first_execution_run_id [String, nil] First execution run ID used for some calls like cancellation and
|
326
394
|
# termination to ensure the affected workflow is only within the same chain as this given run ID.
|
395
|
+
# @param result_hint [Object, nil] Converter hint for the workflow's result.
|
327
396
|
#
|
328
397
|
# @return [WorkflowHandle] The workflow handle.
|
329
398
|
def workflow_handle(
|
330
399
|
workflow_id,
|
331
400
|
run_id: nil,
|
332
|
-
first_execution_run_id: nil
|
401
|
+
first_execution_run_id: nil,
|
402
|
+
result_hint: nil
|
403
|
+
)
|
404
|
+
WorkflowHandle.new(
|
405
|
+
client: self, id: workflow_id, run_id:, result_run_id: run_id, first_execution_run_id:, result_hint:
|
406
|
+
)
|
407
|
+
end
|
408
|
+
|
409
|
+
# Start an update, possibly starting the workflow at the same time if it doesn't exist (depending upon ID conflict
|
410
|
+
# policy). Note that in some cases this may fail but the workflow will still be started, and the handle can then be
|
411
|
+
# retrieved on the start workflow operation.
|
412
|
+
#
|
413
|
+
# @param update [Workflow::Definition::Update, Symbol, String] Update definition or name.
|
414
|
+
# @param args [Array<Object>] Update arguments.
|
415
|
+
# @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This must
|
416
|
+
# have an `id_conflict_policy` set.
|
417
|
+
# @param wait_for_stage [WorkflowUpdateWaitStage] Required stage to wait until returning. ADMITTED is not
|
418
|
+
# currently supported. See https://docs.temporal.io/workflows#update for more details.
|
419
|
+
# @param id [String] ID of the update.
|
420
|
+
# @param arg_hints [Array<Object>, nil] Overrides converter hints for update arguments if any. If unset/nil and the
|
421
|
+
# update definition has arg hints, those are used by default.
|
422
|
+
# @param result_hint [Object, nil] Overrides converter hint for update result if any. If unset/nil and the update
|
423
|
+
# definition has result hint, it is used by default.
|
424
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
425
|
+
#
|
426
|
+
# @return [WorkflowUpdateHandle] The update handle.
|
427
|
+
# @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
|
428
|
+
# @raise [Error::WorkflowUpdateRPCTimeoutOrCanceledError] This update call timed out or was canceled. This doesn't
|
429
|
+
# mean the update itself was timed out or canceled, and this doesn't mean the workflow did not start.
|
430
|
+
# @raise [Error::RPCError] RPC error from call.
|
431
|
+
def start_update_with_start_workflow(
|
432
|
+
update,
|
433
|
+
*args,
|
434
|
+
start_workflow_operation:,
|
435
|
+
wait_for_stage:,
|
436
|
+
id: SecureRandom.uuid,
|
437
|
+
arg_hints: nil,
|
438
|
+
result_hint: nil,
|
439
|
+
rpc_options: nil
|
440
|
+
)
|
441
|
+
update, defn_arg_hints, defn_result_hint = Workflow::Definition::Update._name_and_hints_from_parameter(update)
|
442
|
+
@impl.start_update_with_start_workflow(
|
443
|
+
Interceptor::StartUpdateWithStartWorkflowInput.new(
|
444
|
+
update_id: id,
|
445
|
+
update:,
|
446
|
+
args:,
|
447
|
+
wait_for_stage:,
|
448
|
+
start_workflow_operation:,
|
449
|
+
arg_hints: arg_hints || defn_arg_hints,
|
450
|
+
result_hint: result_hint || defn_result_hint,
|
451
|
+
headers: {},
|
452
|
+
rpc_options:
|
453
|
+
)
|
454
|
+
)
|
455
|
+
end
|
456
|
+
|
457
|
+
# Start an update, possibly starting the workflow at the same time if it doesn't exist (depending upon ID conflict
|
458
|
+
# policy), and wait for update result. This is a shortcut for {start_update_with_start_workflow} +
|
459
|
+
# {WorkflowUpdateHandle.result}.
|
460
|
+
#
|
461
|
+
# @param update [Workflow::Definition::Update, Symbol, String] Update definition or name.
|
462
|
+
# @param args [Array<Object>] Update arguments.
|
463
|
+
# @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This must
|
464
|
+
# have an `id_conflict_policy` set.
|
465
|
+
# @param id [String] ID of the update.
|
466
|
+
# @param arg_hints [Array<Object>, nil] Overrides converter hints for update arguments if any. If unset/nil and the
|
467
|
+
# update definition has arg hints, those are used by default.
|
468
|
+
# @param result_hint [Object, nil] Overrides converter hint for update result if any. If unset/nil and the update
|
469
|
+
# definition has result hint, it is used by default.
|
470
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
471
|
+
#
|
472
|
+
# @return [Object] Successful update result.
|
473
|
+
# @raise [Error::WorkflowUpdateFailedError] If the update failed.
|
474
|
+
# @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
|
475
|
+
# @raise [Error::WorkflowUpdateRPCTimeoutOrCanceledError] This update call timed out or was canceled. This doesn't
|
476
|
+
# mean the update itself was timed out or canceled, and this doesn't mean the workflow did not start.
|
477
|
+
# @raise [Error::RPCError] RPC error from call.
|
478
|
+
def execute_update_with_start_workflow(
|
479
|
+
update,
|
480
|
+
*args,
|
481
|
+
start_workflow_operation:,
|
482
|
+
id: SecureRandom.uuid,
|
483
|
+
arg_hints: nil,
|
484
|
+
result_hint: nil,
|
485
|
+
rpc_options: nil
|
486
|
+
)
|
487
|
+
start_update_with_start_workflow(
|
488
|
+
update,
|
489
|
+
*args,
|
490
|
+
start_workflow_operation:,
|
491
|
+
wait_for_stage: WorkflowUpdateWaitStage::COMPLETED,
|
492
|
+
id:,
|
493
|
+
arg_hints:,
|
494
|
+
result_hint:,
|
495
|
+
rpc_options:
|
496
|
+
).result
|
497
|
+
end
|
498
|
+
|
499
|
+
# Send a signal, possibly starting the workflow at the same time if it doesn't exist.
|
500
|
+
#
|
501
|
+
# @param signal [Workflow::Definition::Signal, Symbol, String] Signal definition or name.
|
502
|
+
# @param args [Array<Object>] Signal arguments.
|
503
|
+
# @param start_workflow_operation [WithStartWorkflowOperation] Required with-start workflow operation. This may not
|
504
|
+
# support all `id_conflict_policy` options.
|
505
|
+
# @param arg_hints [Array<Object>, nil] Overrides converter hints for signal arguments if any. If unset/nil and the
|
506
|
+
# signal definition has arg hints, those are used by default.
|
507
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
508
|
+
#
|
509
|
+
# @return [WorkflowHandle] A workflow handle to the workflow.
|
510
|
+
# @raise [Error::WorkflowAlreadyStartedError] Workflow already exists and conflict/reuse policy does not allow.
|
511
|
+
# @raise [Error::RPCError] RPC error from call.
|
512
|
+
def signal_with_start_workflow(
|
513
|
+
signal,
|
514
|
+
*args,
|
515
|
+
start_workflow_operation:,
|
516
|
+
arg_hints: nil,
|
517
|
+
rpc_options: nil
|
333
518
|
)
|
334
|
-
|
519
|
+
signal, defn_arg_hints = Workflow::Definition::Signal._name_and_hints_from_parameter(signal)
|
520
|
+
@impl.signal_with_start_workflow(
|
521
|
+
Interceptor::SignalWithStartWorkflowInput.new(
|
522
|
+
signal:,
|
523
|
+
args:,
|
524
|
+
start_workflow_operation:,
|
525
|
+
arg_hints: arg_hints || defn_arg_hints,
|
526
|
+
rpc_options:
|
527
|
+
)
|
528
|
+
)
|
335
529
|
end
|
336
530
|
|
337
531
|
# List workflows.
|
@@ -345,7 +539,40 @@ module Temporalio
|
|
345
539
|
#
|
346
540
|
# @see https://docs.temporal.io/visibility
|
347
541
|
def list_workflows(query = nil, rpc_options: nil)
|
348
|
-
|
542
|
+
next_page_token = nil
|
543
|
+
Enumerator.new do |yielder|
|
544
|
+
loop do
|
545
|
+
list_workflow_page_input = Interceptor::ListWorkflowPageInput.new(
|
546
|
+
query: query,
|
547
|
+
rpc_options: rpc_options,
|
548
|
+
next_page_token: next_page_token,
|
549
|
+
page_size: nil
|
550
|
+
)
|
551
|
+
page = @impl.list_workflow_page(list_workflow_page_input)
|
552
|
+
page.executions.each { |execution| yielder << execution }
|
553
|
+
next_page_token = page.next_page_token
|
554
|
+
break if (next_page_token || '').empty?
|
555
|
+
end
|
556
|
+
end
|
557
|
+
end
|
558
|
+
|
559
|
+
# List workflows one page at a time.
|
560
|
+
#
|
561
|
+
# @param query [String, nil] A Temporal visibility list filter.
|
562
|
+
# @param page_size [Integer, nil] Maximum number of results to return.
|
563
|
+
# @param next_page_token [String, nil] Token for the next page of results. If not set, the first page is returned.
|
564
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
565
|
+
#
|
566
|
+
# @return [ListWorkflowPage] Page of workflow executions, along with a next_page_token to keep fetching.
|
567
|
+
#
|
568
|
+
# @raise [Error::RPCError] RPC error from call.
|
569
|
+
#
|
570
|
+
# @see https://docs.temporal.io/visibility
|
571
|
+
def list_workflow_page(query = nil, page_size: nil, next_page_token: nil, rpc_options: nil)
|
572
|
+
@impl.list_workflow_page(Interceptor::ListWorkflowPageInput.new(query:,
|
573
|
+
next_page_token:,
|
574
|
+
page_size:,
|
575
|
+
rpc_options:))
|
349
576
|
end
|
350
577
|
|
351
578
|
# Count workflows.
|
@@ -38,4 +38,18 @@ module Temporalio
|
|
38
38
|
# Terminate the running workflow before starting a new one.
|
39
39
|
TERMINATE_EXISTING = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING
|
40
40
|
end
|
41
|
+
|
42
|
+
# Specifies when a workflow might move from a worker of one Build Id to another.
|
43
|
+
#
|
44
|
+
# WARNING: Experimental API.
|
45
|
+
module VersioningBehavior
|
46
|
+
# Unspecified versioning behavior. By default, workers opting into worker versioning will
|
47
|
+
# be required to specify a behavior.
|
48
|
+
UNSPECIFIED = Api::Enums::V1::VersioningBehavior::VERSIONING_BEHAVIOR_UNSPECIFIED
|
49
|
+
# The workflow will be pinned to the current Build ID unless manually moved.
|
50
|
+
PINNED = Api::Enums::V1::VersioningBehavior::VERSIONING_BEHAVIOR_PINNED
|
51
|
+
# The workflow will automatically move to the latest version (default Build ID of the task
|
52
|
+
# queue) when the next task is dispatched.
|
53
|
+
AUTO_UPGRADE = Api::Enums::V1::VersioningBehavior::VERSIONING_BEHAVIOR_AUTO_UPGRADE
|
54
|
+
end
|
41
55
|
end
|