temporalio 0.3.0-aarch64-linux → 0.5.0-aarch64-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.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +1 -1
  3. data/Gemfile +4 -0
  4. data/Rakefile +1 -1
  5. data/lib/temporalio/activity/cancellation_details.rb +58 -0
  6. data/lib/temporalio/activity/context.rb +23 -1
  7. data/lib/temporalio/activity/definition.rb +63 -8
  8. data/lib/temporalio/activity/info.rb +28 -4
  9. data/lib/temporalio/activity.rb +2 -0
  10. data/lib/temporalio/api/activity/v1/message.rb +1 -1
  11. data/lib/temporalio/api/batch/v1/message.rb +9 -2
  12. data/lib/temporalio/api/cloud/account/v1/message.rb +1 -1
  13. data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +11 -2
  14. data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +2 -2
  15. data/lib/temporalio/api/cloud/identity/v1/message.rb +7 -2
  16. data/lib/temporalio/api/cloud/namespace/v1/message.rb +6 -2
  17. data/lib/temporalio/api/cloud/nexus/v1/message.rb +3 -2
  18. data/lib/temporalio/api/cloud/operation/v1/message.rb +1 -1
  19. data/lib/temporalio/api/cloud/region/v1/message.rb +1 -1
  20. data/lib/temporalio/api/cloud/resource/v1/message.rb +1 -1
  21. data/lib/temporalio/api/cloud/sink/v1/message.rb +1 -1
  22. data/lib/temporalio/api/cloud/usage/v1/message.rb +1 -1
  23. data/lib/temporalio/api/command/v1/message.rb +2 -2
  24. data/lib/temporalio/api/common/v1/grpc_status.rb +1 -1
  25. data/lib/temporalio/api/common/v1/message.rb +4 -2
  26. data/lib/temporalio/api/deployment/v1/message.rb +39 -0
  27. data/lib/temporalio/api/enums/v1/batch_operation.rb +2 -2
  28. data/lib/temporalio/api/enums/v1/command_type.rb +1 -1
  29. data/lib/temporalio/api/enums/v1/common.rb +5 -2
  30. data/lib/temporalio/api/enums/v1/deployment.rb +24 -0
  31. data/lib/temporalio/api/enums/v1/event_type.rb +2 -2
  32. data/lib/temporalio/api/enums/v1/failed_cause.rb +2 -2
  33. data/lib/temporalio/api/enums/v1/namespace.rb +1 -1
  34. data/lib/temporalio/api/enums/v1/nexus.rb +21 -0
  35. data/lib/temporalio/api/enums/v1/query.rb +1 -1
  36. data/lib/temporalio/api/enums/v1/reset.rb +2 -2
  37. data/lib/temporalio/api/enums/v1/schedule.rb +1 -1
  38. data/lib/temporalio/api/enums/v1/task_queue.rb +1 -1
  39. data/lib/temporalio/api/enums/v1/update.rb +1 -1
  40. data/lib/temporalio/api/enums/v1/workflow.rb +3 -2
  41. data/lib/temporalio/api/errordetails/v1/message.rb +4 -2
  42. data/lib/temporalio/api/export/v1/message.rb +1 -1
  43. data/lib/temporalio/api/failure/v1/message.rb +5 -2
  44. data/lib/temporalio/api/filter/v1/message.rb +1 -1
  45. data/lib/temporalio/api/history/v1/message.rb +6 -2
  46. data/lib/temporalio/api/namespace/v1/message.rb +1 -1
  47. data/lib/temporalio/api/nexus/v1/message.rb +3 -2
  48. data/lib/temporalio/api/operatorservice/v1/request_response.rb +1 -1
  49. data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
  50. data/lib/temporalio/api/payload_visitor.rb +162 -7
  51. data/lib/temporalio/api/protocol/v1/message.rb +1 -1
  52. data/lib/temporalio/api/query/v1/message.rb +3 -2
  53. data/lib/temporalio/api/replication/v1/message.rb +1 -1
  54. data/lib/temporalio/api/rules/v1/message.rb +27 -0
  55. data/lib/temporalio/api/schedule/v1/message.rb +2 -2
  56. data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +1 -1
  57. data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +1 -1
  58. data/lib/temporalio/api/sdk/v1/user_metadata.rb +1 -1
  59. data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +1 -1
  60. data/lib/temporalio/api/taskqueue/v1/message.rb +5 -2
  61. data/lib/temporalio/api/testservice/v1/request_response.rb +1 -1
  62. data/lib/temporalio/api/testservice/v1/service.rb +1 -1
  63. data/lib/temporalio/api/update/v1/message.rb +1 -1
  64. data/lib/temporalio/api/version/v1/message.rb +1 -1
  65. data/lib/temporalio/api/worker/v1/message.rb +30 -0
  66. data/lib/temporalio/api/workflow/v1/message.rb +22 -2
  67. data/lib/temporalio/api/workflowservice/v1/request_response.rb +58 -12
  68. data/lib/temporalio/api/workflowservice/v1/service.rb +2 -2
  69. data/lib/temporalio/api.rb +1 -0
  70. data/lib/temporalio/client/async_activity_handle.rb +12 -4
  71. data/lib/temporalio/client/connection/cloud_service.rb +60 -0
  72. data/lib/temporalio/client/connection/workflow_service.rb +343 -28
  73. data/lib/temporalio/client/interceptor.rb +64 -7
  74. data/lib/temporalio/client/schedule.rb +35 -3
  75. data/lib/temporalio/client/with_start_workflow_operation.rb +123 -0
  76. data/lib/temporalio/client/workflow_execution.rb +19 -0
  77. data/lib/temporalio/client/workflow_handle.rb +47 -7
  78. data/lib/temporalio/client/workflow_update_handle.rb +9 -3
  79. data/lib/temporalio/client.rb +231 -4
  80. data/lib/temporalio/common_enums.rb +14 -0
  81. data/lib/temporalio/contrib/open_telemetry.rb +474 -0
  82. data/lib/temporalio/converters/data_converter.rb +18 -8
  83. data/lib/temporalio/converters/failure_converter.rb +6 -3
  84. data/lib/temporalio/converters/payload_converter/binary_null.rb +2 -2
  85. data/lib/temporalio/converters/payload_converter/binary_plain.rb +2 -2
  86. data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +2 -2
  87. data/lib/temporalio/converters/payload_converter/composite.rb +6 -4
  88. data/lib/temporalio/converters/payload_converter/encoding.rb +4 -2
  89. data/lib/temporalio/converters/payload_converter/json_plain.rb +2 -2
  90. data/lib/temporalio/converters/payload_converter/json_protobuf.rb +2 -2
  91. data/lib/temporalio/converters/payload_converter.rb +16 -6
  92. data/lib/temporalio/error/failure.rb +19 -1
  93. data/lib/temporalio/error.rb +2 -1
  94. data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.so +0 -0
  95. data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.so +0 -0
  96. data/lib/temporalio/internal/bridge/3.4/temporalio_bridge.so +0 -0
  97. data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +1 -1
  98. data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +3 -2
  99. data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +1 -1
  100. data/lib/temporalio/internal/bridge/api/common/common.rb +3 -2
  101. data/lib/temporalio/internal/bridge/api/core_interface.rb +1 -1
  102. data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +1 -1
  103. data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +3 -2
  104. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +2 -2
  105. data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +3 -2
  106. data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +3 -2
  107. data/lib/temporalio/internal/bridge/runtime.rb +3 -0
  108. data/lib/temporalio/internal/bridge/testing.rb +3 -0
  109. data/lib/temporalio/internal/bridge/worker.rb +28 -4
  110. data/lib/temporalio/internal/bridge.rb +1 -1
  111. data/lib/temporalio/internal/client/implementation.rb +281 -51
  112. data/lib/temporalio/internal/proto_utils.rb +38 -6
  113. data/lib/temporalio/internal/worker/activity_worker.rb +112 -27
  114. data/lib/temporalio/internal/worker/multi_runner.rb +2 -2
  115. data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +8 -6
  116. data/lib/temporalio/internal/worker/workflow_instance/context.rb +100 -5
  117. data/lib/temporalio/internal/worker/workflow_instance/details.rb +7 -2
  118. data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +2 -2
  119. data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +64 -18
  120. data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +39 -40
  121. data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +22 -2
  122. data/lib/temporalio/internal/worker/workflow_instance.rb +134 -55
  123. data/lib/temporalio/internal/worker/workflow_worker.rb +74 -21
  124. data/lib/temporalio/priority.rb +59 -0
  125. data/lib/temporalio/runtime/metric_buffer.rb +94 -0
  126. data/lib/temporalio/runtime.rb +48 -10
  127. data/lib/temporalio/search_attributes.rb +13 -0
  128. data/lib/temporalio/testing/activity_environment.rb +59 -16
  129. data/lib/temporalio/testing/workflow_environment.rb +29 -6
  130. data/lib/temporalio/version.rb +1 -1
  131. data/lib/temporalio/versioning_override.rb +56 -0
  132. data/lib/temporalio/worker/deployment_options.rb +45 -0
  133. data/lib/temporalio/worker/illegal_workflow_call_validator.rb +64 -0
  134. data/lib/temporalio/worker/interceptor.rb +16 -1
  135. data/lib/temporalio/worker/poller_behavior.rb +61 -0
  136. data/lib/temporalio/worker/thread_pool.rb +6 -6
  137. data/lib/temporalio/worker/tuner.rb +38 -0
  138. data/lib/temporalio/worker/workflow_executor/thread_pool.rb +14 -8
  139. data/lib/temporalio/worker/workflow_executor.rb +1 -1
  140. data/lib/temporalio/worker/workflow_replayer.rb +349 -0
  141. data/lib/temporalio/worker.rb +117 -75
  142. data/lib/temporalio/worker_deployment_version.rb +67 -0
  143. data/lib/temporalio/workflow/child_workflow_handle.rb +10 -2
  144. data/lib/temporalio/workflow/definition.rb +217 -35
  145. data/lib/temporalio/workflow/external_workflow_handle.rb +3 -1
  146. data/lib/temporalio/workflow/future.rb +2 -2
  147. data/lib/temporalio/workflow/info.rb +26 -1
  148. data/lib/temporalio/workflow.rb +119 -15
  149. data/lib/temporalio/workflow_history.rb +26 -1
  150. data/lib/temporalio.rb +1 -0
  151. data/temporalio.gemspec +3 -1
  152. metadata +34 -4
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'random/formatter'
4
4
  require 'temporalio/error'
