temporalio 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 268dababab1b3104d90484a92d2b31cf2716c0ccf8e174b86f957d7e78a7dc34
4
- data.tar.gz: 4ac90452d338cda2967b8ab88f9fac481dc92a6ec8aa740be539067c9a5e07da
3
+ metadata.gz: eab42914a8505489221304731b5e794855699374913e2ceda6b37dc446d175b7
4
+ data.tar.gz: ec78f3ae4a518ba34d8086d372684b9f71f2de89b380e639a7f4e83a44e8b6f5
5
5
  SHA512:
6
- metadata.gz: 1cbb397fdb411c2d869e2deb6cc641e1840d272071e425b58da2d6bca9b39bea69428d6a20da60688325094cf4c8ddc0568033ec57e8772b42ca3594b6477a07
7
- data.tar.gz: b1b91bb6f524008cf4b1c40d29c6e92c8e3bc22addf949c6b12aedd631e0314ea65770853f9a0076016a9540f10bb2e22a4170e606defd934187a1fcc9783774
6
+ metadata.gz: aafa0d2a6640601bf031ce18029c5135a53c5127056e0c423c1ade397069e746f4d96278cc282286f28213b32aa5248c7fcc2a9f3c71579caa68d1a8cf59774b
7
+ data.tar.gz: 7a4054f79dbcb27a9f27a9d6d16e9275d7cfd4663f04775c9525a9b63a234df70986fc9c9db40fcacac58ec272e401c59f552fadb4d782d21a277f1d5fe1e154
data/README.md CHANGED
@@ -1491,6 +1491,14 @@ E.g. show all test names while executing:
1491
1491
 
1492
1492
  bundle exec rake test TESTOPTS="--verbose"
1493
1493
 
1494
+ To list source tests excluded from Cloud, grouped by reason and note:
1495
+
1496
+ bundle exec rake test:cloud_inventory
1497
+
1498
+ To run the Cloud-eligible suite against an envconfig-defined server:
1499
+
1500
+ bundle exec rake test:cloud
1501
+
1494
1502
  ### Code Formatting and Type Checking
1495
1503
 
1496
1504
  This project uses `rubocop`:
data/Rakefile CHANGED
@@ -27,6 +27,25 @@ Rake::TestTask.new(:test) do |t|
27
27
  t.test_files = FileList['test/**/*_test.rb', 'extra/release/test/**/*_test.rb']
28
28
  end
29
29
 
30
+ namespace :test do
31
+ desc 'List tests excluded from Temporal Cloud by reason'
32
+ task :cloud_inventory do
33
+ ENV['TESTOPTS'] = [
34
+ ENV.fetch('TESTOPTS', nil),
35
+ '--cloud-inventory',
36
+ '--name=/CloudTestInventoryTest#test_report/'
37
+ ].compact.join(' ')
38
+ Rake::Task[:test].invoke
39
+ end
40
+
41
+ desc 'Run tests eligible for Temporal Cloud using envconfig'
42
+ task :cloud do
43
+ ENV['TEMPORAL_TEST_ENV_CONFIG_SERVER'] = '1'
44
+ ENV['TESTOPTS'] = [ENV.fetch('TESTOPTS', nil), '--cloud'].compact.join(' ')
45
+ Rake::Task[:test].invoke
46
+ end
47
+ end
48
+
30
49
  require 'rubocop/rake_task'
31
50
 
32
51
  RuboCop::RakeTask.new
@@ -46,6 +46,12 @@ module Temporalio
46
46
  Internal::ProtoUtils.timestamp_to_time(@raw_info.schedule_time)
47
47
  end
48
48
 
49
+ # @return [Time, nil] When the first activity task was made available for dispatch. Equals
50
+ # schedule_time + start_delay; equal to schedule_time when no start delay is set.
51
+ def execution_time
52
+ Internal::ProtoUtils.timestamp_to_time(@raw_info.execution_time)
53
+ end
54
+
49
55
  # @return [Time, nil] When the activity reached a terminal state.
50
56
  def close_time
51
57
  Internal::ProtoUtils.timestamp_to_time(@raw_info.close_time)
@@ -112,7 +118,17 @@ module Temporalio
112
118
  Internal::ProtoUtils.duration_to_seconds(@raw_info.heartbeat_timeout)
113
119
  end
114
120
 
115
- # @return [Boolean] Whether the activity has recorded any heartbeat details.
121
+ # @return [Float, nil] Delay in seconds before the first activity task is made available for
122
+ # dispatch. Not applied to retry attempts.
123
+ def start_delay
124
+ Internal::ProtoUtils.duration_to_seconds(@raw_info.start_delay)
125
+ end
126
+
127
+ # Whether heartbeat details are present on this description. False when the activity
128
+ # recorded none, and also when {ActivityHandle#describe} was called without
129
+ # `include_heartbeat_details:`.
130
+ #
131
+ # @return [Boolean] Whether heartbeat details are present.
116
132
  def has_heartbeat_details? # rubocop:disable Naming/PredicatePrefix
117
133
  !@raw_info.heartbeat_details&.payloads.nil? && !@raw_info.heartbeat_details.payloads.empty?
118
134
  end
@@ -125,6 +141,57 @@ module Temporalio
125
141
  @data_converter.from_payloads(@raw_info.heartbeat_details, hints:)
126
142
  end
127
143
 
144
+ # Whether the activity's input is present. False unless {ActivityHandle#describe} was
145
+ # called with `include_input:`.
146
+ #
147
+ # @return [Boolean] Whether input is present.
148
+ def has_input? # rubocop:disable Naming/PredicatePrefix
149
+ !@raw_description.input.nil?
150
+ end
151
+
152
+ # Deserialized activity input, one element per argument. Empty when no input is present.
153
+ #
154
+ # @param hints [Array<Object>, nil] Hints, if any, to assist conversion.
155
+ # @return [Array<Object>] Converted arguments.
156
+ def input(hints: nil)
157
+ @data_converter.from_payloads(@raw_description.input, hints:)
158
+ end
159
+
160
+ # Whether the activity closed with a successful result. False while the activity is still
161
+ # running, when it closed with a failure, and when {ActivityHandle#describe} was called
162
+ # without `include_outcome:`.
163
+ #
164
+ # @return [Boolean] Whether a result is present.
165
+ def has_result? # rubocop:disable Naming/PredicatePrefix
166
+ @raw_description.outcome&.value == :result
167
+ end
168
+
169
+ # Deserialized result the activity closed with. Nil when no result is present (still
170
+ # running, closed with a failure, or `include_outcome:` was not requested).
171
+ #
172
+ # @param result_hint [Object, nil] Hint, if any, to assist conversion.
173
+ # @return [Object, nil] Converted result.
174
+ def result(result_hint: nil)
175
+ return nil unless has_result?
176
+
177
+ @data_converter.from_payloads(
178
+ @raw_description.outcome.result, hints: Array(result_hint)
179
+ ).first
180
+ end
181
+
182
+ # Failure the activity closed with. Nil when the activity did not close with a failure or
183
+ # when {ActivityHandle#describe} was called without `include_outcome:`.
184
+ #
185
+ # This is the terminal outcome; {#last_failure} is the failure of the most recent attempt,
186
+ # which may be set while the activity is still retrying.
187
+ #
188
+ # @return [Error::Failure, nil] Converted failure.
189
+ def failure
190
+ return nil unless @raw_description.outcome&.value == :failure
191
+
192
+ @data_converter.from_failure(@raw_description.outcome.failure)
193
+ end
194
+
128
195
  # @return [RetryPolicy] Retry policy in effect for this activity.
