aws-flow 1.0.8 → 1.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/Rakefile +18 -31
  4. data/aws-flow.gemspec +1 -1
  5. data/lib/aws/decider.rb +1 -2
  6. data/lib/aws/decider/activity.rb +99 -53
  7. data/lib/aws/decider/activity_definition.rb +43 -7
  8. data/lib/aws/decider/async_decider.rb +56 -57
  9. data/lib/aws/decider/async_retrying_executor.rb +4 -5
  10. data/lib/aws/decider/data_converter.rb +2 -2
  11. data/lib/aws/decider/decider.rb +46 -41
  12. data/lib/aws/decider/decision_context.rb +2 -2
  13. data/lib/aws/decider/exceptions.rb +6 -6
  14. data/lib/aws/decider/executor.rb +15 -11
  15. data/lib/aws/decider/flow_defaults.rb +54 -22
  16. data/lib/aws/decider/generic_client.rb +7 -7
  17. data/lib/aws/decider/history_helper.rb +0 -0
  18. data/lib/aws/decider/implementation.rb +5 -5
  19. data/lib/aws/decider/options.rb +285 -155
  20. data/lib/aws/decider/state_machines.rb +10 -10
  21. data/lib/aws/decider/task_handler.rb +5 -5
  22. data/lib/aws/decider/task_poller.rb +152 -15
  23. data/lib/aws/decider/utilities.rb +14 -14
  24. data/lib/aws/decider/version.rb +1 -1
  25. data/lib/aws/decider/worker.rb +21 -20
  26. data/lib/aws/decider/workflow_client.rb +78 -31
  27. data/lib/aws/decider/workflow_clock.rb +1 -1
  28. data/lib/aws/decider/workflow_definition.rb +5 -5
  29. data/lib/aws/decider/workflow_definition_factory.rb +1 -1
  30. data/lib/aws/decider/workflow_enabled.rb +1 -1
  31. data/lib/aws/flow/async_backtrace.rb +19 -18
  32. data/lib/aws/flow/async_scope.rb +32 -16
  33. data/lib/aws/flow/begin_rescue_ensure.rb +61 -56
  34. data/lib/aws/flow/fiber.rb +14 -6
  35. data/lib/aws/flow/flow_utils.rb +9 -6
  36. data/lib/aws/flow/future.rb +43 -18
  37. data/lib/aws/flow/implementation.rb +34 -18
  38. data/lib/aws/flow/simple_dfa.rb +12 -4
  39. data/lib/aws/flow/tasks.rb +120 -86
  40. data/{test/aws → spec/aws/integration}/integration_spec.rb +0 -0
  41. data/{test/aws → spec/aws/unit}/async_backtrace_spec.rb +1 -0
  42. data/{test/aws → spec/aws/unit}/async_scope_spec.rb +0 -0
  43. data/{test/aws → spec/aws/unit}/begin_rescue_ensure_spec.rb +90 -2
  44. data/{test/aws → spec/aws/unit}/decider_spec.rb +41 -53
  45. data/{test/aws → spec/aws/unit}/external_task_spec.rb +0 -0
  46. data/{test/aws → spec/aws/unit}/factories.rb +0 -0
  47. data/{test/aws → spec/aws/unit}/fiber_condition_variable_spec.rb +0 -0
  48. data/{test/aws → spec/aws/unit}/fiber_spec.rb +0 -0
  49. data/{test/aws → spec/aws/unit}/flow_spec.rb +0 -0
  50. data/{test/aws → spec/aws/unit}/future_spec.rb +0 -0
  51. data/{test/aws → spec/aws/unit}/preinclude_tests.rb +0 -0
  52. data/{test/aws → spec/aws/unit}/rubyflow.rb +0 -0
  53. data/{test/aws → spec/aws/unit}/simple_dfa_spec.rb +0 -0
  54. data/{test/aws → spec}/spec_helper.rb +0 -0
  55. metadata +30 -30
@@ -47,7 +47,7 @@ module AWS
47
47
  method_names.each { |method_name| @option_map[method_name.to_sym] = options }
48
48
  end
49
49
 
50
- # @!visibility private
50
+ # @api private
51
51
  def bail_if_external
52
52
  raise "You cannot use this function outside of a workflow definition" if Utilities::is_external
53
53
  end
@@ -73,10 +73,10 @@ module AWS
73
73
  #
74
74
  def send_async(task, *args, &block)
75
75
  bail_if_external
76
- # If there is no block, just make a block for immediate return
76
+ # If there is no block, just make a block for immediate return.
77
77
  if block.nil?
78
78
  modified_options = Proc.new{ {:return_on_start => true } }
79
- # If there is a block, and it doesn't take any arguments, it will evaluate to a hash. Add an option to the hash
79
+ # If there is a block, and it doesn't take any arguments, it will evaluate to a hash. Add an option to the hash.
80
80
  elsif block.arity == 0
81
81
  modified_options = Proc.new do
82
82
  result = block.call
@@ -87,7 +87,7 @@ module AWS
87
87
  end
88
88
  # Otherwise, it will expect an options object passed in, and will do
89
89
  # things on that object. So make our new Proc do that, and add an
90
- # option
90
+ # option.
91
91
  else modified_options = Proc.new do |x|
92
92
  result = block.call(x)
93
93
  # Same as the above dup, we'll copy to avoid any possible mutation
@@ -110,7 +110,7 @@ module AWS
110
110
 
111
111
 
112
112
  # Used by {#retry}