5
+ require 'temporalio/priority'
5
6
  require 'temporalio/workflow/activity_cancellation_type'
6
7
  require 'temporalio/workflow/child_workflow_cancellation_type'
7
8
  require 'temporalio/workflow/child_workflow_handle'
@@ -38,6 +39,36 @@ module Temporalio
38
39
  _current.continue_as_new_suggested
39
40
  end
40
41
 
42
+ # Get current details for this workflow that may appear in UI/CLI. Unlike static details set at start, this value
43
+ # can be updated throughout the life of the workflow. This can be in Temporal markdown format and can span multiple
44
+ # lines. This is currently experimental.
45
+ #
46
+ # @return [String] Current details. Default is empty string.
47
+ def self.current_details
48
+ _current.current_details
49
+ end
50
+
51
+ # Set current details for this workflow that may appear in UI/CLI. Unlike static details set at start, this value
52
+ # can be updated throughout the life of the workflow. This can be in Temporal markdown format and can span multiple
53
+ # lines. This is currently experimental.
54
+ #
55
+ # @param details [String] Current details. Can use empty string to unset.
56
+ def self.current_details=(details)
57
+ _current.current_details = details
58
+ end
59
+
60
+ # Get the deployment version of the worker which executed the current Workflow Task.
61
+ #
62
+ # May be nil if the task was completed by a worker without a deployment version or build id. If
63
+ # this worker is the one executing this task for the first time and has a deployment version
64
+ # set, then its ID will be used. This value may change over the lifetime of the workflow run,
65
+ # but is deterministic and safe to use for branching. This is currently experimental.
66
+ #
67
+ # @return [WorkerDeploymentVersion, nil] the current deployment version if any.
68
+ def self.current_deployment_version
69
+ _current.current_deployment_version
70
+ end
71
+
41
72
  # @return [Integer] Current number of events in history. This value is the current history event count up until the