129
196
  def retry_policy
130
197
  RetryPolicy._from_proto(@raw_info.retry_policy)
@@ -145,6 +212,20 @@ module Temporalio
145
212
  @raw_info.attempt
146
213
  end
147
214
 
215
+ # @return [Integer] Total number of heartbeats recorded across all attempts.
216
+ def total_heartbeat_count
217
+ @raw_info.total_heartbeat_count
218
+ end
219
+
220
+ # Whether a last failure is present on this description. False when the activity has no
221
+ # failed attempt, and also when {ActivityHandle#describe} was called without
222
+ # `include_last_failure:`.
223
+ #
224
+ # @return [Boolean] Whether a last failure is present.
225
+ def has_last_failure? # rubocop:disable Naming/PredicatePrefix
226
+ !@raw_info.last_failure.nil?
227
+ end
228
+
148
229
  # @return [Error::Failure, nil] Failure of the last failed attempt if any.
149
230
  def last_failure
150
231
  return nil unless @raw_info.last_failure
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/internal/proto_utils'
4
+ require 'temporalio/priority'
5
+ require 'temporalio/retry_policy'
6
+
7
+ module Temporalio
8
+ class Client
9
+ # The resolved options of a standalone activity execution, as returned by
10
+ # {ActivityHandle#update_options}. Reflects the activity's options as the server resolved them
11
+ # after the update was applied.
12
+ #
13
+ # WARNING: Standalone Activities are experimental.
14
+ ActivityExecutionOptions = Data.define(
15
+ :task_queue,
16
+ :schedule_to_close_timeout,
17
+ :schedule_to_start_timeout,
18
+ :start_to_close_timeout,
19
+ :heartbeat_timeout,
20
+ :retry_policy,
21
+ :priority,
22
+ :start_delay
23
+ ) do
24
+ # @!visibility private
25
+ def self._from_proto(options)
26
+ new(
27
+ task_queue: Internal::ProtoUtils.string_or(options.task_queue&.name, nil),
28
+ schedule_to_close_timeout: Internal::ProtoUtils.duration_to_seconds(options.schedule_to_close_timeout),
29
+ schedule_to_start_timeout: Internal::ProtoUtils.duration_to_seconds(options.schedule_to_start_timeout),
30
+ start_to_close_timeout: Internal::ProtoUtils.duration_to_seconds(options.start_to_close_timeout),
31
+ heartbeat_timeout: Internal::ProtoUtils.duration_to_seconds(options.heartbeat_timeout),
32
+ retry_policy: options.retry_policy ? RetryPolicy._from_proto(options.retry_policy) : nil,
33
+ priority: Priority._from_proto(options.priority),
34
+ start_delay: Internal::ProtoUtils.duration_to_seconds(options.start_delay)
35
+ )
36
+ end
37
+ end
38
+ end
39
+ end
@@ -15,6 +15,7 @@ module Temporalio
15
15
  CANCELED = Api::Enums::V1::ActivityExecutionStatus::ACTIVITY_EXECUTION_STATUS_CANCELED
16
16
  TERMINATED = Api::Enums::V1::ActivityExecutionStatus::ACTIVITY_EXECUTION_STATUS_TERMINATED
17
17
  TIMED_OUT = Api::Enums::V1::ActivityExecutionStatus::ACTIVITY_EXECUTION_STATUS_TIMED_OUT
18
+ PAUSED = Api::Enums::V1::ActivityExecutionStatus::ACTIVITY_EXECUTION_STATUS_PAUSED
18
19
  end
19
20
  end
20
21
  end
@@ -2,8 +2,13 @@
2
2
 
3
3
  require 'temporalio/api'
4
4
  require 'temporalio/client/activity_execution'
5
+ require 'temporalio/client/activity_execution_options'
6
+ require 'temporalio/client/activity_options'
5
7
  require 'temporalio/client/interceptor'
6
8
  require 'temporalio/error'
9
+ require 'temporalio/internal/proto_utils'
10
+ require 'temporalio/priority'
11
+ require 'temporalio/retry_policy'
7
12
 
8
13
  module Temporalio
9
14
  class Client
@@ -55,15 +60,35 @@ module Temporalio
55
60
 
56
61
  # Describe the activity.
57
62
  #
63
+ # The payload-bearing fields are opt-in because they can be arbitrarily large; request them
64
+ # only when needed. Each has a corresponding predicate on the returned description that
65
+ # reports whether the server supplied it.
66
+ #
67
+ # @param include_input [Boolean] If true and the activity received input, include the input.
68
+ # @param include_outcome [Boolean] If true and the activity is closed, include the outcome.
69
+ # @param include_heartbeat_details [Boolean] If true and the activity recorded heartbeat
70
+ # details, include them.
71
+ # @param include_last_failure [Boolean] If true and the activity has a failed attempt, include
72
+ # the last failure.
58
73
  # @param rpc_options [RPCOptions, nil] Advanced RPC options.
59
74
  #
60
75
  # @return [ActivityExecution::Description] Activity description.
61
76
  # @raise [Error::RPCError] RPC error from call.
62
- def describe(rpc_options: nil)
77
+ def describe(
78
+ include_input: false,
79
+ include_outcome: false,
80
+ include_heartbeat_details: false,
81
+ include_last_failure: false,
82
+ rpc_options: nil
83
+ )
63
84
  @client._impl.describe_activity(
64
85
  Interceptor::DescribeActivityInput.new(
65
86
  activity_id: id,
66
87
  activity_run_id: run_id,
88
+ include_input:,
89
+ include_outcome:,
90
+ include_heartbeat_details:,
91
+ include_last_failure:,
67
92
  rpc_options:
68
93
  )
69
94
  )
@@ -103,6 +128,102 @@ module Temporalio
103
128
  nil
104
129
  end
105
130
 