113
- # @!visibility private
113
+ # @api private
114
114
  def _retry_with_options(lambda_to_execute, retry_function, retry_options, args = NoInput.new)
115
115
  retry_policy = RetryPolicy.new(retry_function, retry_options)
116
116
  output = Utilities::AddressableFuture.new
@@ -143,7 +143,7 @@ module AWS
143
143
  #
144
144
  # @param (see #retry)
145
145
  #
146
- # @!visibility private
146
+ # @api private
147
147
  def _retry(method_name, retry_function, block, args = NoInput.new)
148
148
  bail_if_external
149
149
  retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
@@ -157,7 +157,7 @@ module AWS
157
157
  # The activity to retry.
158
158
  #
159
159
  # @param retry_function
160
- # The retry function to use
160
+ # The retry function to use.
161
161
  #
162
162
  # @param args
163
163
  # Arguments to send to the method named in the `method_name` parameter.
File without changes
@@ -16,16 +16,16 @@
16
16
  module AWS
17
17
  module Flow
18
18
 
19
- # Creates a new {WorkflowClient} instance
19
+ # Creates a new {WorkflowClient} instance.
20
20
  #
21
21
  # @param service
22
- # A {http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow.html SWF service} reference. This is usually
22
+ # An {http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow.html Amazon SWF service} reference. This is usually
23
23
  # created with:
24
24
  #
25
25
  # swf = AWS::SimpleWorkflow.new
26
26
  #
27
27
  # @param domain
28
- # The SWF {http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html Domain} to use for this
28
+ # The Amazon SWF {http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html Domain} to use for this
29
29
  # workflow client. This is usually created on the service object, such as:
30
30
  #
31
31
  # domain = swf.domains.create('my-domain', 10)
@@ -68,13 +68,13 @@ module AWS
68
68
 
69
69
  module_function :with_retry
70
70
 
71
- # @!visibility private
71
+ # @api private
72
72
  def self.workflow_client(service = nil, domain = nil, &block)
73
73
  options = Utilities::interpret_block_for_options(StartWorkflowOptions, block)
74
74
  if ! Utilities::is_external
75
75
  service = AWS::SimpleWorkflow.new
76
76
  # So, we probably shouldn't be doing this, but we need to slightly
77
- # redesign where this is available from
77
+ # redesign where this is available from.
78
78
  domain = FlowFiber.current[:decision_context].workflow_context.decision_task.workflow_execution.domain
79
79
  else
80
80
  if service.nil? || domain.nil?
@@ -18,6 +18,8 @@ module AWS
18
18
 
19
19
  # The base class for option defaults in the AWS Flow Framework for Ruby.
20
20
  class Defaults
21
+
22
+ # @api private
21
23
  def method_missing(method_name, *args, &block)
22
24
  return nil
23
25
  end
@@ -27,11 +29,14 @@ module AWS
27
29
  class Options
28
30
  extend Utilities::UpwardLookups
29
31
  include Utilities::UpwardLookups::InstanceMethods
32
+
33
+ # @api private
30
34
  def method_missing(method_name, *args, &block)
31
35
  return nil
32
36
  end
33
37
 
34
- # Sets the default classes on a child class (a class derived from {Options}).
38
+ # Sets the default classes on a child class (a class derived from
39
+ # {Options}).
35
40
  def self.inherited(child)
36
41
  child.precursors ||= []
37
42
  default_classes = child.ancestors.map do |precursor|
@@ -40,23 +45,27 @@ module AWS
40
45
  child.instance_variable_set("@default_classes", default_classes)
41
46
  end
42
47
 
48
+ # @api private
43
49
  class << self
44
- # The set of default options. These are used when `use_defaults` is set to `true` on {#initialize}.
50
+ # The set of default options. These are used when `use_defaults` is set
51
+ # to `true` on {#initialize}.
45
52
  attr_accessor :default_classes
46
53
  end
47
54
 
48
- # Merges specified options with the set of options already held by the class, and returns the result.
55
+ # Merges specified options with the set of options already held by the
56
+ # class, and returns the result.
49
57
  #
50
58
  # @return [Hash]
51
59
  # The merged set of options, defined as a hash.
52
60
  #
53
61
  # @param [Options] options
54
- # An {Options}-derived class containing a set of options to use if this instance has no options, or options to
55
- # add to this one if this instance already has options.
62
+ # An {Options}-derived class containing a set of options to use if this
63
+ # instance has no options, or options to add to this one if this
64
+ # instance already has options.
56
65
  #
57
66
  # @param [Hash] extra_to_add
58
- # A hash containing extra options to merge with the options held by the class and those provided in the
59
- # +options+ parameter.
67
+ # A hash containing extra options to merge with the options held by the
68
+ # class and those provided in the `options` parameter.
60
69
  #
61
70
  def get_options(options, extra_to_add = {})
62
71
  options = self.class.held_properties.compact if options.empty?
@@ -69,12 +78,14 @@ module AWS
69
78
  # Creates a new {Options} instance.
70
79
  #
71
80
  # @param [Hash] hash
72
- # A hash of values to use as the default options for this instance. The members of this hash are defined by
73
- # classes derived from {Options}.
81
+ # *Optional*. A hash of values to use as the default options for this
82
+ # instance. The members of this hash are defined by classes derived from
83
+ # {Options}.
74
84
  #
75
85
  # @param [true, false] use_defaults
76
- # In derived classes, this parameter is used to tell the constructor to use the set of default options as the
77
- # runtime options. This has no effect in the base {Options} class.
86
+ # *Optional*. In derived classes, this parameter is used to tell the
87
+ # constructor to use the set of default options as the runtime options.
88
+ # This has no effect in the base {Options} class.
78
89
  #