42
73
  # current task. Note, this value may not be up to date when accessed in a query.
43
74
  def self.current_history_length
@@ -77,6 +108,8 @@ module Temporalio
77
108
  # @param activity [Class<Activity::Definition>, Symbol, String] Activity definition class or activity name.
78
109
  # @param args [Array<Object>] Arguments to the activity.
79
110
  # @param task_queue [String] Task queue to run the activity on. Defaults to the current workflow's task queue.
111
+ # @param summary [String, nil] Single-line summary for this activity that may appear in CLI/UI. This can be in
112
+ # single-line Temporal markdown format. This is currently experimental.
80
113
  # @param schedule_to_close_timeout [Float, nil] Max amount of time the activity can take from first being scheduled
81
114
  # to being completed before it times out. This is inclusive of all retries.
82
115
  # @param schedule_to_start_timeout [Float, nil] Max amount of time the activity can take to be started from first
@@ -98,6 +131,11 @@ module Temporalio
98
131
  # optimization on some servers that sends activities back to the same worker as the calling workflow if they can
99
132
  # run there. If `false` (the default), eager execution may still be disabled at the worker level or may not be
100
133
  # requested due to lack of available slots.
134
+ # @param priority [Priority] Priority of the activity. This is currently experimental.
135
+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
136
+ # activity definition has arg hints, those are used by default.
137
+ # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the activity
138
+ # definition has result hint, it is used by default.
101
139
  #