131
+ # Pause the activity. A paused activity is not scheduled or retried until it is unpaused via
132
+ # {#unpause}.
133
+ #
134
+ # WARNING: Standalone Activities are experimental.
135
+ #
136
+ # @param reason [String, nil] Optional reason recorded on the server.
137
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
138
+ # @raise [Error::RPCError] RPC error from call.
139
+ def pause(reason = nil, rpc_options: nil)
140
+ @client._impl.pause_activity(
141
+ Interceptor::PauseActivityInput.new(
142
+ activity_id: id,
143
+ activity_run_id: run_id,
144
+ reason:,
145
+ rpc_options:
146
+ )
147
+ )
148
+ nil
149
+ end
150
+
151
+ # Unpause the activity, allowing it to be scheduled or retried again.
152
+ #
153
+ # WARNING: Standalone Activities are experimental.
154
+ #
155
+ # @param reason [String, nil] Optional reason recorded on the server.
156
+ # @param jitter [Float, nil] If set, the activity will start at a random time within this
157
+ # duration (in seconds).
158
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
159
+ # @raise [Error::RPCError] RPC error from call.
160
+ def unpause(reason: nil, jitter: nil, rpc_options: nil)
161
+ @client._impl.unpause_activity(
162
+ Interceptor::UnpauseActivityInput.new(
163
+ activity_id: id,
164
+ activity_run_id: run_id,
165
+ reason:,
166
+ jitter:,
167
+ rpc_options:
168
+ )
169
+ )
170
+ nil
171
+ end
172
+
173
+ # Update the activity's options. Only the options named by `updates` are changed; anything
174
+ # not named is left as-is.
175
+ #
176
+ # Updates are created from the keys on {ActivityOptions}, via {ActivityOptions::Key#value_set}
177
+ # to set an option or {ActivityOptions::Key#value_unset} to clear it.
178
+ #
179
+ # WARNING: Standalone Activities are experimental.
180
+ #
181
+ # @param updates [Array<ActivityOptions::Update>] The option updates to apply. At least one is
182
+ # required unless `restore_original` is true.
183
+ # @param restore_original [Boolean] If true, restore the options to the originals the activity
184
+ # was created with. Mutually exclusive with any update.
185
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
186
+ #
187
+ # @return [ActivityExecutionOptions] The activity options after the update.
188
+ #
189
+ # @raise [ArgumentError] If a non-update is given, if `restore_original` is combined with any
190
+ # update, or if no update is provided and `restore_original` is false.
191
+ # @raise [Error::RPCError] RPC error from call.
192
+ def update_options(*updates, restore_original: false, rpc_options: nil)
193
+ unless updates.all?(ActivityOptions::Update)
194
+ raise ArgumentError,
195
+ 'Updates must be created via ActivityOptions::Key#value_set or #value_unset'
196
+ end
197
+
198
+ if restore_original && !updates.empty?
199
+ raise ArgumentError, 'restore_original cannot be combined with any option update'
200
+ elsif !restore_original && updates.empty?
201
+ raise ArgumentError,
202
+ 'At least one option update must be given, or restore_original must be used'
203
+ end
204
+
205
+ # For repeated keys, later values override previous ones.
206
+ by_path = updates.to_h { |update| [update.key.name, update] }
207
+
208
+ proto = Api::Activity::V1::ActivityOptions.new
209
+ by_path.each_value do |update|
210
+ # An unset update names its path but leaves the field absent, which is how the server is
211
+ # told to clear the option rather than set it to a value.
212
+ update.key._apply(proto, update.value) unless update.value.nil?
213
+ end
214
+
215
+ @client._impl.update_activity_options(
216
+ Interceptor::UpdateActivityOptionsInput.new(
217
+ activity_id: id,
218
+ activity_run_id: run_id,
219
+ activity_options: proto,
220
+ update_mask: Google::Protobuf::FieldMask.new(paths: by_path.keys),
221
+ restore_original:,
222
+ rpc_options:
223
+ )
224
+ )
225
+ end
226
+
106
227
  private
107
228
 
108
229
  def _process_outcome(outcome, hint)
@@ -0,0 +1,113 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/api'
4
+ require 'temporalio/internal/proto_utils'
5
+
6
+ module Temporalio
7
+ class Client
8
+ # The activity options that {ActivityHandle#update_options} can change.
9
+ #
10
+ # Updates are created from the keys below, via {Key#value_set} to set an option or
11
+ # {Key#value_unset} to clear it. An option with no update is left untouched.
12
+ #
13
+ # WARNING: Standalone Activities are experimental.
14
+ module ActivityOptions
15
+ # Typed key for one updatable activity option. Use the keys on {ActivityOptions} rather than
16
+ # constructing these directly.
17
+ class Key
18
+ # @return [String] Field-mask path this key updates.
19
+ attr_reader :name
20
+
21
+ # @!visibility private
22
+ def initialize(name, &to_proto)
23
+ @name = name
24
+ @to_proto = to_proto
25
+ freeze
26
+ end
27
+
28
+ # Create an update that sets this option to the given value.
29
+ #
30
+ # @param value [Object] Value to set. Cannot be nil.
31
+ # @return [Update] Created update.
32
+ def value_set(value)
33
+ raise ArgumentError, 'Value cannot be nil, use value_unset' if value.nil?
34
+
35
+ Update.new(self, value)
36
+ end
37
+
38
+ # Create an update that clears this option server-side.
39
+ #
40
+ # @return [Update] Created update.
41
+ def value_unset
42
+ Update.new(self, nil)
43
+ end
44
+
45
+ # @!visibility private
46
+ def _apply(proto, value)
47
+ @to_proto.call(proto, value)
48
+ end
49
+ end
50
+
51
+ # A single change to an activity's options that can be separately applied.
52
+ class Update
53
+ # @return [Key] Key this update applies to.
54
+ attr_reader :key
55
+
56
+ # @return [Object, nil] Value to set, or `nil` to clear the option.
57
+ attr_reader :value
58
+
59
+ # Create an update. Users may find it easier to use {Key#value_set} and {Key#value_unset}.
60
+ #
61
+ # @param key [Key] Key to update.
62
+ # @param value [Object, nil] Value to set, or nil to clear the option.
63
+ def initialize(key, value)
64
+ raise ArgumentError, 'Key must be a key' unless key.is_a?(Key)
65
+
66
+ @key = key
67
+ @value = value
68
+ freeze
69
+ end
70
+ end
71
+
72
+ # @return [Key] New task queue.
73
+ TASK_QUEUE = Key.new('task_queue.name') do |proto, value|
74
+ proto.task_queue = Api::TaskQueue::V1::TaskQueue.new(name: value.to_s)
75
+ end
76
+
77
+ # @return [Key] New schedule-to-close timeout in seconds.
78
+ SCHEDULE_TO_CLOSE_TIMEOUT = Key.new('schedule_to_close_timeout') do |proto, value|
79
+ proto.schedule_to_close_timeout = Internal::ProtoUtils.seconds_to_duration(value)
80
+ end
81
+
82
+ # @return [Key] New schedule-to-start timeout in seconds.
83
+ SCHEDULE_TO_START_TIMEOUT = Key.new('schedule_to_start_timeout') do |proto, value|
84
+ proto.schedule_to_start_timeout = Internal::ProtoUtils.seconds_to_duration(value)
85
+ end
86
+
87
+ # @return [Key] New start-to-close timeout in seconds.
88
+ START_TO_CLOSE_TIMEOUT = Key.new('start_to_close_timeout') do |proto, value|
89
+ proto.start_to_close_timeout = Internal::ProtoUtils.seconds_to_duration(value)
90
+ end
91
+
92
+ # @return [Key] New heartbeat timeout in seconds.
93
+ HEARTBEAT_TIMEOUT = Key.new('heartbeat_timeout') do |proto, value|
94
+ proto.heartbeat_timeout = Internal::ProtoUtils.seconds_to_duration(value)
95
+ end
96
+
97
+ # @return [Key] New start delay in seconds.
98
+ START_DELAY = Key.new('start_delay') do |proto, value|
99
+ proto.start_delay = Internal::ProtoUtils.seconds_to_duration(value)
100
+ end
101
+
102
+ # @return [Key] New retry policy.
103
+ RETRY_POLICY = Key.new('retry_policy') do |proto, value|
104
+ proto.retry_policy = value._to_proto
105
+ end
106
+
107
+ # @return [Key] New priority.
108
+ PRIORITY = Key.new('priority') do |proto, value|
109
+ proto.priority = value._to_proto
110
+ end
111
+ end
112
+ end
113
+ end
@@ -291,6 +291,10 @@ module Temporalio
291
291
  DescribeActivityInput = Data.define(
292
292
  :activity_id,
293
293
  :activity_run_id,
294
+ :include_input,
295
+ :include_outcome,
296
+ :include_heartbeat_details,
297
+ :include_last_failure,
294
298
  :rpc_options
295
299
  )