79
90
  def initialize(hash={}, use_defaults = false)
80
91
  @precursors ||= []
@@ -91,20 +102,38 @@ module AWS
91
102
 
92
103
  end
93
104
 
105
+ # Defaults for the {WorkerOptions} class.
106
+ #
94
107
  class WorkerDefaults < Defaults
108
+
109
+ # Whether to use Ruby's `fork` for launching new workers. The default is
110
+ # `true`. On Windows, you should override this default value and set
111
+ # `use_forking` to `false`.
112
+ #
113
+ # @return [Boolean]
114
+ # Returns `true`.
115
+ #
95
116
  def use_forking; true; end
96
117
  end
97
118
 
98
- # Options for Activity and Workflow workers.
119
+ # Options for activity and workflow workers.
99
120
  #
100
121
  # @!attribute logger
101
122
  # The logger to use for the worker.
102
123
  #
103
- # @!attribute poller_workers
104
- # The logger to use for the worker.
105
- #
106
124
  # @!attribute execution_workers
107
- # The logger to use for the worker.
125
+ # The maximum number of execution workers that can be running at once. You
126
+ # can set this to zero or `nil`, in which case the default value of 20
127
+ # will be used.
128
+ #
129
+ # @!attribute use_forking
130
+ # Whether to use Ruby's `fork` for launching new workers. The default is
131
+ # `true`.
132
+ #
133
+ # On Windows, this should be set to `false` unless you are running Ruby
134
+ # under Cygwin. For more information, see [Important
135
+ # Notes](http://docs.aws.amazon.com/amazonswf/latest/awsrbflowguide/important-notes.html#forking-windows-note)
136
+ # in the *AWS Flow Framework for Ruby Developer Guide*.
108
137
  #
109
138
  class WorkerOptions < Options
110
139
  property(:logger, [])
@@ -115,25 +144,29 @@ module AWS
115
144
  default_classes << WorkerDefaults.new
116
145
  end
117
146
 
118
- # Options for WorkflowClient#signal_workflow_execution.
147
+ # Options for {WorkflowClient#signal_workflow_execution}.
119
148
  #
120
149
  # @!attribute control
121
- # Optional data attached to the signal that can be used by the workflow execution.
150
+ # Optional data attached to the signal that can be used by the workflow
151
+ # execution.
122
152
  #
123
153
  # @!attribute domain
124
- # *Required*. The name of the domain containing the workflow execution to signal.
154
+ # *Required*. The name of the domain containing the workflow execution to
155
+ # signal.
125
156
  #
126
157
  # @!attribute input
127
- # Data to attach to the WorkflowExecutionSignaled event in the target workflow execution's history.
158
+ # Data to attach to the `WorkflowExecutionSignaled` event in the target
159
+ # workflow execution's history.
128
160
  #
129
161
  # @!attribute run_id
130
162
  # The runId of the workflow execution to signal.
131
163
  #
132
164
  # @!attribute signal_name
133
- # *Required*. The name of the signal. This name must be meaningful to the target workflow.
165
+ # *Required*. The name of the signal. This name must be meaningful to the
166
+ # target workflow.
134
167
  #
135
168
  # @!attribute workflow_id
136
- # *Required*. The workflowId of the workflow execution to signal.
169
+ # *Required*. The workflow ID of the workflow execution to signal.
137
170
  #
138
171
  class SignalWorkflowOptions < Options
139
172
  properties(:input, :signal_name, :run_id, :workflow_id, :control, :domain)
@@ -148,21 +181,32 @@ module AWS
148
181
  end
149
182
  end
150
183
 
151
- # Defaults for {RetryOptions}
184
+ # Defaults for {RetryOptions}.
152
185
  class RetryDefaults < Defaults
153
- # The default maximum number of attempts to make before the task is marked as failed.
186
+
187
+ # The default maximum number of attempts to make before the task is
188
+ # marked as failed.
154
189
  def maximum_attempts; FlowConstants.exponential_retry_maximum_attempts; end
190
+
155
191
  # The default retry function to use.
156
192
  def retry_function; FlowConstants.exponential_retry_function; end
193
+
194
+ # The exceptions that will initiate a retry attempt. The default is to
195
+ # use *all* exceptions.
157
196
  def exceptions_to_include; FlowConstants.exponential_retry_exceptions_to_include; end
197
+
198
+ # The exceptions that will *not* initiate a retry attempt. The default is
199
+ # an empty list; no exceptions are excluded.
158
200
  def exceptions_to_exclude; FlowConstants.exponential_retry_exceptions_to_exclude; end
201
+
159
202
  def backoff_coefficient; FlowConstants.exponential_retry_backoff_coefficient; end
203
+
160
204
  def should_jitter; FlowConstants.should_jitter; end
161
205
  def jitter_function; FlowConstants.jitter_function; end
162
206
  def initial_retry_interval; FlowConstants.exponential_retry_initial_retry_interval; end
163
207
  end
164
208
 
165
- # Retry options used with {GenericClient#retry} and {ActivityClient#exponential_retry}
209
+ # Retry options used with {GenericClient#retry} and {ActivityClient#exponential_retry}.
166
210
  class RetryOptions < Options
167
211
  property(:is_retryable_function, [])
168
212
  property(:initial_retry_interval, [])
@@ -186,7 +230,7 @@ module AWS
186
230
  # The function used to test if the activity is retryable.