102
140
  # @return [Object] Result of the activity.
103
141
  # @raise [Error::ActivityError] Activity failed (and retry was disabled or exhausted).
@@ -107,6 +145,7 @@ module Temporalio
107
145
  activity,
108
146
  *args,
109
147
  task_queue: info.task_queue,
148
+ summary: nil,
110
149
  schedule_to_close_timeout: nil,
111
150
  schedule_to_start_timeout: nil,
112
151
  start_to_close_timeout: nil,
@@ -115,12 +154,16 @@ module Temporalio
115
154
  cancellation: Workflow.cancellation,
116
155
  cancellation_type: ActivityCancellationType::TRY_CANCEL,
117
156
  activity_id: nil,
118
- disable_eager_execution: false
157
+ disable_eager_execution: false,
158
+ priority: Priority.default,
159
+ arg_hints: nil,
160
+ result_hint: nil
119
161
  )
120
162
  _current.execute_activity(
121
163
  activity, *args,
122
- task_queue:, schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
123
- heartbeat_timeout:, retry_policy:, cancellation:, cancellation_type:, activity_id:, disable_eager_execution:
164
+ task_queue:, summary:, schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
165
+ heartbeat_timeout:, retry_policy:, cancellation:, cancellation_type:, activity_id:, disable_eager_execution:,
166
+ priority:, arg_hints:, result_hint:
124
167
  )
125
168
  end
126
169
 
@@ -130,6 +173,8 @@ module Temporalio
130
173
  *args,
131
174
  id: random.uuid,
132
175
  task_queue: info.task_queue,
176
+ static_summary: nil,
177
+ static_details: nil,
133
178
  cancellation: Workflow.cancellation,
134
179
  cancellation_type: ChildWorkflowCancellationType::WAIT_CANCELLATION_COMPLETED,
135
180
  parent_close_policy: ParentClosePolicy::TERMINATE,
@@ -140,12 +185,16 @@ module Temporalio
140
185
  retry_policy: nil,
141
186
  cron_schedule: nil,
142
187
  memo: nil,
143
- search_attributes: nil
188
+ search_attributes: nil,
189
+ priority: Priority.default,
190
+ arg_hints: nil,
191
+ result_hint: nil
144
192
  )
145
193
  start_child_workflow(
146
194
  workflow, *args,
147
- id:, task_queue:, cancellation:, cancellation_type:, parent_close_policy:, execution_timeout:, run_timeout:,
148
- task_timeout:, id_reuse_policy:, retry_policy:, cron_schedule:, memo:, search_attributes:
195
+ id:, task_queue:, static_summary:, static_details:, cancellation:, cancellation_type:,
196
+ parent_close_policy:, execution_timeout:, run_timeout:, task_timeout:, id_reuse_policy:,
197
+ retry_policy:, cron_schedule:, memo:, search_attributes:, priority:, arg_hints:, result_hint:
149
198
  ).result
150
199
  end
151
200
 
@@ -176,6 +225,10 @@ module Temporalio
176
225
  # workflow.
177
226
  # @param activity_id [String, nil] Optional unique identifier for the activity. This is an advanced setting that
178
227
  # should not be set unless users are sure they need to. Contact Temporal before setting this value.
228
+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
229
+ # activity definition has arg hints, those are used by default.
230
+ # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the activity
231
+ # definition has result hint, it is used by default.
179
232
  #
180
233
  # @return [Object] Result of the activity.
181
234
  # @raise [Error::ActivityError] Activity failed (and retry was disabled or exhausted).