296
300
 
@@ -314,6 +318,39 @@ module Temporalio
314
318
  :rpc_options
315
319
  )
316
320
 
321
+ # Input for {Outbound.pause_activity}.
322
+ #
323
+ # WARNING: Standalone Activities are experimental.
324
+ PauseActivityInput = Data.define(
325
+ :activity_id,
326
+ :activity_run_id,
327
+ :reason,
328
+ :rpc_options
329
+ )
330
+
331
+ # Input for {Outbound.unpause_activity}.
332
+ #
333
+ # WARNING: Standalone Activities are experimental.
334
+ UnpauseActivityInput = Data.define(
335
+ :activity_id,
336
+ :activity_run_id,
337
+ :reason,
338
+ :jitter,
339
+ :rpc_options
340
+ )
341
+
342
+ # Input for {Outbound.update_activity_options}.
343
+ #
344
+ # WARNING: Standalone Activities are experimental.
345
+ UpdateActivityOptionsInput = Data.define(
346
+ :activity_id,
347
+ :activity_run_id,
348
+ :activity_options,
349
+ :update_mask,
350
+ :restore_original,
351
+ :rpc_options
352
+ )
353
+
317
354
  # Input for {Outbound.list_activities}.
318
355
  #
319
356
  # WARNING: Standalone Activities are experimental.
@@ -587,6 +624,34 @@ module Temporalio
587
624
  next_interceptor.terminate_activity(input)
588
625
  end
589
626
 
627
+ # Called for every {ActivityHandle.pause} call.
628
+ #
629
+ # WARNING: Standalone Activities are experimental.
630
+ #
631
+ # @param input [PauseActivityInput] Input.
632
+ def pause_activity(input)
633
+ next_interceptor.pause_activity(input)
634
+ end
635
+
636
+ # Called for every {ActivityHandle.unpause} call.
637
+ #
638
+ # WARNING: Standalone Activities are experimental.
639
+ #
640
+ # @param input [UnpauseActivityInput] Input.
641
+ def unpause_activity(input)
642
+ next_interceptor.unpause_activity(input)
643
+ end
644
+
645
+ # Called for every {ActivityHandle.update_options} call.
646
+ #
647
+ # WARNING: Standalone Activities are experimental.
648
+ #
649
+ # @param input [UpdateActivityOptionsInput] Input.
650
+ # @return [Api::Activity::V1::ActivityOptions] Activity options after the update.
651
+ def update_activity_options(input)
652
+ next_interceptor.update_activity_options(input)
653
+ end
654
+
590
655
  # Called for every {Client.list_activities} call.
591
656
  #
592
657
  # WARNING: Standalone Activities are experimental.
@@ -29,7 +29,7 @@ require 'temporalio/workflow/definition'
29
29
  module Temporalio
30
30
  module Internal
31
31
  module Client
32
- class Implementation < Temporalio::Client::Interceptor::Outbound
32
+ class Implementation < Temporalio::Client::Interceptor::Outbound # rubocop:disable Metrics/ClassLength
33
33
  # Proto routing convention for standalone activity completion: `*_by_id` requests carry
34
34
  # `resource_id = "activity:<activity_id>"`. See the resource_id field comment on
35
35
  # `RecordActivityTaskHeartbeatByIdRequest` (and the analogous Completed/Failed/Canceled
@@ -1025,7 +1025,11 @@ module Temporalio
1025
1025
  Api::WorkflowService::V1::DescribeActivityExecutionRequest.new(
1026
1026
  namespace: @client.namespace,
1027
1027
  activity_id: input.activity_id,
1028
- run_id: input.activity_run_id || ''
1028
+ run_id: input.activity_run_id || '',
1029
+ include_input: input.include_input,
1030
+ include_outcome: input.include_outcome,
1031
+ include_heartbeat_details: input.include_heartbeat_details,
1032
+ include_last_failure: input.include_last_failure
1029
1033
  ),
1030
1034
  rpc_options: Implementation.with_default_rpc_options(input.rpc_options)
1031
1035
  )
@@ -1062,6 +1066,54 @@ module Temporalio
1062
1066
  nil
1063
1067
  end
1064
1068
 
1069
+ def pause_activity(input)
1070
+ @client.workflow_service.pause_activity_execution(
1071
+ Api::WorkflowService::V1::PauseActivityExecutionRequest.new(
1072
+ namespace: @client.namespace,
1073
+ activity_id: input.activity_id,
1074
+ run_id: input.activity_run_id || '',
1075
+ identity: @client.connection.identity,
1076
+ request_id: SecureRandom.uuid,
1077
+ reason: input.reason || ''
1078
+ ),
1079
+ rpc_options: Implementation.with_default_rpc_options(input.rpc_options)
1080
+ )
1081
+ nil
1082
+ end
1083
+
1084
+ def unpause_activity(input)
1085
+ @client.workflow_service.unpause_activity_execution(
1086
+ Api::WorkflowService::V1::UnpauseActivityExecutionRequest.new(
1087
+ namespace: @client.namespace,
1088
+ activity_id: input.activity_id,
1089
+ run_id: input.activity_run_id || '',
1090
+ identity: @client.connection.identity,
1091
+ request_id: SecureRandom.uuid,
1092
+ reason: input.reason || '',
1093
+ jitter: ProtoUtils.seconds_to_duration(input.jitter)
1094
+ ),
1095
+ rpc_options: Implementation.with_default_rpc_options(input.rpc_options)
1096
+ )
1097
+ nil
1098
+ end
1099
+
1100
+ def update_activity_options(input)
1101
+ resp = @client.workflow_service.update_activity_execution_options(
1102
+ Api::WorkflowService::V1::UpdateActivityExecutionOptionsRequest.new(
1103
+ namespace: @client.namespace,
1104
+ activity_id: input.activity_id,
1105
+ run_id: input.activity_run_id || '',
1106
+ identity: @client.connection.identity,
1107
+ request_id: SecureRandom.uuid,
1108
+ activity_options: input.activity_options,
1109
+ update_mask: input.update_mask,
1110
+ restore_original: input.restore_original
1111
+ ),
1112
+ rpc_options: Implementation.with_default_rpc_options(input.rpc_options)
1113
+ )
1114
+ Temporalio::Client::ActivityExecutionOptions._from_proto(resp.activity_options)
1115
+ end
1116
+
1065
1117
  def list_activities(input)
1066
1118
  Enumerator.new do |yielder|