187
231
  #
188
232
  # @option hash :exceptions_to_allow [Integer]
189
- # The number of exceptions to allow
233
+ # The number of exceptions to allow.
190
234
  #
191
235
  # @option hash :maximum_attempts [Integer]
192
236
  # The maximum number of attempts to make before the task is marked as failed.
@@ -216,7 +260,7 @@ module AWS
216
260
  super(hash, use_defaults)
217
261
  end
218
262
 
219
- # Tests whether or not this activity can be retried based on the `:exceptions_to_retry` and
263
+ # Tests whether this activity can be retried based on the `:exceptions_to_retry` and
220
264
  # `:exceptions_to_exclude` options.
221
265
  #
222
266
  # @param [Object] failure
@@ -238,16 +282,18 @@ module AWS
238
282
 
239
283
  # Exponential retry options for the {ActivityClient#exponential_retry} method.
240
284
  class ExponentialRetryOptions < RetryOptions
241
- # The backoff coefficient to use. This is a floating point value that is multiplied with the current retry
242
- # interval after every retry attempt. The default value is 2.0, which means that each retry will take twice as
243
- # long as the previous.
244
285
  default_classes << RetryDefaults.new
286
+
287
+ # The backoff coefficient to use. This is a floating point value that is multiplied with the current retry
288
+ # interval after every retry attempt. The default value is `2.0`, which means that each retry will take twice as
289
+ # long as the previous one.
245
290
  property(:backoff_coefficient, [lambda(&:to_i)])
246
291
 
247
292
  # The retry expiration interval, in seconds. This will be increased after every retry attempt by the factor
248
- # provided in +backoff_coefficient+.
293
+ # provided in `backoff_coefficient`.
249
294
  property(:retry_expiration_interval_seconds, [lambda(&:to_i)])
250
295
 
296
+ # @api private
251
297
  def next_retry_delay_seconds(first_attempt, recorded_failure, attempts)
252
298
  raise IllegalArgumentException "Attempt number is #{attempts}, when it needs to be greater than 1"
253
299
  if @maximum_attempts
@@ -255,82 +301,114 @@ module AWS
255
301
  end
256
302
  end
257
303
 
258
- # Defaults for WorkflowOptions
304
+ # Defaults for `WorkflowOptions`.
259
305
  class WorkflowDefaults < Defaults
260
306
 
261
- # The default task start-to-close timeout duration.
307
+ # The default task start-to-close timeout duration. The default value is
308
+ # `30`.
262
309
  def task_start_to_close_timeout; 30; end
263
310
 
264
- # The default child workflow policy
311
+ # The default child workflow policy. The default value is `TERMINATE`.
265
312
  def child_policy; :TERMINATE; end
266
313
 
267
- # Returns a list of tags (currently an empty array).
314
+ # Returns a list of tags for the workflow. The default value is an empty
315
+ # array (no tags).
268
316
  def tag_list; []; end
269
317
 
318
+ # The default data converter. By default, this is {YAMLDataConverter}.
270
319
  def data_converter; FlowConstants.default_data_converter; end
271
320
  end
272
321
 
273
- # Options for workflows
322
+ # Options for workflows.
274
323
  #
275
324
  # @!attribute child_policy
276
- # The optional policy to use for the child workflow executions when a workflow execution of this type is
277
- # terminated, by calling the TerminateWorkflowExecution action explicitly or due to an expired timeout. This can
278
- # be overridden when starting a workflow execution using the StartWorkflowExecution action or the
279
- # StartChildWorkflowExecution Decision. The supported child policies are:
325
+ # The optional policy to use for the child workflow executions when a
326
+ # workflow execution of this type is terminated, by calling the
327
+ # `TerminateWorkflowExecution` action explicitly or due to an expired
328
+ # timeout.
329
+ #
330
+ # This can be overridden when starting a workflow execution using
331
+ # {WorkflowClient#start_execution} or the `StartChildWorkflowExecution`
332
+ # decision.
280
333
  #
281
- # * *TERMINATE*: the child executions will be terminated.
282
- # * *REQUEST_CANCEL*: a request to cancel will be attempted for each child execution by recording a
283
- # WorkflowExecutionCancelRequested event in its history. It is up to the decider to take appropriate actions
284
- # when it receives an execution history with this event.
285
- # * *ABANDON*: no action will be taken. The child executions will continue to run.
334
+ # The supported child policies are:
286
335
  #
287
- # The default is TERMINATE.
336
+ # * `TERMINATE`: the child executions will be terminated.
337
+ # * `REQUEST_CANCEL`: a request to cancel will be attempted for each child
338
+ # execution by recording a `WorkflowExecutionCancelRequested` event in its
339
+ # history. It is up to the decider to take appropriate actions when it
340
+ # receives an execution history with this event.
341
+ # * `ABANDON`: no action will be taken. The child executions will continue
342
+ # to run.
343
+ #
344
+ # The default is `TERMINATE`.
288
345
  #
289
346
  # @!attribute execution_method
290
- # TBD
291
347
  #
292
348
  # @!attribute execution_start_to_close_timeout
293
- # The optional maximum duration, specified when registering the workflow type, for executions of this workflow
294
- # type. This default can be overridden when starting a workflow execution using the StartWorkflowExecution action
295
- # or the StartChildWorkflowExecution decision.
349
+ # The optional maximum duration, specified when registering the workflow
350
+ # type, for executions of this workflow type.
351
+ #
352
+ # This default can be overridden when starting a workflow execution using
353
+ # {WorkflowClient#start_execution} or with the
354
+ # `StartChildWorkflowExecution` decision.
296
355
  #