@@ -191,12 +244,15 @@ module Temporalio
191
244
  local_retry_threshold: nil,
192
245
  cancellation: Workflow.cancellation,
193
246
  cancellation_type: ActivityCancellationType::TRY_CANCEL,
194
- activity_id: nil
247
+ activity_id: nil,
248
+ arg_hints: nil,
249
+ result_hint: nil
195
250
  )
196
251
  _current.execute_local_activity(
197
252
  activity, *args,
198
253
  schedule_to_close_timeout:, schedule_to_start_timeout:, start_to_close_timeout:,
199
- retry_policy:, local_retry_threshold:, cancellation:, cancellation_type:, activity_id:
254
+ retry_policy:, local_retry_threshold:, cancellation:, cancellation_type:,
255
+ activity_id:, arg_hints:, result_hint:
200
256
  )
201
257
  end
202
258
 
@@ -220,6 +276,12 @@ module Temporalio
220
276
  _current.info
221
277
  end
222
278
 
279
+ # @return [Definition, nil] Workflow class instance. This should always be present except in
280
+ # {Worker::Interceptor::Workflow::Inbound.init} where it will be nil.
281
+ def self.instance
282
+ _current.instance
283
+ end
284
+
223
285
  # @return [Logger] Logger for the workflow. This is a scoped logger that automatically appends workflow details to
224
286
  # every log and takes care not to log during replay.
225
287
  def self.logger
@@ -298,7 +360,7 @@ module Temporalio
298
360
  # value cannot be negative. Since Temporal timers are server-side, timer resolution may not end up as precise as
299
361
  # system timers.
300
362
  # @param summary [String, nil] A simple string identifying this timer that may be visible in UI/CLI. While it can be
301
- # normal text, it is best to treat as a timer ID.
363
+ # normal text, it is best to treat as a timer ID. This is currently experimental.
302
364
  # @param cancellation [Cancellation] Cancellation for this timer.
303
365
  # @raise [Error::CanceledError] Sleep canceled.
304
366
  def self.sleep(duration, summary: nil, cancellation: Workflow.cancellation)
@@ -311,6 +373,12 @@ module Temporalio
311
373
  # @param args [Array<Object>] Arguments to the workflow.
312
374
  # @param id [String] Unique identifier for the workflow execution. Defaults to a new UUID from {random}.
313
375
  # @param task_queue [String] Task queue to run the workflow on. Defaults to the current workflow's task queue.
376
+ # @param static_summary [String, nil] Fixed single-line summary for this workflow execution that may appear in
377
+ # CLI/UI. This can be in single-line Temporal markdown format. This is currently experimental.
378
+ # @param static_details [String, nil] Fixed details for this workflow execution that may appear in CLI/UI. This can
379
+ # be in Temporal markdown format and can be multiple lines. This is a fixed value on the workflow that cannot be
380
+ # updated. For details that can be updated, use {Workflow.current_details=} within the workflow. This is currently
381
+ # experimental.
314
382
  # @param cancellation [Cancellation] Cancellation to apply to the child workflow. How cancellation is treated is
315
383
  # based on `cancellation_type`. This defaults to the workflow's cancellation.
316
384
  # @param cancellation_type [ChildWorkflowCancellationType] How the child workflow will react to cancellation.
@@ -324,6 +392,11 @@ module Temporalio
324
392
  # @param cron_schedule [String, nil] Cron schedule. Users should use schedules instead of this.
325
393
  # @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow.
326
394
  # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
395
+ # @param priority [Priority] Priority of the workflow. This is currently experimental.
396
+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
397
+ # workflow definition has arg hints, those are used by default.
398
+ # @param result_hint [Object, nil] Overrides converter hint for result if any. If unset/nil and the workflow
399
+ # definition has result hint, it is used by default.
327
400
  #
328
401
  # @return [ChildWorkflowHandle] Workflow handle to the started workflow.
329
402
  # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists for the ID.
@@ -333,6 +406,8 @@ module Temporalio
333
406
  *args,
334
407
  id: random.uuid,
335
408
  task_queue: info.task_queue,
409
+ static_summary: nil,
410
+ static_details: nil,
336
411
  cancellation: Workflow.cancellation,
337
412
  cancellation_type: ChildWorkflowCancellationType::WAIT_CANCELLATION_COMPLETED,
338
413
  parent_close_policy: ParentClosePolicy::TERMINATE,