1067
1119
  req = Api::WorkflowService::V1::ListActivityExecutionsRequest.new(
@@ -106,6 +106,9 @@ module Temporalio
106
106
  message_str = message.is_a?(String) ? message : message.inspect
107
107
  "#{message_str} #{scoped_values}"
108
108
  end
109
+
110
+ # @return [String] The log message.
111
+ alias to_s message
109
112
  end
110
113
  end
111
114
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Temporalio
4
- VERSION = '1.7.0'
4
+ VERSION = '1.8.0'
5
5
  end
@@ -39,8 +39,18 @@ module Temporalio
39
39
  return unless defn.cancel_raise
40
40
 
41
41
  fiber = ::Fiber.current
42
+ scheduler = ::Fiber.scheduler
43
+ scheduler = nil unless scheduler.respond_to?(:fiber_interrupt)
42
44
  context&.cancellation&.add_cancel_callback do
43
- fiber.raise(Error::CanceledError.new('Activity canceled'))
45
+ error = Error::CanceledError.new('Activity canceled')
46
+ # Directly raising from another fiber can strand a `Fiber#transfer`
47
+ # based scheduler's current fiber, so we defer to the scheduler to interrupt.
48
+ # If on the same fiber, we can just raise directly.
49
+ if scheduler.nil? || ::Fiber.current.equal?(fiber)
50
+ fiber.raise(error)
51
+ else
52
+ scheduler.fiber_interrupt(fiber, error)
53
+ end
44
54
  end
45
55
  end
46
56
  end
@@ -33,6 +33,9 @@ class Temporalio::Client::ActivityExecution
33
33
  sig { returns(T.nilable(Time)) }
34
34
  def schedule_time; end
35
35
 
36
+ sig { returns(T.nilable(Time)) }
37
+ def execution_time; end
38
+
36
39
  sig { returns(T.nilable(Time)) }
37
40
  def close_time; end
38
41
 
@@ -76,9 +79,30 @@ class Temporalio::Client::ActivityExecution::Description < ::Temporalio::Client:
76
79
  sig { returns(T.nilable(Float)) }
77
80
  def heartbeat_timeout; end
78
81
 
82
+ sig { returns(T.nilable(Float)) }
83
+ def start_delay; end
84
+
79
85
  sig { returns(T::Boolean) }
80
86
  def has_heartbeat_details?; end
81
87
 
88
+ sig { returns(T::Boolean) }
89
+ def has_last_failure?; end
90
+
91
+ sig { returns(T::Boolean) }
92
+ def has_input?; end
93
+
94
+ sig { params(hints: T.nilable(T::Array[Object])).returns(T::Array[T.nilable(Object)]) }
95
+ def input(hints: T.unsafe(nil)); end
96
+
97
+ sig { returns(T::Boolean) }
98
+ def has_result?; end
99
+
100
+ sig { params(result_hint: T.nilable(Object)).returns(T.nilable(Object)) }
101
+ def result(result_hint: T.unsafe(nil)); end
102
+
103
+ sig { returns(T.nilable(Temporalio::Error::Failure)) }
104
+ def failure; end
105
+
82
106
  sig { params(hints: T.nilable(T::Array[Object])).returns(T::Array[T.nilable(Object)]) }
83
107
  def heartbeat_details(hints: T.unsafe(nil)); end
84
108
 
@@ -94,6 +118,9 @@ class Temporalio::Client::ActivityExecution::Description < ::Temporalio::Client:
94
118
  sig { returns(Integer) }
95
119
  def attempt; end
96
120
 
121
+ sig { returns(Integer) }
122
+ def total_heartbeat_count; end
123
+
97
124
  sig { returns(T.nilable(Temporalio::Error::Failure)) }
98
125
  def last_failure; end
99
126
 
@@ -0,0 +1,58 @@
1
+ # typed: true
2
+
3
+ class Temporalio::Client::ActivityExecutionOptions
4
+ class << self
5
+ sig do
6
+ params(options: Temporalio::Api::Activity::V1::ActivityOptions)
7
+ .returns(Temporalio::Client::ActivityExecutionOptions)
8
+ end
9
+ def _from_proto(options); end
10
+ end
11
+
12
+ sig do
13
+ params(
14
+ task_queue: T.nilable(String),
15
+ schedule_to_close_timeout: T.nilable(Float),
16
+ schedule_to_start_timeout: T.nilable(Float),
17
+ start_to_close_timeout: T.nilable(Float),
18
+ heartbeat_timeout: T.nilable(Float),
19
+ retry_policy: T.nilable(Temporalio::RetryPolicy),
20
+ priority: Temporalio::Priority,
21
+ start_delay: T.nilable(Float)
22
+ ).void
23
+ end
24
+ def initialize(
25
+ task_queue:,
26
+ schedule_to_close_timeout:,
27
+ schedule_to_start_timeout:,
28
+ start_to_close_timeout:,
29
+ heartbeat_timeout:,
30
+ retry_policy:,
31
+ priority:,
32
+ start_delay:
33
+ ); end
34
+
35
+ sig { returns(T.nilable(String)) }
36
+ attr_reader :task_queue
37
+
38
+ sig { returns(T.nilable(Float)) }
39
+ attr_reader :schedule_to_close_timeout
40
+
41
+ sig { returns(T.nilable(Float)) }
42
+ attr_reader :schedule_to_start_timeout
43
+
44
+ sig { returns(T.nilable(Float)) }
45
+ attr_reader :start_to_close_timeout
46
+
47
+ sig { returns(T.nilable(Float)) }
48
+ attr_reader :heartbeat_timeout
49
+
50
+ sig { returns(T.nilable(Temporalio::RetryPolicy)) }
51
+ attr_reader :retry_policy
52
+
53
+ sig { returns(Temporalio::Priority) }
54
+ attr_reader :priority
55
+
56
+ sig { returns(T.nilable(Float)) }
57
+ attr_reader :start_delay
58
+ end
@@ -8,4 +8,5 @@ module Temporalio::Client::ActivityExecutionStatus
8
8
  CANCELED = T.let(T.unsafe(nil), Integer)
9
9
  TERMINATED = T.let(T.unsafe(nil), Integer)
10
10
  TIMED_OUT = T.let(T.unsafe(nil), Integer)
11
+ PAUSED = T.let(T.unsafe(nil), Integer)
11
12
  end
@@ -1,6 +1,8 @@
1
1
  # typed: true
2
2
 
3
3
  class Temporalio::Client::ActivityHandle
4
+ UPDATABLE_OPTION_PATHS = T.let(T.unsafe(nil), T::Hash[Symbol, String])
5
+
4
6
  sig do
5
7
  params(
6
8
  client: Temporalio::Client,
@@ -28,8 +30,22 @@ class Temporalio::Client::ActivityHandle
28
30
  end
29
31
  def result(result_hint: T.unsafe(nil), rpc_options: T.unsafe(nil)); end
30
32
 
31
- sig { params(rpc_options: T.nilable(Temporalio::Client::RPCOptions)).returns(Temporalio::Client::ActivityExecution::Description) }
32
- def describe(rpc_options: T.unsafe(nil)); end
33
+ sig do
34
+ params(
35
+ include_input: T::Boolean,
36
+ include_outcome: T::Boolean,
37
+ include_heartbeat_details: T::Boolean,
38
+ include_last_failure: T::Boolean,
39
+ rpc_options: T.nilable(Temporalio::Client::RPCOptions)
40
+ ).returns(Temporalio::Client::ActivityExecution::Description)
41
+ end
42
+ def describe(
43
+ include_input: T.unsafe(nil),
44
+ include_outcome: T.unsafe(nil),
45
+ include_heartbeat_details: T.unsafe(nil),
46
+ include_last_failure: T.unsafe(nil),
47
+ rpc_options: T.unsafe(nil)
48
+ ); end
33
49
 
34
50
  sig { params(reason: T.nilable(String), rpc_options: T.nilable(Temporalio::Client::RPCOptions)).void }
35
51
  def cancel(reason = T.unsafe(nil), rpc_options: T.unsafe(nil)); end
@@ -37,6 +53,31 @@ class Temporalio::Client::ActivityHandle
37
53
  sig { params(reason: T.nilable(String), rpc_options: T.nilable(Temporalio::Client::RPCOptions)).void }
38
54
  def terminate(reason = T.unsafe(nil), rpc_options: T.unsafe(nil)); end
39
55
 
56
+ sig { params(reason: T.nilable(String), rpc_options: T.nilable(Temporalio::Client::RPCOptions)).void }
57
+ def pause(reason = T.unsafe(nil), rpc_options: T.unsafe(nil)); end
58
+
59
+ sig do
60
+ params(
61
+ reason: T.nilable(String),
62
+ jitter: T.nilable(Float),
63
+ rpc_options: T.nilable(Temporalio::Client::RPCOptions)
64
+ ).void
65
+ end
66
+ def unpause(reason: T.unsafe(nil), jitter: T.unsafe(nil), rpc_options: T.unsafe(nil)); end
67
+
68
+ sig do
69
+ params(
70
+ updates: Temporalio::Client::ActivityOptions::Update,
71
+ restore_original: T::Boolean,
72
+ rpc_options: T.nilable(Temporalio::Client::RPCOptions)
73
+ ).returns(Temporalio::Client::ActivityExecutionOptions)
74
+ end
75
+ def update_options(
76
+ *updates,
77
+ restore_original: T.unsafe(nil),
78
+ rpc_options: T.unsafe(nil)
79
+ ); end
80
+
40
81
  private
41
82
 
42
83
  sig do
@@ -0,0 +1,49 @@
1
+ # typed: strong
2
+
3
+ module Temporalio
4
+ class Client
5
+ module ActivityOptions
6
+ class Key
7
+ sig { returns(String) }
8
+ def name; end
9
+
10
+ sig do
11
+ params(
12
+ name: String,
13
+ to_proto: T.proc.params(proto: Temporalio::Api::Activity::V1::ActivityOptions, value: Object).void
14
+ ).void
15
+ end
16
+ def initialize(name, &to_proto); end
17
+
18
+ sig { params(value: Object).returns(Temporalio::Client::ActivityOptions::Update) }
19
+ def value_set(value); end
20
+
21
+ sig { returns(Temporalio::Client::ActivityOptions::Update) }
22
+ def value_unset; end
23
+
24
+ sig { params(proto: Temporalio::Api::Activity::V1::ActivityOptions, value: Object).void }
25
+ def _apply(proto, value); end
26
+ end
27
+
28
+ class Update
29
+ sig { returns(Temporalio::Client::ActivityOptions::Key) }
30
+ def key; end
31
+
32
+ sig { returns(T.nilable(Object)) }
33
+ def value; end
34
+
35
+ sig { params(key: Temporalio::Client::ActivityOptions::Key, value: T.nilable(Object)).void }
36
+ def initialize(key, value); end
37
+ end
38
+
39
+ TASK_QUEUE = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
40
+ SCHEDULE_TO_CLOSE_TIMEOUT = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
41
+ SCHEDULE_TO_START_TIMEOUT = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
42
+ START_TO_CLOSE_TIMEOUT = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
43
+ HEARTBEAT_TIMEOUT = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
44
+ START_DELAY = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
45
+ RETRY_POLICY = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
46
+ PRIORITY = T.let(T.unsafe(nil), Temporalio::Client::ActivityOptions::Key)
47
+ end
48
+ end
49
+ end
@@ -834,6 +834,18 @@ class Temporalio::Client::Interceptor::DescribeActivityInput < ::Data
834
834
  sig { returns(T.nilable(String)) }
835
835
  def activity_run_id; end
836
836
 
837
+ sig { returns(T::Boolean) }
838
+ def include_input; end
839
+
840
+ sig { returns(T::Boolean) }
841
+ def include_outcome; end
842
+
843
+ sig { returns(T::Boolean) }
844
+ def include_heartbeat_details; end
845
+
846
+ sig { returns(T::Boolean) }
847
+ def include_last_failure; end
848
+
837
849
  sig { returns(T.nilable(Temporalio::Client::RPCOptions)) }
838
850
  def rpc_options; end
839
851
 
@@ -849,6 +861,88 @@ class Temporalio::Client::Interceptor::DescribeActivityInput < ::Data
849
861
  end
850
862
  end
851
863
 
864
+ class Temporalio::Client::Interceptor::PauseActivityInput < ::Data
865
+ sig { returns(String) }
866
+ def activity_id; end
867
+
868
+ sig { returns(T.nilable(String)) }
869
+ def activity_run_id; end
870
+
871
+ sig { returns(T.nilable(String)) }
872
+ def reason; end
873
+
874
+ sig { returns(T.nilable(Temporalio::Client::RPCOptions)) }
875
+ def rpc_options; end
876
+
877
+ class << self
878
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::PauseActivityInput) }
879
+ def new(*args); end
880
+
881
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::PauseActivityInput) }
882
+ def [](*args); end
883
+
884
+ sig { returns(T::Array[Symbol]) }
885
+ def members; end
886
+ end
887
+ end
888
+ class Temporalio::Client::Interceptor::UnpauseActivityInput < ::Data
889
+ sig { returns(String) }
890
+ def activity_id; end
891
+
892
+ sig { returns(T.nilable(String)) }
893
+ def activity_run_id; end
894
+
895
+ sig { returns(T.nilable(String)) }
896
+ def reason; end
897
+
898
+ sig { returns(T.nilable(Float)) }
899
+ def jitter; end
900
+
901
+ sig { returns(T.nilable(Temporalio::Client::RPCOptions)) }
902
+ def rpc_options; end
903
+
904
+ class << self
905
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::UnpauseActivityInput) }
906
+ def new(*args); end
907
+
908
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::UnpauseActivityInput) }
909
+ def [](*args); end
910
+
911
+ sig { returns(T::Array[Symbol]) }
912
+ def members; end
913
+ end
914
+ end
915
+ class Temporalio::Client::Interceptor::UpdateActivityOptionsInput < ::Data
916
+ sig { returns(String) }
917
+ def activity_id; end
918
+
919
+ sig { returns(T.nilable(String)) }
920
+ def activity_run_id; end
921
+
922
+ sig { returns(Temporalio::Api::Activity::V1::ActivityOptions) }
923
+ def activity_options; end
924
+
925
+ sig { returns(Google::Protobuf::FieldMask) }
926
+ def update_mask; end
927
+
928
+ sig { returns(T::Boolean) }
929
+ def restore_original; end
930
+
931
+ sig { returns(T.nilable(Temporalio::Client::RPCOptions)) }
932
+ def rpc_options; end
933
+
934
+ class << self
935
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::UpdateActivityOptionsInput) }
936
+ def new(*args); end
937
+
938
+ sig { params(args: T.untyped).returns(Temporalio::Client::Interceptor::UpdateActivityOptionsInput) }
939
+ def [](*args); end
940
+
941
+ sig { returns(T::Array[Symbol]) }
942
+ def members; end
943
+ end
944
+ end
945
+
852
946
  class Temporalio::Client::Interceptor::CancelActivityInput < ::Data