297
- # The valid values are integers greater than or equal to 0. An integer value can be used to specify the duration
298
- # in seconds while NONE can be used to specify unlimited duration.
356
+ # The valid values are integers greater than or equal to zero. An integer
357
+ # value can be used to specify the duration in seconds while `NONE` can be
358
+ # used to specify unlimited duration.
299
359
  #
300
360
  # @!attribute input
301
- # A string of up to 32768 characters, to be provided to the workflow execution.
361
+ # A string of up to 32768 characters to be provided to the workflow
362
+ # execution. This will be received in the decider when polling for
363
+ # decision tasks.
302
364
  #
303
365
  # @!attribute tag_list
304
- # The list of tags to associate with the child workflow execution. A maximum of five tags can be specified. You
305
- # can list workflow executions with a specific tag by calling ListOpenWorkflowExecutions or
306
- # ListClosedWorkflowExecutions and specifying a TagFilter.
366
+ # The list of tags to associate with the child workflow execution.
367
+ #
368
+ # A maximum of five tags can be specified. You can list workflow
369
+ # executions with a specific tag by calling
370
+ # [AWS::SimpleWorkflow::Client#list_open_workflow_executions](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html#list_open_workflow_executions-instance_method)
371
+ # or
372
+ # [AWS::SimpleWorkflow::Client#list_closed_workflow_executions](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html#list_closed_workflow_executions-instance_method)
373
+ # and specifying a tag to filter on.
307
374
  #
308
375
  # @!attribute task_list
309
- # The optional task list, specified when registering the workflow type, for decisions tasks scheduled for workflow
310
- # executions of this type. This default can be overridden when starting a workflow execution using the
311
- # StartWorkflowExecution action or the StartChildWorkflowExecution Decision.
376
+ # The optional task list, specified when registering the workflow type,
377
+ # for decisions tasks scheduled for workflow executions of this type.
378
+ #
379
+ # This default can be overridden when starting a workflow execution using
380
+ # {WorkflowClient#start_execution} or the `StartChildWorkflowExecution`
381
+ # decision.
312
382
  #
313
383
  # @!attribute task_start_to_close_timeout
314
- # The optional maximum duration, specified when registering the workflow type, that a decision task for executions
315
- # of this workflow type might take before returning completion or failure. If the task does not close in the
316
- # specified time then the task is automatically timed out and rescheduled. If the decider eventually reports a
317
- # completion or failure, it is ignored. This default can be overridden when starting a workflow execution using
318
- # the StartWorkflowExecution action or the StartChildWorkflowExecution Decision.
384
+ # The optional maximum duration, specified when registering the workflow
385
+ # type, that a decision task for executions of this workflow type might
386
+ # take before returning completion or failure.
319
387
  #
320
- # The valid values are integers greater than or equal to 0. An integer value can be used to specify the duration
321
- # in seconds while NONE can be used to specify unlimited duration.
388
+ # If the task does not close in the specified time, then the task is
389
+ # automatically timed out and rescheduled. If the decider eventually
390
+ # reports a completion or failure, it is ignored. This default can be
391
+ # overridden when starting a workflow execution using
392
+ # {WorkflowClient#start_execution} or the `StartChildWorkflowExecution`
393
+ # decision.
322
394
  #
323
- # The default is 30.
395
+ # The valid values are integers greater than or equal to 0. An integer
396
+ # value can be used to specify the duration in seconds while `NONE` can be
397
+ # used to specify unlimited duration. The default is `30`.
324
398
  #
325
399
  # @!attribute version
326
- # The version of the Workflow. If you update any of these options, you must update the version.
400
+ # A string that represents the version of the workflow. This can be any
401
+ # alphanumeric string. If you update any of the other options, you must
402
+ # also update the version.
327
403
  #
328
404
  # @!attribute workflow_id
329
- # *Required*. The workflow id of the workflow execution.
405
+ # *Required*. The workflow ID of the workflow execution. The workflow ID
406
+ # must follow these rules:
330
407
  #
331
- # The specified string must not start or end with whitespace. It must not contain a `:` (colon), `/` (slash), `|`
332
- # (vertical bar), or any control characters (\u0000-\u001f | \u007f - \u009f). Also, it must not contain the
333
- # literal string "arn".
408
+ # * The specified string must not start or end with whitespace.
409
+ # * It must not contain a `:` (colon), `/` (slash), `|` (vertical bar), or
410
+ # any control characters (`\u0000`-`\u001f` | `\u007f`-`\u009f`).
411
+ # * It must not contain the literal string "arn".
334
412
  #
335
413
  class WorkflowOptions < Options
336
414
  properties(:version, :input, :workflow_id, :execution_start_to_close_timeout, :task_start_to_close_timeout, :task_list, :execution_method)
@@ -341,7 +419,7 @@ module AWS
341
419
 
342
420
  # Returns a hash containing the runtime workflow options.
343
421
  #
344
- # @return [Hash] a hash of options with corresponding values.
422
+ # @return [Hash] A hash of options with corresponding values.
345
423
  #
346
424
  def get_full_options
347
425
  result = {}
@@ -354,63 +432,84 @@ module AWS
354
432
  end
355
433
  end
356
434
 