@@ -343,15 +418,25 @@ module Temporalio
343
418
  retry_policy: nil,
344
419
  cron_schedule: nil,
345
420
  memo: nil,
346
- search_attributes: nil
421
+ search_attributes: nil,
422
+ priority: Priority.default,
423
+ arg_hints: nil,
424
+ result_hint: nil
347
425
  )
348
426
  _current.start_child_workflow(
349
427
  workflow, *args,
350
- id:, task_queue:, cancellation:, cancellation_type:, parent_close_policy:, execution_timeout:, run_timeout:,
351
- task_timeout:, id_reuse_policy:, retry_policy:, cron_schedule:, memo:, search_attributes:
428
+ id:, task_queue:, static_summary:, static_details:, cancellation:, cancellation_type:,
429
+ parent_close_policy:, execution_timeout:, run_timeout:, task_timeout:, id_reuse_policy:,
430
+ retry_policy:, cron_schedule:, memo:, search_attributes:, priority:, arg_hints:, result_hint:
352
431
  )
353
432
  end
354
433
 
434
+ # @return [Hash<Object, Object>] General in-workflow storage. Most users will store state on the workflow class
435
+ # instance instead, this is only for utilities without access to the class instance.
436
+ def self.storage
437
+ _current.storage
438
+ end
439
+
355
440
  # Run the block until the timeout is reached. This is backed by {sleep}. This does not accept cancellation because
356
441
  # it is expected the block within will properly handle/bubble cancellation.
357
442
  #
@@ -361,8 +446,8 @@ module Temporalio
361
446
  # exception.
362
447
  # @param message [String] Message to use for timeout exception. Defaults to "execution expired" like
363
448
  # {::Timeout.timeout}.
364
- # @param summary [String] Timer summer for the timer created by this timeout. This is backed by {sleep} so see that
365
- # method for details.
449
+ # @param summary [String] Timer summary for the timer created by this timeout. This is backed by {sleep} so see that
450
+ # method for details. This is currently experimental.
366
451
  #
367
452
  # @yield Block to run with a timeout.
368
453
  # @return [Object] The result of the block.
@@ -458,12 +543,27 @@ module Temporalio
458
543
  def self.illegal_call_tracing_disabled(&)
459
544
  Workflow._current.illegal_call_tracing_disabled(&)
460
545
  end
546
+
547
+ # Run a block of code with IO enabled. Specifically this allows the `io_wait` call of the fiber scheduler to work.
548
+ # Users should be cautious about using this as it can often signify unsafe code. Note, this is often only
549
+ # applicable to network code as file IO and most process-based IO does not go through scheduler `io_wait`.
550
+ def self.io_enabled(&)
551
+ Workflow._current.io_enabled(&)
552
+ end
553
+
554
+ # Run a block of code with the durable/deterministic workflow Fiber scheduler off. This means fallback to default
555
+ # fiber scheduler and no workflow helpers will be available in the block. This is usually only needed in advanced
556
+ # situations where a third party library does something like use "Timeout" in a way that shouldn't be made
557
+ # durable.
558
+ def self.durable_scheduler_disabled(&)
559
+ Workflow._current.durable_scheduler_disabled(&)
560
+ end
461
561
  end
462
562
 
463
563
  # Error that is raised by a workflow out of the primary workflow method to issue a continue-as-new.
464
564
  class ContinueAsNewError < Error
465
565
  attr_accessor :args, :workflow, :task_queue, :run_timeout, :task_timeout,
466
- :retry_policy, :memo, :search_attributes, :headers
566
+ :retry_policy, :memo, :search_attributes, :arg_hints, :headers
467
567
 
468
568
  # Create a continue as new error.
469
569
  #
@@ -482,6 +582,8 @@ module Temporalio
482
582
  # is used.
483
583
  # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow. If unset/nil, the current
484
584
  # workflow search attributes are used.
585
+ # @param arg_hints [Array<Object>, nil] Overrides converter hints for arguments if any. If unset/nil and the
586
+ # workflow definition has arg hints, those are used by default.
485
587
  # @param headers [Hash<String, Object>] Headers for the workflow. The default is _not_ carried over from the
486
588
  # current workflow.
487
589
  def initialize(
@@ -493,6 +595,7 @@ module Temporalio
493
595
  retry_policy: nil,
494
596
  memo: nil,
495
597
  search_attributes: nil,
598
+ arg_hints: nil,
496
599
  headers: {}
497
600
  )