853
947
  sig { returns(String) }
854
948
  def activity_id; end
@@ -1056,6 +1150,19 @@ class Temporalio::Client::Interceptor::Outbound
1056
1150
  sig { params(input: Temporalio::Client::Interceptor::TerminateActivityInput).void }
1057
1151
  def terminate_activity(input); end
1058
1152
 
1153
+ sig { params(input: Temporalio::Client::Interceptor::PauseActivityInput).void }
1154
+ def pause_activity(input); end
1155
+
1156
+ sig { params(input: Temporalio::Client::Interceptor::UnpauseActivityInput).void }
1157
+ def unpause_activity(input); end
1158
+
1159
+
1160
+ sig do
1161
+ params(input: Temporalio::Client::Interceptor::UpdateActivityOptionsInput)
1162
+ .returns(Temporalio::Client::ActivityExecutionOptions)
1163
+ end
1164
+ def update_activity_options(input); end
1165
+
1059
1166
  sig { params(input: Temporalio::Client::Interceptor::ListActivitiesInput).returns(T::Enumerator[Temporalio::Client::ActivityExecution]) }
1060
1167
  def list_activities(input); end
1061
1168
 
@@ -9,6 +9,7 @@ module Temporalio
9
9
  def activity_run_id: -> String?
10
10
  def activity_type: -> String