435
+ # Provides the set of workflow options along with defaults.
436
+ #
437
+ # @!attribute default_task_start_to_close_timeout
438
+ # (see WorkflowDefaults#task_start_to_close_timeout)
439
+ #
440
+ # @!attribute default_execution_start_to_close_timeout
441
+ # (see WorkflowDefaults#execution_start_to_close_timeout)
442
+ #
443
+ # @!attribute default_task_list
444
+ # (see WorkflowOptions#task_list)
445
+ #
446
+ # @!attribute default_child_policy
447
+ # (see WorkflowDefaults#child_policy)
448
+ #
357
449
  class WorkflowOptionsWithDefaults < WorkflowOptions
358
450
  properties(:default_task_start_to_close_timeout, :default_execution_start_to_close_timeout, :default_task_list)
359
451
  property(:default_child_policy, [lambda(&:to_s), lambda(&:upcase)])
360
452
  end
361
453
 
362
- # Options for #start_workflow
454
+ # Options for {WorkflowClient#start_execution}.
363
455
  #
364
456
  # @!attribute workflow_name
365
457
  # The name of this workflow.
366
458
  #
367
459
  # @!attribute from_class
368
- # If present, options from the specified class will be used as the workflow execution options.
460
+ # If present, options from the specified class will be used as the
461
+ # workflow execution options.
369
462
  #
370
463
  class StartWorkflowOptions < WorkflowOptions
371
464
  properties(:workflow_name, :from_class)
372
465
  end
373
466
 
374
- # Options for {AsyncDecider#continue_as_new_workflow} and {Workflows.InstanceMethods#continue_as_new}.
467
+ # Options for {AsyncDecider#continue_as_new_workflow} and
468
+ # {Workflows.InstanceMethods#continue_as_new}.
375
469
  #
376
470
  class ContinueAsNewOptions < WorkflowOptions
377
471
  end
378
472
 
379
- # Defaults for the {ActivityOptions} class
473
+ # Defaults for the {ActivityOptions} class.
380
474
  class ActivityDefaults < Defaults
381
475
 
382
- # The default Schedule to Close timeout for activity tasks. This timeout represents the time, in seconds, between
383
- # when the activity task is first scheduled to when it is closed (whether due to success, failure, or a timeout).
476
+ # The default schedule-to-close timeout for activity tasks. This timeout
477
+ # represents the time, in seconds, between when the activity task is first
478
+ # scheduled to when it is closed (whether due to success, failure, or a
479
+ # timeout).
384
480
  #
385
- # This default can be overridden when scheduling an activity task. You can set this value to "NONE" to imply no
386
- # timeout value.
481
+ # This default can be overridden when scheduling an activity task. You can
482
+ # set this value to "NONE" to imply no timeout value.
387
483
  #
388
484
  def default_task_schedule_to_close_timeout; Float::INFINITY; end
389
485
 
390
- # The default maximum time in seconds before which a worker processing a task of this type must report progress.
391
- # If the timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to
392
- # record a heartbeat or returns a result, it will be ignored.
486
+ # The default maximum time, in seconds, before which a worker processing a
487
+ # task of this type must report progress. If the timeout is exceeded, the
488
+ # activity task is automatically timed out. If the worker subsequently
489
+ # attempts to record a heartbeat or returns a result, it will be ignored.
393
490
  #
394
- # This default can be overridden when scheduling an activity task. You can set this value to "NONE" to imply no
395
- # timeout value.
491
+ # This default can be overridden when scheduling an activity task. You can
492
+ # set this value to "NONE" to imply no timeout value.
396
493
  #
397
494
  def default_task_heartbeat_timeout; Float::INFINITY; end
398
495
 
399
- # The default Schedule to Close timeout. This timeout represents the time between when the activity task is first
400
- # scheduled to when it is closed (whether due to success, failure, or a timeout).
496
+ # The default schedule-to-close timeout. This timeout represents the time
497
+ # between when the activity task is first scheduled to when it is closed
498
+ # (whether due to success, failure, or a timeout).
401
499
  #
402
- # This default can be overridden when scheduling an activity task. You can set this value to "NONE" to imply no
403
- # timeout value.
500
+ # This default can be overridden when scheduling an activity task. You can
501
+ # set this value to "NONE" to imply no timeout value.
404
502
  #
405
503
  def schedule_to_close_timeout; Float::INFINITY; end
406
504
 
407
- # The default maximum time before which a worker processing a task of this type must report progress. If the
408
- # timeout is exceeded, the activity task is automatically timed out. If the worker subsequently attempts to record
409
- # a heartbeat or returns a result, it will be ignored. This default can be overridden when scheduling an activity
410
- # task.
505
+ # The default maximum time before which a worker processing a task of this
506
+ # type must report progress. If the timeout is exceeded, the activity task
507
+ # is automatically timed out. If the worker subsequently attempts to
508
+ # record a heartbeat or returns a result, it will be ignored. This default
509
+ # can be overridden when scheduling an activity task.
411
510
  #
412
- # This default can be overridden when scheduling an activity task. You can set this value to "NONE" to imply no
413
- # timeout value.
511
+ # This default can be overridden when scheduling an activity task. You can
512
+ # set this value to "NONE" to imply no timeout value.
414
513
  #
415
514
  def heartbeat_timeout; Float::INFINITY; end
416
515
 
@@ -421,47 +520,54 @@ module AWS
421
520
  # Options to use on an activity or decider. The following options are defined:
422
521
  #
423
522
  # @!attribute default_task_heartbeat_timeout
424
- #
425
- # The optional default maximum time, specified when registering the activity type, before which a worker
426
- # processing a task must report progress by calling
523
+ # The optional default maximum time, specified when registering the
524
+ # activity type, before which a worker processing a task must report
525
+ # progress by calling
427
526
  # {http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/ActivityTask.html#record_heartbeat!-instance_method