498
601
  super('Continue as new')
@@ -504,6 +607,7 @@ module Temporalio
504
607
  @retry_policy = retry_policy
505
608
  @memo = memo
506
609
  @search_attributes = search_attributes
610
+ @arg_hints = arg_hints
507
611
  @headers = headers
508
612
  Workflow._current.initialize_continue_as_new_error(self)
509
613
  end
@@ -1,9 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'temporalio/api'
4
+
3
5
  module Temporalio
4
6
  # Representation of a workflow's history.
5
7
  class WorkflowHistory
6
- # History events for the workflow.
8
+ # Convert a JSON string to workflow history. This supports the JSON format exported by Temporal UI and CLI.
9
+ #
10
+ # @param json [String] JSON string.
11
+ # @return [WorkflowHistory] Converted history.
12
+ def self.from_history_json(json)
13
+ WorkflowHistory.new(Api::History::V1::History.decode_json(json).events.to_a)
14
+ end
15
+
16
+ # @return [Array<Api::History::V1::HistoryEvent>] History events for the workflow.
7
17
  attr_reader :events
8
18
 
9
19
  # @!visibility private
@@ -18,5 +28,20 @@ module Temporalio
18
28
 
19
29
  start.workflow_id
20
30
  end
31
+
32
+ # Convert to history JSON.
33
+ #
34
+ # @return [String] JSON string.
35
+ def to_history_json
36
+ Api::History::V1::History.encode_json(Api::History::V1::History.new(events:))
37
+ end
38
+
39
+ # Compare history.
40
+ #
41
+ # @param other [WorkflowHistory] Other history.
42
+ # @return [Boolean] True if equal.
43
+ def ==(other)
44
+ other.is_a?(WorkflowHistory) && events == other.events
45
+ end
21
46
  end
22
47
  end
data/lib/temporalio.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'temporalio/version'
4
+ require 'temporalio/versioning_override'
4
5
 
5
6
  # Temporal Ruby SDK. See the README at https://github.com/temporalio/sdk-ruby.
6
7
  module Temporalio
data/temporalio.gemspec CHANGED
@@ -23,6 +23,8 @@ Gem::Specification.new do |spec|
23
23
  spec.require_paths = ['lib']
24
24
  spec.extensions = ['ext/Cargo.toml']
25
25
  spec.metadata['rubygems_mfa_required'] = 'true'
26
+ spec.required_ruby_version = '>= 3.2.0'
26
27
 
27
- spec.add_dependency 'google-protobuf', '>= 3.27.0'
28
+ spec.add_dependency 'google-protobuf', '>= 3.25.0'
29
+ spec.add_dependency 'logger'
28
30
  end
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: 0.3.0
4
+ version: 0.5.0
5
5
  platform: aarch64-linux
6
6
  authors:
7
7
  - Temporal Technologies Inc
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-01-22 00:00:00.000000000 Z
11
+ date: 2025-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-protobuf
@@ -16,14 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 3.27.0
19
+ version: 3.25.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 3.27.0
26
+ version: 3.25.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: logger
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
27
41
  description:
28
42
  email:
29
43
  - sdk@temporal.io
@@ -36,6 +50,7 @@ files:
36
50
  - Rakefile
37
51
  - lib/temporalio.rb
38
52
  - lib/temporalio/activity.rb
53
+ - lib/temporalio/activity/cancellation_details.rb
39
54
  - lib/temporalio/activity/complete_async_error.rb
40
55
  - lib/temporalio/activity/context.rb
41
56
  - lib/temporalio/activity/definition.rb
@@ -58,12 +73,15 @@ files:
58
73
  - lib/temporalio/api/command/v1/message.rb
59
74
  - lib/temporalio/api/common/v1/grpc_status.rb
60
75
  - lib/temporalio/api/common/v1/message.rb
76
+ - lib/temporalio/api/deployment/v1/message.rb
61
77
  - lib/temporalio/api/enums/v1/batch_operation.rb
62
78
  - lib/temporalio/api/enums/v1/command_type.rb
63
79
  - lib/temporalio/api/enums/v1/common.rb
80
+ - lib/temporalio/api/enums/v1/deployment.rb
64
81
  - lib/temporalio/api/enums/v1/event_type.rb
65
82
  - lib/temporalio/api/enums/v1/failed_cause.rb
66
83
  - lib/temporalio/api/enums/v1/namespace.rb