11
11
  def schedule_time: -> Time?
12
+ def execution_time: -> Time?
12
13
  def close_time: -> Time?
13
14
  def status: -> ActivityExecutionStatus::enum
14
15
  def search_attributes: -> SearchAttributes?
@@ -25,12 +26,21 @@ module Temporalio
25
26
  def schedule_to_start_timeout: -> Float?
26
27
  def start_to_close_timeout: -> Float?
27
28
  def heartbeat_timeout: -> Float?
29
+ def start_delay: -> Float?
28
30
  def has_heartbeat_details?: -> bool
31
+ def has_last_failure?: -> bool
32
+ def has_input?: -> bool
33
+ def input: (?hints: Array[Object]?) -> Array[Object?]
34
+ def has_result?: -> bool
35
+ def result: (?result_hint: Object?) -> Object?
36
+ def failure: -> Error::Failure?
29
37
  def heartbeat_details: (?hints: Array[Object]?) -> Array[Object?]
30
38
  def retry_policy: -> RetryPolicy
31
39
  def last_heartbeat_time: -> Time?
32
40
  def last_started_time: -> Time?
33
41
  def attempt: -> Integer
42
+
43
+ def total_heartbeat_count: -> Integer
34
44
  def last_failure: -> Error::Failure?
35
45
  def expiration_time: -> Time?
36
46
  def last_worker_identity: -> String?
@@ -0,0 +1,27 @@
1
+ module Temporalio
2
+ class Client
3
+ class ActivityExecutionOptions
4
+ attr_reader task_queue: String?
5
+ attr_reader schedule_to_close_timeout: Float?
6
+ attr_reader schedule_to_start_timeout: Float?
7
+ attr_reader start_to_close_timeout: Float?
8
+ attr_reader heartbeat_timeout: Float?
9
+ attr_reader retry_policy: RetryPolicy?
10
+ attr_reader priority: Priority
11
+ attr_reader start_delay: Float?
12
+
13
+ def self._from_proto: (untyped options) -> ActivityExecutionOptions
14
+
15
+ def initialize: (
16
+ task_queue: String?,
17
+ schedule_to_close_timeout: Float?,
18
+ schedule_to_start_timeout: Float?,
19
+ start_to_close_timeout: Float?,
20
+ heartbeat_timeout: Float?,
21
+ retry_policy: RetryPolicy?,
22
+ priority: Priority,
23
+ start_delay: Float?
24
+ ) -> void
25
+ end
26
+ end
27
+ end
@@ -10,6 +10,7 @@ module Temporalio
10
10
  CANCELED: enum
11
11
  TERMINATED: enum
12
12
  TIMED_OUT: enum
13
+ PAUSED: enum
13
14
  end
14
15
  end
15
16
  end
@@ -1,6 +1,8 @@
1
1
  module Temporalio
2
2
  class Client
3
3
  class ActivityHandle
4
+ UPDATABLE_OPTION_PATHS: Hash[Symbol, String]
5
+
4
6
  attr_reader id: String
5
7
  attr_reader run_id: String?
6
8
  attr_reader result_hint: Object?
@@ -14,12 +16,32 @@ module Temporalio
14
16
 
15
17
  def result: (?result_hint: Object?, ?rpc_options: RPCOptions?) -> Object?
16
18
 
17
- def describe: (?rpc_options: RPCOptions?) -> ActivityExecution::Description
19
+ def describe: (
20
+ ?include_input: bool,
21
+ ?include_outcome: bool,
22
+ ?include_heartbeat_details: bool,
23
+ ?include_last_failure: bool,
24
+ ?rpc_options: RPCOptions?
25
+ ) -> ActivityExecution::Description
18
26
 
19
27
  def cancel: (?String? reason, ?rpc_options: RPCOptions?) -> void
20
28
 
21
29
  def terminate: (?String? reason, ?rpc_options: RPCOptions?) -> void
22
30
 
31
+ def pause: (?String? reason, ?rpc_options: RPCOptions?) -> void
32
+
33
+ def unpause: (
34
+ ?reason: String?,
35
+ ?jitter: Float?,
36
+ ?rpc_options: RPCOptions?
37
+ ) -> void
38
+
39
+ def update_options: (
40
+ *ActivityOptions::Update updates,
41
+ ?restore_original: bool,
42
+ ?rpc_options: RPCOptions?
43
+ ) -> ActivityExecutionOptions
44
+
23
45
  private def _process_outcome: (Api::Activity::V1::ActivityExecutionOutcome? outcome, Object? hint) -> Object?
24
46
  end
25
47
  end