428
- # record_heartbeat} on the ActivityTask.
527
+ # record_heartbeat} on the `ActivityTask`.
429
528
  #
430
- # You can override this default when scheduling a task through the ScheduleActivityTask Decision. If the
431
- # activity worker subsequently attempts to record a heartbeat or returns a result, the activity worker receives
432
- # an UnknownResource fault. In this case, Amazon SWF no longer considers the activity task to be valid; the
433
- # activity worker should clean up the activity task.
529
+ # You can override this default when scheduling a task through the
530
+ # `ScheduleActivityTask` decision. If the activity worker subsequently
531
+ # attempts to record a heartbeat or returns a result, the activity worker
532
+ # receives an UnknownResource fault. In this case, Amazon SWF no longer
533
+ # considers the activity task to be valid; the activity worker should
534
+ # clean up the activity task.
434
535
  #
435
- # The valid values are integers greater than or equal to zero. An integer value can be used to specify the
436
- # duration in seconds while "NONE" can be used to specify unlimited duration.
536
+ # The valid values are integers greater than or equal to zero. An integer
537
+ # value can be used to specify the duration in seconds while "NONE" can be
538
+ # used to specify unlimited duration.
437
539
  #
438
540
  # @!attribute default_task_list
439
- #
440
- # The optional default task list specified for this activity type at registration. This default task list is
441
- # used if a task list is not provided when a task is scheduled through the ScheduleActivityTask decision. You
442
- # can override this default when scheduling a task through the ScheduleActivityTask decision.
541
+ # The optional default task list specified for this activity type at
542
+ # registration. This default task list is used if a task list is not
543
+ # provided when a task is scheduled through the `ScheduleActivityTask`
544
+ # decision. You can override this default when scheduling a task through
545
+ # the `ScheduleActivityTask` decision.
443
546
  #
444
547
  # @!attribute default_task_schedule_to_close_timeout
548
+ # The optional default maximum duration, specified when registering the
549
+ # activity type, for tasks of this activity type. You can override this
550
+ # default when scheduling a task through the `ScheduleActivityTask`
551
+ # decision.
445
552
  #
446
- # The optional default maximum duration, specified when registering the activity type, for tasks of this
447
- # activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
448
- #
449
- # The valid values are integers greater than or equal to zero, or the string "NONE". An integer value can be
450
- # used to specify the duration in seconds while "NONE" is be used to specify *unlimited* duration.
553
+ # The valid values are integers greater than or equal to zero, or the
554
+ # string "NONE". An integer value can be used to specify the duration in
555
+ # seconds while "NONE" is be used to specify *unlimited* duration.
451
556
  #
452
557
  # @!attribute default_task_schedule_to_start_timeout
453
- #
454
- # The optional default maximum duration, specified when registering the activity type, that a task of an
455
- # activity type can wait before being assigned to a worker. You can override this default when scheduling a task
456
- # through the ScheduleActivityTask decision.
558
+ # The optional default maximum duration, specified when registering the
559
+ # activity type, that a task of an activity type can wait before being
560
+ # assigned to a worker. You can override this default when scheduling a
561
+ # task through the `ScheduleActivityTask` decision.
457
562
  #
458
563
  # @!attribute default_task_start_to_close_timeout
564
+ # The optional default maximum duration for tasks of an activity type
565
+ # specified when registering the activity type. You can override this
566
+ # default when scheduling a task through the `ScheduleActivityTask`
567
+ # decision.
459
568
  #
460
- # The optional default maximum duration for tasks of an activity type specified when registering the activity
461
- # type. You can override this default when scheduling a task through the ScheduleActivityTask decision.
462
569
  class ActivityOptions < Options
463
- # The default options for the activity. These can be specified when creating a new ActivityOptions instance.
464
- #
570
+
465
571
  class << self
466
572
  attr_reader :default_options, :runtime_options
467
573
  end
@@ -471,55 +577,78 @@ module AWS
471
577
 
472
578
  default_classes << ActivityDefaults.new
473
579
 
474
- # Gets the activity prefix name
475
- # @return [String] the activity name
580
+ # Gets the activity prefix name.
581
+ #
582
+ # @return [String]
583
+ # The activity name.
584
+ #
476
585
  def activity_name
477
586
  @prefix_name
478
587
  end
479
588
 
480
- # Sets the activity prefix name
481
- # @param [String] value the activity name to set
589
+ # Sets the activity prefix name.
590
+ #
591
+ # @param [String] value
592
+ # The activity name to set.
593
+ #
482
594
  def activity_name=(value)
483
595
  @prefix_name = value
484
596
  end
485
597
 
486
- # Creates a new set of ActivityOptions
598
+ # Creates a new set of `ActivityOptions`.
487
599
  #
488
600
  # @param [Hash] default_options
489
- # A set of ActivityOptions to use as the default values.
601
+ # A set of `ActivityOptions` to use as the default values.
490
602
  #
491
603
  # @option default_options [Integer] :heartbeat_timeout