84
+ - lib/temporalio/api/enums/v1/nexus.rb
67
85
  - lib/temporalio/api/enums/v1/query.rb
68
86
  - lib/temporalio/api/enums/v1/reset.rb
69
87
  - lib/temporalio/api/enums/v1/schedule.rb
@@ -84,6 +102,7 @@ files:
84
102
  - lib/temporalio/api/protocol/v1/message.rb
85
103
  - lib/temporalio/api/query/v1/message.rb
86
104
  - lib/temporalio/api/replication/v1/message.rb
105
+ - lib/temporalio/api/rules/v1/message.rb
87
106
  - lib/temporalio/api/schedule/v1/message.rb
88
107
  - lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb
89
108
  - lib/temporalio/api/sdk/v1/task_complete_metadata.rb
@@ -94,6 +113,7 @@ files:
94
113
  - lib/temporalio/api/testservice/v1/service.rb
95
114
  - lib/temporalio/api/update/v1/message.rb
96
115
  - lib/temporalio/api/version/v1/message.rb
116
+ - lib/temporalio/api/worker/v1/message.rb
97
117
  - lib/temporalio/api/workflow/v1/message.rb
98
118
  - lib/temporalio/api/workflowservice.rb
99
119
  - lib/temporalio/api/workflowservice/v1/request_response.rb
@@ -111,6 +131,7 @@ files:
111
131
  - lib/temporalio/client/interceptor.rb
112
132
  - lib/temporalio/client/schedule.rb
113
133
  - lib/temporalio/client/schedule_handle.rb
134
+ - lib/temporalio/client/with_start_workflow_operation.rb
114
135
  - lib/temporalio/client/workflow_execution.rb
115
136
  - lib/temporalio/client/workflow_execution_count.rb
116
137
  - lib/temporalio/client/workflow_execution_status.rb
@@ -119,6 +140,7 @@ files:
119
140
  - lib/temporalio/client/workflow_update_handle.rb
120
141
  - lib/temporalio/client/workflow_update_wait_stage.rb
121
142
  - lib/temporalio/common_enums.rb
143
+ - lib/temporalio/contrib/open_telemetry.rb
122
144
  - lib/temporalio/converters.rb
123
145
  - lib/temporalio/converters/data_converter.rb
124
146
  - lib/temporalio/converters/failure_converter.rb
@@ -175,23 +197,31 @@ files:
175
197
  - lib/temporalio/internal/worker/workflow_instance/scheduler.rb
176
198
  - lib/temporalio/internal/worker/workflow_worker.rb
177
199
  - lib/temporalio/metric.rb
200
+ - lib/temporalio/priority.rb
178
201
  - lib/temporalio/retry_policy.rb
179
202
  - lib/temporalio/runtime.rb
203
+ - lib/temporalio/runtime/metric_buffer.rb
180
204
  - lib/temporalio/scoped_logger.rb
181
205
  - lib/temporalio/search_attributes.rb
182
206
  - lib/temporalio/testing.rb
183
207
  - lib/temporalio/testing/activity_environment.rb
184
208
  - lib/temporalio/testing/workflow_environment.rb
185
209
  - lib/temporalio/version.rb
210
+ - lib/temporalio/versioning_override.rb
186
211
  - lib/temporalio/worker.rb
187
212
  - lib/temporalio/worker/activity_executor.rb
188
213
  - lib/temporalio/worker/activity_executor/fiber.rb
189
214
  - lib/temporalio/worker/activity_executor/thread_pool.rb
215
+ - lib/temporalio/worker/deployment_options.rb
216
+ - lib/temporalio/worker/illegal_workflow_call_validator.rb
190
217
  - lib/temporalio/worker/interceptor.rb
218
+ - lib/temporalio/worker/poller_behavior.rb
191
219
  - lib/temporalio/worker/thread_pool.rb
192
220
  - lib/temporalio/worker/tuner.rb
193
221
  - lib/temporalio/worker/workflow_executor.rb
194
222
  - lib/temporalio/worker/workflow_executor/thread_pool.rb
223
+ - lib/temporalio/worker/workflow_replayer.rb
224
+ - lib/temporalio/worker_deployment_version.rb
195
225
  - lib/temporalio/workflow.rb
196
226
  - lib/temporalio/workflow/activity_cancellation_type.rb
197
227
  - lib/temporalio/workflow/child_workflow_cancellation_type.rb