@@ -0,0 +1,30 @@
1
+ module Temporalio
2
+ class Client
3
+ module ActivityOptions
4
+ class Key
5
+ attr_reader name: String
6
+
7
+ def initialize: (String name) { (untyped proto, untyped value) -> void } -> void
8
+ def value_set: (untyped value) -> Update
9
+ def value_unset: () -> Update
10
+ def _apply: (untyped proto, untyped value) -> void
11
+ end
12
+
13
+ class Update
14
+ attr_reader key: Key
15
+ attr_reader value: untyped?
16
+
17
+ def initialize: (Key key, untyped? value) -> void
18
+ end
19
+
20
+ TASK_QUEUE: Key
21
+ SCHEDULE_TO_CLOSE_TIMEOUT: Key
22
+ SCHEDULE_TO_START_TIMEOUT: Key
23
+ START_TO_CLOSE_TIMEOUT: Key
24
+ HEARTBEAT_TIMEOUT: Key
25
+ START_DELAY: Key
26
+ RETRY_POLICY: Key
27
+ PRIORITY: Key
28
+ end
29
+ end
30
+ end
@@ -481,11 +481,19 @@ module Temporalio
481
481
  class DescribeActivityInput
482
482
  attr_reader activity_id: String
483
483
  attr_reader activity_run_id: String?
484
+ attr_reader include_input: bool
485
+ attr_reader include_outcome: bool
486
+ attr_reader include_heartbeat_details: bool
487
+ attr_reader include_last_failure: bool
484
488
  attr_reader rpc_options: RPCOptions?
485
489
 
486
490
  def initialize: (
487
491
  activity_id: String,
488
492
  activity_run_id: String?,
493
+ include_input: bool,
494
+ include_outcome: bool,
495
+ include_heartbeat_details: bool,
496
+ include_last_failure: bool,
489
497
  rpc_options: RPCOptions?
490
498
  ) -> void
491
499
  end
@@ -518,6 +526,54 @@ module Temporalio
518
526
  ) -> void
519
527
  end
520
528
 
529
+ class PauseActivityInput
530
+ attr_reader activity_id: String
531
+ attr_reader activity_run_id: String?
532
+ attr_reader reason: String?
533
+ attr_reader rpc_options: RPCOptions?
534
+
535
+ def initialize: (
536
+ activity_id: String,
537
+ activity_run_id: String?,
538
+ reason: String?,
539
+ rpc_options: RPCOptions?
540
+ ) -> void
541
+ end
542
+
543
+ class UnpauseActivityInput
544
+ attr_reader activity_id: String
545
+ attr_reader activity_run_id: String?
546
+ attr_reader reason: String?
547
+ attr_reader jitter: Float?
548
+ attr_reader rpc_options: RPCOptions?
549
+
550
+ def initialize: (
551
+ activity_id: String,
552
+ activity_run_id: String?,
553
+ reason: String?,
554
+ jitter: Float?,
555
+ rpc_options: RPCOptions?
556
+ ) -> void
557
+ end
558
+
559
+ class UpdateActivityOptionsInput
560
+ attr_reader activity_id: String
561
+ attr_reader activity_run_id: String?
562
+ attr_reader activity_options: untyped
563
+ attr_reader update_mask: untyped
564
+ attr_reader restore_original: bool
565
+ attr_reader rpc_options: RPCOptions?
566
+
567
+ def initialize: (
568
+ activity_id: String,
569
+ activity_run_id: String?,
570
+ activity_options: untyped,
571
+ update_mask: untyped,
572
+ restore_original: bool,
573
+ rpc_options: RPCOptions?
574
+ ) -> void
575
+ end
576
+
521
577
  class ListActivitiesInput
522
578
  attr_reader query: String
523
579
  attr_reader rpc_options: RPCOptions?
@@ -611,6 +667,12 @@ module Temporalio
611
667
 
612
668
  def terminate_activity: (TerminateActivityInput input) -> void
613
669
 
670
+ def pause_activity: (PauseActivityInput input) -> void
671
+
672
+ def unpause_activity: (UnpauseActivityInput input) -> void
673
+
674
+ def update_activity_options: (UpdateActivityOptionsInput input) -> untyped
675
+
614
676
  def list_activities: (ListActivitiesInput input) -> Enumerator[ActivityExecution, ActivityExecution]
615
677
 
616
678
  def count_activities: (CountActivitiesInput input) -> ActivityExecutionCount
@@ -22,6 +22,13 @@ module Temporalio
22
22
 
23
23
  def terminate_activity: (Temporalio::Client::Interceptor::TerminateActivityInput input) -> void
24
24
 
25
+ def pause_activity: (Temporalio::Client::Interceptor::PauseActivityInput input) -> void
26
+
27
+ def unpause_activity: (Temporalio::Client::Interceptor::UnpauseActivityInput input) -> void
28
+
29
+
30
+ def update_activity_options: (Temporalio::Client::Interceptor::UpdateActivityOptionsInput input) -> untyped
31
+
25
32
  def list_activities: (Temporalio::Client::Interceptor::ListActivitiesInput input) -> Enumerator[Temporalio::Client::ActivityExecution, Temporalio::Client::ActivityExecution]
26
33
 
27
34
  def count_activities: (Temporalio::Client::Interceptor::CountActivitiesInput input) -> Temporalio::Client::ActivityExecutionCount
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: temporalio
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Temporal Technologies Inc
@@ -143,9 +143,11 @@ files:
143
143
  - lib/temporalio/client.rb
144
144
  - lib/temporalio/client/activity_execution.rb
145
145
  - lib/temporalio/client/activity_execution_count.rb
146
+ - lib/temporalio/client/activity_execution_options.rb
146
147
  - lib/temporalio/client/activity_execution_status.rb
147
148
  - lib/temporalio/client/activity_handle.rb
148
149
  - lib/temporalio/client/activity_id_reference.rb
150
+ - lib/temporalio/client/activity_options.rb
149
151
  - lib/temporalio/client/async_activity_handle.rb
150
152
  - lib/temporalio/client/connection.rb
151
153
  - lib/temporalio/client/connection/cloud_service.rb
@@ -364,9 +366,11 @@ files:
364
366
  - rbi/temporalio/client.rbi
365
367
  - rbi/temporalio/client/activity_execution.rbi
366
368
  - rbi/temporalio/client/activity_execution_count.rbi
369
+ - rbi/temporalio/client/activity_execution_options.rbi
367
370
  - rbi/temporalio/client/activity_execution_status.rbi
368
371
  - rbi/temporalio/client/activity_handle.rbi
369
372
  - rbi/temporalio/client/activity_id_reference.rbi
373
+ - rbi/temporalio/client/activity_options.rbi
370
374
  - rbi/temporalio/client/async_activity_handle.rbi
371
375
  - rbi/temporalio/client/connection.rbi
372
376
  - rbi/temporalio/client/connection/cloud_service.rbi
@@ -583,9 +587,11 @@ files:
583
587
  - sig/temporalio/client.rbs
584
588
  - sig/temporalio/client/activity_execution.rbs
585
589
  - sig/temporalio/client/activity_execution_count.rbs
590
+ - sig/temporalio/client/activity_execution_options.rbs
586
591
  - sig/temporalio/client/activity_execution_status.rbs
587
592
  - sig/temporalio/client/activity_handle.rbs
588
593
  - sig/temporalio/client/activity_id_reference.rbs
594
+ - sig/temporalio/client/activity_options.rbs
589
595
  - sig/temporalio/client/async_activity_handle.rbs
590
596
  - sig/temporalio/client/connection.rbs
591
597
  - sig/temporalio/client/connection/cloud_service.rbs