492
- # The optional default maximum time, specified when registering the activity type, before which a worker
493
- # processing a task must report progress by calling RecordActivityTaskHeartbeat. You can override this default
494
- # when scheduling a task through the ScheduleActivityTask Decision. If the activity worker subsequently attempts
495
- # to record a heartbeat or returns a result, the activity worker receives an UnknownResource fault. In this
496
- # case, Amazon SWF no longer considers the activity task to be valid; the activity worker should clean up the
497
- # activity task.
604
+ # The optional default maximum time, specified when registering the
605
+ # activity type, before which a worker processing a task must report
606
+ # progress by calling `RecordActivityTaskHeartbeat`.
607
+ #
608
+ # You can override this default when scheduling a task through the
609
+ # `ScheduleActivityTask` decision. If the activity worker subsequently
610
+ # attempts to record a heartbeat or returns a result, the activity
611
+ # worker receives an UnknownResource fault. In this case, Amazon SWF no
612
+ # longer considers the activity task to be valid; the activity worker
613
+ # should clean up the activity task.
498
614
  #
499
615
  # @option default_options [Integer] :schedule_to_close_timeout
500
- # The optional default maximum duration, specified when registering the activity type, for tasks of this
501
- # activity type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
616
+ # The optional default maximum duration, specified when registering the
617
+ # activity type, for tasks of this activity type.
618
+ #
619
+ # You can override this default when scheduling a task through the
620
+ # `ScheduleActivityTask` decision.
502
621
  #
503
622
  # @option default_options [Integer] :schedule_to_start_timeout
504
- # The optional default maximum duration, specified when registering the activity type, that a task of an
505
- # activity type can wait before being assigned to a worker. You can override this default when scheduling a task
506
- # through the ScheduleActivityTask Decision.
623
+ # The optional default maximum duration, specified when registering the
624
+ # activity type, that a task of an activity type can wait before being
625
+ # assigned to a worker.
626
+ #
627
+ # You can override this default when scheduling a task through the
628
+ # `ScheduleActivityTask` decision.
507
629
  #
508
630
  # @option default_options [Integer] :start_to_close_timeout
509
- # The optional default maximum duration for tasks of an activity type specified when registering the activity
510
- # type. You can override this default when scheduling a task through the ScheduleActivityTask Decision.
631
+ # The optional default maximum duration for tasks of an activity type
632
+ # specified when registering the activity type.
633
+ #
634
+ # You can override this default when scheduling a task through the
635
+ # `ScheduleActivityTask` decision.
511
636
  #
512
637
  # @option default_options [Array] :task_list
513
- # The optional default task list specified for this activity type at registration. This default task list is
514
- # used if a task list is not provided when a task is scheduled through the ScheduleActivityTask Decision. You
515
- # can override this default when scheduling a task through the ScheduleActivityTask Decision.
638
+ # The optional default task list specified for this activity type at
639
+ # registration. This default task list is used if a task list is not
640
+ # provided when a task is scheduled through the ScheduleActivityTask
641
+ # decision.
642
+ #
643
+ # You can override this default when scheduling a task through the
644
+ # `ScheduleActivityTask` decision.
516
645
  #
517
646
  # @option default_options [String] :version
518
- # The version of this Activity. If you change any other options on the activity, you must also change the
519
- # version.
647
+ # The version of this activity. If you change any other options on the
648
+ # activity, you must also change the version.
520
649
  #
521
650
  # @param [true, false] use_defaults
522
- # Set to `true` to use the pre-defined default ActivityOptions.
651
+ # Set to `true` to use the pre-defined {ActivityDefaults}.
523
652
  #
524
653
  def initialize(default_options={}, use_defaults=false)
525
654
  if default_options.keys.include? :exponential_retry
@@ -528,7 +657,7 @@ module AWS
528
657
  super(default_options, use_defaults)
529
658
  end
530
659
 
531
- # Retrieves the runtime options for this Activity. The runtime options returned are:
660
+ # Retrieves the runtime options for this activity. The runtime options returned are:
532
661
  #
533
662
  # * :heartbeat_timeout
534
663
  # * :task_list
@@ -555,14 +684,14 @@ module AWS
555
684
  # Retries the supplied block with exponential retry logic.
556
685
  #
557
686
  # @param [Hash] block
558
- # A hash of ExponentialRetryOptions.
687
+ # A hash of {ExponentialRetryOptions}.
559
688
  #
560
689
  def exponential_retry(&block)
561
690
  retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
562
691
  @_exponential_retry = retry_options
563
692
  end
564
693
 
565
- # Retrieves the runtime options for this Activity.
694
+ # Retrieves the runtime options for this activity.
566
695
  #
567
696
  # @return [Hash]
568
697
  # A hash containing the runtime option names and their current values.
@@ -575,7 +704,7 @@ module AWS
575
704
  options_hash
576
705
  end
577
706
 
578
- # Retrieves the default options for this Activity.
707
+ # Retrieves the default options for this activity.
579
708
  #
580
709
  # @return [Hash]
581
710
  # A hash containing the default option names and their current values.
@@ -592,16 +721,17 @@ module AWS
592
721
  end
593
722
  end
594
723
 
595
- # Runtime options for an Activity.
724
+ # Runtime options for an activity.
596
725
  class ActivityRuntimeOptions < ActivityOptions
597
726
 
598
727
  # Creates a new set of runtime options based on a set of default options.
599
728
  #
600
729
  # @param [ActivityOptions] default_options
601
- # The default {ActivityOptions} to use to set the values of the runtime options in this class.
730
+ # The default {ActivityOptions} to use to set the values of the runtime
731
+ # options in this class.
602
732
  #
603
733
  # @param [true, false] use_defaults
604
- # Set to `true` to use the default runtime options for the Activity.
734
+ # Set to `true` to use the default runtime options for the activity.
605
735
  #
606
736
  def initialize(default_options = {}, use_defaults=false)
607
737
  super(default_options, use_defaults)