aws-flow 1.3.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/aws-flow.gemspec +1 -0
- data/lib/aws/decider/activity.rb +8 -6
- data/lib/aws/decider/async_decider.rb +1 -0
- data/lib/aws/decider/async_retrying_executor.rb +3 -3
- data/lib/aws/decider/decider.rb +16 -14
- data/lib/aws/decider/executor.rb +35 -22
- data/lib/aws/decider/flow_defaults.rb +28 -14
- data/lib/aws/decider/generic_client.rb +3 -4
- data/lib/aws/decider/options.rb +91 -117
- data/lib/aws/decider/state_machines.rb +1 -0
- data/lib/aws/decider/utilities.rb +15 -0
- data/lib/aws/decider/version.rb +1 -1
- data/lib/aws/decider/worker.rb +14 -8
- data/lib/aws/decider/workflow_client.rb +16 -11
- data/lib/aws/runner.rb +43 -39
- data/spec/aws/decider/integration/activity_spec.rb +345 -0
- data/spec/aws/{integration → decider/integration}/integration_spec.rb +818 -1183
- data/spec/aws/decider/integration/setup.rb +3 -0
- data/spec/aws/decider/unit/activity_spec.rb +233 -0
- data/spec/aws/decider/unit/async_retrying_executor_spec.rb +131 -0
- data/spec/aws/{unit → decider/unit}/decider_spec.rb +171 -718
- data/spec/aws/decider/unit/executor_spec.rb +123 -0
- data/spec/aws/decider/unit/flow_defaults_spec.rb +62 -0
- data/spec/aws/decider/unit/misc_spec.rb +101 -0
- data/spec/aws/decider/unit/options_spec.rb +289 -0
- data/spec/aws/decider/unit/retry_spec.rb +217 -0
- data/spec/aws/{unit → decider/unit}/rubyflow.rb +0 -0
- data/spec/aws/decider/unit/setup.rb +3 -0
- data/spec/aws/decider/unit/worker_spec.rb +325 -0
- data/spec/aws/decider/unit/workflow_client_spec.rb +83 -0
- data/spec/aws/{unit → flow}/async_backtrace_spec.rb +0 -0
- data/spec/aws/{unit → flow}/async_scope_spec.rb +0 -0
- data/spec/aws/{unit → flow}/begin_rescue_ensure_spec.rb +1 -0
- data/spec/aws/{unit → flow}/external_task_spec.rb +0 -0
- data/spec/aws/{unit → flow}/factories.rb +0 -0
- data/spec/aws/{unit → flow}/fiber_condition_variable_spec.rb +0 -0
- data/spec/aws/{unit → flow}/fiber_spec.rb +0 -0
- data/spec/aws/{unit → flow}/flow_spec.rb +0 -0
- data/spec/aws/{unit → flow}/future_spec.rb +0 -0
- data/spec/aws/{unit → flow}/simple_dfa_spec.rb +0 -0
- data/spec/aws/{integration → runner/integration}/runner_integration_spec.rb +16 -43
- data/spec/aws/{unit → runner/unit}/runner_unit_spec.rb +18 -18
- data/spec/spec_helper.rb +264 -2
- metadata +37 -28
- data/spec/aws/unit/executor_spec.rb +0 -49
- data/spec/aws/unit/options_spec.rb +0 -293
- data/spec/aws/unit/preinclude_tests.rb +0 -149
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
ZDY5Y2FlNWU1YWQ4ODI4OWIzNGVhZDY2Yjg5ZDI5MjExYzQyODgyNg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZjA4MTljNTcwNjNhYWE0MjZlZGVkMjY2YmI4YzE2Y2Y0MGZiM2Q2NQ==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NDU4NzdjNGE1NDRiNDA2NjEzZjc5YmM2NzQ4MWIxMjZhNDA2OWE4MDZiMzI1
|
10
|
+
NzQ0NTY3OWVmMjFmYzQwMzNhMDJhZDI4ODczNjhlMzEwMjMwYWQzOWU0MWNl
|
11
|
+
ODQyNTQ3NWM5ZDMzZjJkNjgxOGMwMmE5ZTliOGFjNTM0ZDJiYWU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
OGU3NzgxYTQ2YmZmMTBmMzNiMzAxNzQ5NWJiNTVkNDBhZTUzNThhMjRjZTE0
|
14
|
+
NDU5MDE1NGY3NGQ1MDYxNGRiN2ViMjY0OGM4M2VkMzRjOTliZGFiMDViOTYy
|
15
|
+
M2NiNGM4MmM5YzQ3ZWZmMDA0ZWU1MTAxMjM2NjE1NmMwZDBhNWY=
|
data/aws-flow.gemspec
CHANGED
@@ -12,5 +12,6 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.email = ''
|
13
13
|
s.files = `git ls-files`.split("\n").reject {|file| file =~ /aws-flow-core/}
|
14
14
|
s.require_paths << "lib/aws/"
|
15
|
+
s.required_ruby_version = "~> 1.9", ">= 1.9.1"
|
15
16
|
s.add_dependency "aws-sdk", "~> 1", ">= 1.39.0"
|
16
17
|
end
|
data/lib/aws/decider/activity.rb
CHANGED
@@ -94,14 +94,16 @@ module AWS
|
|
94
94
|
#
|
95
95
|
def method_missing(method_name, *args, &block)
|
96
96
|
options = Utilities::interpret_block_for_options(ActivityOptions, block)
|
97
|
-
|
97
|
+
client_options = Utilities::client_options_from_method_name(method_name, @options)
|
98
|
+
|
99
|
+
options = Utilities::merge_all_options(client_options,
|
98
100
|
@activity_option_map[method_name.to_sym],
|
99
101
|
@option_map[method_name.to_sym],
|
100
102
|
options
|
101
103
|
)
|
102
104
|
new_options = ActivityOptions.new(options)
|
103
105
|
|
104
|
-
activity_type = ActivityType.new("#{new_options.prefix_name}.#{method_name.to_s}", new_options.version, new_options.
|
106
|
+
activity_type = ActivityType.new("#{new_options.prefix_name}.#{method_name.to_s}", new_options.version, new_options.get_registration_options)
|
105
107
|
if new_options._exponential_retry
|
106
108
|
retry_function = new_options._exponential_retry.retry_function || FlowConstants.exponential_retry_function
|
107
109
|
new_options._exponential_retry.return_on_start ||= new_options.return_on_start
|
@@ -392,9 +394,9 @@ module AWS
|
|
392
394
|
property(:activities, [])
|
393
395
|
|
394
396
|
# @api private
|
395
|
-
def _options; @activities
|
397
|
+
def _options; @activities; end
|
396
398
|
|
397
|
-
# Defines one or more activities with {
|
399
|
+
# Defines one or more activities with {ActivityRegistrationOptions} provided in the
|
398
400
|
# supplied block.
|
399
401
|
#
|
400
402
|
# @param [Array] activity_names
|
@@ -406,7 +408,7 @@ module AWS
|
|
406
408
|
# comes from the list passed to this parameter.
|
407
409
|
#
|
408
410
|
# @param [Hash] block
|
409
|
-
# {
|
411
|
+
# {ActivityRegistrationOptions} to use on the defined activities.
|
410
412
|
#
|
411
413
|
# The following options are *required* when registering an activity:
|
412
414
|
#
|
@@ -434,7 +436,7 @@ module AWS
|
|
434
436
|
# end
|
435
437
|
# end
|
436
438
|
def activity(*activity_names, &block)
|
437
|
-
options = Utilities::interpret_block_for_options(
|
439
|
+
options = Utilities::interpret_block_for_options(ActivityRegistrationOptions, block)
|
438
440
|
activity_names.each do |activity_name|
|
439
441
|
prefix_name = options.prefix_name || self.to_s
|
440
442
|
activity_type = ActivityType.new(prefix_name + "." + activity_name.to_s, options.version, options)
|
@@ -404,6 +404,7 @@ module AWS
|
|
404
404
|
@decision_helper[timer_id].consume(:handle_completion_event)
|
405
405
|
if @decision_helper[timer_id].done?
|
406
406
|
open_request = @decision_helper.scheduled_timers.delete(timer_id)
|
407
|
+
return if open_request.nil?
|
407
408
|
open_request.blocking_promise.set(nil)
|
408
409
|
open_request.completion_handle.complete
|
409
410
|
end
|
@@ -24,12 +24,12 @@ module AWS
|
|
24
24
|
@execution_id = execution_id
|
25
25
|
end
|
26
26
|
def execute(command, options = nil)
|
27
|
-
return schedule_with_retry(command, nil, Hash.new { |hash, key| hash[key] = 1 }, @clock.current_time,
|
27
|
+
return schedule_with_retry(command, nil, Hash.new { |hash, key| hash[key] = 1 }, @clock.current_time, nil) if @return_on_start
|
28
28
|
output = Utilities::AddressableFuture.new
|
29
29
|
result_lock = Utilities::AddressableFuture.new
|
30
30
|
error_handler do |t|
|
31
31
|
t.begin do
|
32
|
-
output.set(schedule_with_retry(command, nil, Hash.new { |hash, key| hash[key] = 1 }, @clock.current_time,
|
32
|
+
output.set(schedule_with_retry(command, nil, Hash.new { |hash, key| hash[key] = 1 }, @clock.current_time, nil))
|
33
33
|
end
|
34
34
|
t.rescue(Exception) do |error|
|
35
35
|
@error_seen = error
|
@@ -77,7 +77,7 @@ module AWS
|
|
77
77
|
failure = should_retry.get
|
78
78
|
if ! failure.nil?
|
79
79
|
attempts[failure.class] += 1
|
80
|
-
output.set(schedule_with_retry(command, failure, attempts, first_attempt_time, @clock.current_time
|
80
|
+
output.set(schedule_with_retry(command, failure, attempts, first_attempt_time, @clock.current_time))
|
81
81
|
else
|
82
82
|
output.set(return_value.get)
|
83
83
|
end
|
data/lib/aws/decider/decider.rb
CHANGED
@@ -245,7 +245,7 @@ module AWS
|
|
245
245
|
module Workflows
|
246
246
|
attr_accessor :version
|
247
247
|
extend Utilities::UpwardLookups
|
248
|
-
@precursors
|
248
|
+
@precursors ||= []
|
249
249
|
def look_upwards(variable)
|
250
250
|
precursors = self.ancestors.dup
|
251
251
|
precursors.delete(self)
|
@@ -263,10 +263,10 @@ module AWS
|
|
263
263
|
def entry_point(input=nil)
|
264
264
|
if input
|
265
265
|
@entry_point = input
|
266
|
-
workflow_type = WorkflowType.new(self.to_s + "." + input.to_s, nil,
|
266
|
+
workflow_type = WorkflowType.new(self.to_s + "." + input.to_s, nil, WorkflowRegistrationOptions.new(:execution_method => input))
|
267
267
|
self.workflows.each { |workflow| workflow.name = self.to_s + "." + input.to_s }
|
268
268
|
self.workflows.each do |workflow|
|
269
|
-
workflow.options =
|
269
|
+
workflow.options = WorkflowRegistrationOptions.new(:execution_method => input)
|
270
270
|
end
|
271
271
|
self.workflows = self.workflows << workflow_type
|
272
272
|
end
|
@@ -327,22 +327,24 @@ module AWS
|
|
327
327
|
|
328
328
|
|
329
329
|
# @api private
|
330
|
-
def _options; self.workflows
|
330
|
+
def _options; self.workflows; end
|
331
331
|
|
332
332
|
# Defines a new workflow.
|
333
333
|
#
|
334
|
-
# @param
|
335
|
-
# The entry
|
334
|
+
# @param workflow_names
|
335
|
+
# The entry points (methods) that starts the workflow.
|
336
336
|
#
|
337
337
|
# @param block
|
338
|
-
# A block of {
|
339
|
-
#
|
340
|
-
def workflow(
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
338
|
+
# A block of {WorflowRegistrationOptions} for the workflow.
|
339
|
+
#
|
340
|
+
def workflow(*workflow_names, &block)
|
341
|
+
workflow_names.each do |workflow_name|
|
342
|
+
options = Utilities::interpret_block_for_options(WorkflowRegistrationOptions, block)
|
343
|
+
options.execution_method = workflow_name
|
344
|
+
prefix_name = options.prefix_name || self.to_s
|
345
|
+
workflow_type = WorkflowType.new(prefix_name.to_s + "." + workflow_name.to_s, options.version, options)
|
346
|
+
self.workflows = self.workflows << workflow_type
|
347
|
+
end
|
346
348
|
end
|
347
349
|
|
348
350
|
# @return [MethodPair]
|
data/lib/aws/decider/executor.rb
CHANGED
@@ -134,36 +134,49 @@ module AWS
|
|
134
134
|
# @api private
|
135
135
|
def remove_completed_pids(block=false)
|
136
136
|
@log.debug "Removing completed child processes"
|
137
|
+
|
138
|
+
# waitpid2 throws an Errno::ECHILD if there are no child processes,
|
139
|
+
# so we don't even call it if there aren't any pids to wait on.
|
140
|
+
if @pids.empty?
|
141
|
+
@log.debug "No child processes. Returning."
|
142
|
+
return
|
143
|
+
end
|
144
|
+
|
145
|
+
@log.debug "Current child processes: #{@pids}"
|
146
|
+
|
147
|
+
# Non-blocking wait only returns a non-null pid if the child process has exited.
|
148
|
+
# This is the only part where we block if block=true.
|
149
|
+
pid, status = Process.waitpid2(-1, block ? 0 : Process::WNOHANG)
|
150
|
+
|
137
151
|
loop do
|
152
|
+
|
153
|
+
# If nothing to reap, then exit
|
154
|
+
break unless pid
|
155
|
+
|
156
|
+
# We have something to reap
|
157
|
+
@log.debug "Reaping child process=#{pid}"
|
158
|
+
if status.success?
|
159
|
+
@log.debug "Child process #{pid} exited successfully"
|
160
|
+
else
|
161
|
+
@log.error "Child process #{pid} exited with non-zero status code"
|
162
|
+
end
|
163
|
+
|
164
|
+
# Reap
|
165
|
+
@pids.delete(pid)
|
166
|
+
|
138
167
|
# waitpid2 throws an Errno::ECHILD if there are no child processes,
|
139
168
|
# so we don't even call it if there aren't any pids to wait on.
|
140
169
|
break if @pids.empty?
|
170
|
+
|
141
171
|
@log.debug "Current child processes: #{@pids}"
|
142
|
-
# Non-blocking wait only returns a non-null pid
|
143
|
-
# if the child process has exited.
|
144
|
-
pid, status = Process.waitpid2(-1, block ? 0 : Process::WNOHANG)
|
145
172
|
|
146
|
-
if
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
@log.debug "Child process #{pid} exited successfully"
|
151
|
-
else
|
152
|
-
@log.error "Child process #{pid} exited with non-zero status code"
|
153
|
-
end
|
154
|
-
# Delete the pid from the list
|
155
|
-
@pids.delete(pid)
|
156
|
-
# Contract is to block only once if block=true. If we are in this code branch and if block=true, it
|
157
|
-
# means we have already blocked once above, hence it is safe to exit now
|
158
|
-
break if block
|
159
|
-
else
|
160
|
-
# Nothing to reap, exit
|
161
|
-
break
|
162
|
-
end
|
163
|
-
|
173
|
+
# Contract is to block only once if block=true. Since we have potentially already
|
174
|
+
# blocked once above, we only need to do a non blocking call to waitpid2 to see if
|
175
|
+
# any other process is available to reap.
|
176
|
+
pid, status = Process.waitpid2(-1, Process::WNOHANG)
|
164
177
|
end
|
165
178
|
end
|
166
|
-
|
167
179
|
end
|
180
|
+
|
168
181
|
end
|
169
182
|
end
|
@@ -67,10 +67,12 @@ module AWS
|
|
67
67
|
class FlowConstants
|
68
68
|
|
69
69
|
class << self
|
70
|
-
attr_reader :exponential_retry_maximum_retry_interval_seconds, :exponential_retry_retry_expiration_seconds, :exponential_retry_backoff_coefficient, :exponential_retry_maximum_attempts, :exponential_retry_function, :default_data_converter, :exponential_retry_exceptions_to_include, :exponential_retry_exceptions_to_exclude, :jitter_function, :should_jitter, :exponential_retry_initial_retry_interval
|
70
|
+
attr_reader :exponential_retry_maximum_retry_interval_seconds, :exponential_retry_retry_expiration_seconds, :exponential_retry_backoff_coefficient, :exponential_retry_maximum_attempts, :exponential_retry_function, :default_data_converter, :exponential_retry_exceptions_to_include, :exponential_retry_exceptions_to_exclude, :jitter_function, :should_jitter, :exponential_retry_initial_retry_interval, :use_worker_task_list
|
71
71
|
end
|
72
72
|
|
73
73
|
INFINITY = -1
|
74
|
+
RETENTION_DEFAULT = 7
|
75
|
+
NUM_OF_WORKERS_DEFAULT = 1
|
74
76
|
@exponential_retry_maximum_attempts = Float::INFINITY
|
75
77
|
@exponential_retry_maximum_retry_interval_seconds = -1
|
76
78
|
@exponential_retry_retry_expiration_seconds = -1
|
@@ -81,22 +83,33 @@ module AWS
|
|
81
83
|
@exponential_retry_exceptions_to_include = [Exception]
|
82
84
|
@exponential_retry_function = lambda do |first, time_of_failure, attempts, options|
|
83
85
|
|
84
|
-
raise ArgumentError.new("first
|
85
|
-
raise ArgumentError.new("time_of_failure
|
86
|
-
raise ArgumentError.new("number of attempts
|
86
|
+
raise ArgumentError.new("first should be an instance of Time") unless first.instance_of?(Time)
|
87
|
+
raise ArgumentError.new("time_of_failure should be nil or an instance of Time") unless time_of_failure.nil? || time_of_failure.instance_of?(Time)
|
88
|
+
raise ArgumentError.new("number of attempts should be positive") if (attempts.values.find {|x| x < 0})
|
87
89
|
raise ArgumentError.new("number of attempts should be more than 2") if (attempts.values.reduce(0,:+) < 2)
|
88
90
|
raise ArgumentError.new("user options must be of type ExponentialRetryOptions") unless options.is_a? ExponentialRetryOptions
|
89
91
|
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
result =
|
98
|
-
|
99
|
-
|
92
|
+
# get values from options
|
93
|
+
initial_interval = options.initial_retry_interval
|
94
|
+
backoff = options.backoff_coefficient
|
95
|
+
max_interval = options.maximum_retry_interval_seconds
|
96
|
+
retry_expiration = options.retry_expiration_interval_seconds
|
97
|
+
|
98
|
+
# calculate the initial retry seconds
|
99
|
+
result = initial_interval * (backoff ** (attempts.values.reduce(0, :+) - 2))
|
100
|
+
|
101
|
+
# check if the calculated retry seconds is greater than the maximum
|
102
|
+
# retry interval allowed. If it is, then replace it with maximum_retry_interval_seconds
|
103
|
+
result = max_interval if ( !max_interval.nil? && max_interval != INFINITY && result > max_interval)
|
104
|
+
|
105
|
+
# how much time has elapsed since the first time this task was scheduled
|
106
|
+
time_elapsed = time_of_failure.nil? ? 0 : (time_of_failure - first).to_i
|
107
|
+
|
108
|
+
# return -1 if retry will expire
|
109
|
+
result = -1 if (! retry_expiration.nil? &&
|
110
|
+
retry_expiration != INFINITY &&
|
111
|
+
(result + time_elapsed) >= retry_expiration)
|
112
|
+
|
100
113
|
return result.to_i
|
101
114
|
end
|
102
115
|
|
@@ -107,6 +120,7 @@ module AWS
|
|
107
120
|
end
|
108
121
|
|
109
122
|
@default_data_converter = YAMLDataConverter.new
|
123
|
+
@use_worker_task_list = "USE_WORKER_TASK_LIST"
|
110
124
|
end
|
111
125
|
end
|
112
126
|
end
|
@@ -34,11 +34,10 @@ module AWS
|
|
34
34
|
# The options to set.
|
35
35
|
#
|
36
36
|
def with_opts(opts = {})
|
37
|
-
klass = self.class.default_option_class
|
38
|
-
options = klass.new(opts)
|
39
37
|
modified_instance = self.dup
|
40
|
-
|
41
|
-
|
38
|
+
opts.each_pair do |key, value|
|
39
|
+
modified_instance.options.send("#{key}=", value) if modified_instance.options.methods.map(&:to_sym).include? "#{key}=".to_sym
|
40
|
+
end
|
42
41
|
modified_instance
|
43
42
|
end
|
44
43
|
|
data/lib/aws/decider/options.rb
CHANGED
@@ -25,69 +25,6 @@ module AWS
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
# This module refactors out some of the common methods for the Options
|
29
|
-
# classes. Any class including this module should implement
|
30
|
-
# make_runtime_key method and default_keys method. default_keys method
|
31
|
-
# provides an array of keys that are considered to be the default options
|
32
|
-
# for that class. make_runtime_key method converts a passed in default key
|
33
|
-
# to it's corresponding runtime key.
|
34
|
-
module OptionsMethods
|
35
|
-
|
36
|
-
# Retrieves the runtime values for the default options
|
37
|
-
#
|
38
|
-
# @return [Hash]
|
39
|
-
# The runtime option names and their current values.
|
40
|
-
#
|
41
|
-
def get_runtime_options
|
42
|
-
runtime_options = {}
|
43
|
-
# For the default values that are present, convert the default keys into
|
44
|
-
# runtime keys. i.e. remove 'default_' and 'default_task_' from the key
|
45
|
-
# name and merge their values with the default values
|
46
|
-
get_default_options.each do |key, val|
|
47
|
-
new_key = make_runtime_key(key)
|
48
|
-
new_val = get_options([new_key])
|
49
|
-
runtime_options[new_key] = new_val.empty? ? val : new_val.values.first
|
50
|
-
end
|
51
|
-
runtime_options
|
52
|
-
end
|
53
|
-
|
54
|
-
# Retrieves the default options.
|
55
|
-
#
|
56
|
-
# @return [Hash]
|
57
|
-
# A hash containing the default option names and their current values.
|
58
|
-
#
|
59
|
-
def get_default_options
|
60
|
-
# Get the default options
|
61
|
-
get_options(default_keys)
|
62
|
-
end
|
63
|
-
|
64
|
-
# Retrieves full options. It merges the runtime options with the remaining
|
65
|
-
# options
|
66
|
-
#
|
67
|
-
# @return [Hash]
|
68
|
-
# A hash containing the full option names and their current values.
|
69
|
-
#
|
70
|
-
def get_full_options
|
71
|
-
# Initialize an empty hash
|
72
|
-
options_hash = {}
|
73
|
-
|
74
|
-
# Get all the properties held by this class
|
75
|
-
options_keys = self.class.held_properties
|
76
|
-
|
77
|
-
# Remove the unnecessary options (i.e. options not recognized by swf but
|
78
|
-
# only by flow) from the options_keys array.
|
79
|
-
default_keys.concat([:from_class]).each { |x| options_keys.delete(x) }
|
80
|
-
|
81
|
-
# If the value for an option is held by the class, get it and store it
|
82
|
-
# in a hash
|
83
|
-
options_keys.each do |option|
|
84
|
-
options_hash[option] = self.send(option) if self.send(option)
|
85
|
-
end
|
86
|
-
# Merge the options_hash with the runtime options
|
87
|
-
options_hash.merge(self.get_runtime_options)
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
28
|
# The base class for all options classes in the AWS Flow Framework for Ruby.
|
92
29
|
class Options
|
93
30
|
extend Utilities::UpwardLookups
|
@@ -247,7 +184,7 @@ module AWS
|
|
247
184
|
def get_full_options
|
248
185
|
result = {}
|
249
186
|
SignalWorkflowOptions.held_properties.each do |option|
|
250
|
-
result[option] = self.send(option) if self.send(option) && self.send(option) != ""
|
187
|
+
result[option] = self.send(option) if self.send(option) != nil && self.send(option) != ""
|
251
188
|
end
|
252
189
|
result
|
253
190
|
end
|
@@ -378,6 +315,13 @@ module AWS
|
|
378
315
|
# Defaults for `WorkflowOptions`.
|
379
316
|
class WorkflowDefaults < Defaults
|
380
317
|
|
318
|
+
# The default data converter. By default, this is {YAMLDataConverter}.
|
319
|
+
def data_converter; FlowConstants.default_data_converter; end
|
320
|
+
|
321
|
+
end
|
322
|
+
|
323
|
+
class WorkflowRegistrationDefaults < WorkflowDefaults
|
324
|
+
|
381
325
|
# The default task start-to-close timeout duration. The default value is
|
382
326
|
# `30`.
|
383
327
|
def default_task_start_to_close_timeout; 30; end
|
@@ -389,8 +333,7 @@ module AWS
|
|
389
333
|
# array (no tags).
|
390
334
|
def tag_list; []; end
|
391
335
|
|
392
|
-
|
393
|
-
def data_converter; FlowConstants.default_data_converter; end
|
336
|
+
def default_task_list; FlowConstants.use_worker_task_list; end
|
394
337
|
end
|
395
338
|
|
396
339
|
# Options for workflows.
|
@@ -485,7 +428,6 @@ module AWS
|
|
485
428
|
# * It must not contain the literal string "arn".
|
486
429
|
#
|
487
430
|
class WorkflowOptions < Options
|
488
|
-
include OptionsMethods
|
489
431
|
|
490
432
|
properties(
|
491
433
|
:version,
|
@@ -497,37 +439,54 @@ module AWS
|
|
497
439
|
:execution_method
|
498
440
|
)
|
499
441
|
|
442
|
+
property(:tag_list, [])
|
443
|
+
property(:child_policy, [lambda(&:to_s), lambda(&:upcase)])
|
444
|
+
property(:data_converter, [])
|
445
|
+
|
446
|
+
default_classes << WorkflowDefaults.new
|
447
|
+
|
448
|
+
def get_full_options
|
449
|
+
result = {}
|
450
|
+
usable_properties = self.class.held_properties
|
451
|
+
usable_properties.delete(:from_class)
|
452
|
+
usable_properties.each do |option|
|
453
|
+
result[option] = self.send(option) if self.send(option) != nil && self.send(option) != ""
|
454
|
+
end
|
455
|
+
result
|
456
|
+
end
|
457
|
+
|
458
|
+
end
|
459
|
+
|
460
|
+
class WorkflowRegistrationOptions < WorkflowOptions
|
461
|
+
class << self
|
462
|
+
def registration_options
|
463
|
+
[
|
464
|
+
:default_task_start_to_close_timeout,
|
465
|
+
:default_execution_start_to_close_timeout,
|
466
|
+
:default_task_list,
|
467
|
+
:default_child_policy
|
468
|
+
]
|
469
|
+
end
|
470
|
+
end
|
471
|
+
|
500
472
|
# Adding default properties
|
501
473
|
properties(
|
502
474
|
:default_task_start_to_close_timeout,
|
503
475
|
:default_execution_start_to_close_timeout,
|
504
476
|
:default_task_list
|
505
477
|
)
|
506
|
-
property(:default_child_policy, [lambda(&:to_s), lambda(&:upcase)])
|
507
|
-
|
508
|
-
|
509
|
-
property(:tag_list, [])
|
510
|
-
property(:child_policy, [lambda(&:to_s), lambda(&:upcase)])
|
511
|
-
property(:data_converter, [])
|
512
478
|
|
513
|
-
|
479
|
+
property(:default_child_policy, [lambda(&:to_s), lambda(&:upcase)])
|
514
480
|
|
515
|
-
|
516
|
-
def default_keys
|
517
|
-
[:default_task_start_to_close_timeout,
|
518
|
-
:default_execution_start_to_close_timeout,
|
519
|
-
:default_task_list,
|
520
|
-
:default_child_policy]
|
521
|
-
end
|
481
|
+
default_classes << WorkflowRegistrationDefaults.new
|
522
482
|
|
523
|
-
|
524
|
-
|
525
|
-
def make_runtime_key(key)
|
526
|
-
key.to_s.gsub(/default_/, "").to_sym
|
483
|
+
def get_registration_options
|
484
|
+
get_options(self.class.registration_options)
|
527
485
|
end
|
528
486
|
|
529
487
|
end
|
530
488
|
|
489
|
+
|
531
490
|
# Options for {WorkflowClient#start_execution}.
|
532
491
|
#
|
533
492
|
# @!attribute workflow_name
|
@@ -549,6 +508,10 @@ module AWS
|
|
549
508
|
|
550
509
|
# Defaults for the {ActivityOptions} class.
|
551
510
|
class ActivityDefaults < Defaults
|
511
|
+
def data_converter; FlowConstants.default_data_converter; end
|
512
|
+
end
|
513
|
+
|
514
|
+
class ActivityRegistrationDefaults < ActivityDefaults
|
552
515
|
|
553
516
|
# The default schedule-to-start timeout for activity tasks. This timeout
|
554
517
|
# represents the time, in seconds, between when the activity task is first
|
@@ -585,10 +548,9 @@ module AWS
|
|
585
548
|
# set this value to "NONE" to imply no timeout value.
|
586
549
|
def default_task_heartbeat_timeout; Float::INFINITY; end
|
587
550
|
|
588
|
-
def
|
551
|
+
def default_task_list; FlowConstants.use_worker_task_list; end
|
589
552
|
end
|
590
553
|
|
591
|
-
|
592
554
|
# Options to use on an activity or decider. The following options are
|
593
555
|
# defined:
|
594
556
|
#
|
@@ -640,7 +602,6 @@ module AWS
|
|
640
602
|
# decision.
|
641
603
|
#
|
642
604
|
class ActivityOptions < Options
|
643
|
-
include OptionsMethods
|
644
605
|
|
645
606
|
properties(
|
646
607
|
:heartbeat_timeout,
|
@@ -652,40 +613,11 @@ module AWS
|
|
652
613
|
:input
|
653
614
|
)
|
654
615
|
|
655
|
-
# Adding default properties
|
656
|
-
properties(
|
657
|
-
:default_task_heartbeat_timeout,
|
658
|
-
:default_task_list,
|
659
|
-
:default_task_schedule_to_close_timeout,
|
660
|
-
:default_task_schedule_to_start_timeout,
|
661
|
-
:default_task_start_to_close_timeout,
|
662
|
-
)
|
663
|
-
|
664
616
|
property(:manual_completion, [lambda {|x| x == true}])
|
665
617
|
property(:data_converter, [])
|
666
618
|
|
667
619
|
default_classes << ActivityDefaults.new
|
668
620
|
|
669
|
-
# This method provides the default option keys for activities
|
670
|
-
def default_keys
|
671
|
-
[:default_task_heartbeat_timeout,
|
672
|
-
:default_task_schedule_to_close_timeout,
|
673
|
-
:default_task_schedule_to_start_timeout,
|
674
|
-
:default_task_start_to_close_timeout,
|
675
|
-
:default_task_list]
|
676
|
-
end
|
677
|
-
|
678
|
-
# This method converts default option keys to runtime keys by replacing
|
679
|
-
# "default_task_" in the key name. It handles the exception of task_list
|
680
|
-
# where only "default_" needs to be replaced.
|
681
|
-
def make_runtime_key(key)
|
682
|
-
if key =~ /task_list/
|
683
|
-
key.to_s.gsub(/default_/, "").to_sym
|
684
|
-
else
|
685
|
-
key.to_s.gsub(/default_task_/, "").to_sym
|
686
|
-
end
|
687
|
-
end
|
688
|
-
|
689
621
|
# Gets the activity prefix name.
|
690
622
|
#
|
691
623
|
# @return [String]
|
@@ -777,6 +709,48 @@ module AWS
|
|
777
709
|
retry_options = Utilities::interpret_block_for_options(ExponentialRetryOptions, block)
|
778
710
|
@_exponential_retry = retry_options
|
779
711
|
end
|
712
|
+
|
713
|
+
def get_full_options
|
714
|
+
result = {}
|
715
|
+
usable_properties = self.class.held_properties
|
716
|
+
usable_properties.delete(:from_class)
|
717
|
+
usable_properties.each do |option|
|
718
|
+
result[option] = self.send(option) if self.send(option) != nil && self.send(option) != ""
|
719
|
+
end
|
720
|
+
result
|
721
|
+
end
|
722
|
+
|
723
|
+
end
|
724
|
+
|
725
|
+
# This class is used to capture the options passed during activity declaration.
|
726
|
+
class ActivityRegistrationOptions < ActivityOptions
|
727
|
+
class << self
|
728
|
+
def registration_options
|
729
|
+
[
|
730
|
+
:default_task_heartbeat_timeout,
|
731
|
+
:default_task_schedule_to_close_timeout,
|
732
|
+
:default_task_schedule_to_start_timeout,
|
733
|
+
:default_task_start_to_close_timeout,
|
734
|
+
:default_task_list
|
735
|
+
]
|
736
|
+
end
|
737
|
+
end
|
738
|
+
|
739
|
+
# Adding default properties
|
740
|
+
properties(
|
741
|
+
:default_task_heartbeat_timeout,
|
742
|
+
:default_task_list,
|
743
|
+
:default_task_schedule_to_close_timeout,
|
744
|
+
:default_task_schedule_to_start_timeout,
|
745
|
+
:default_task_start_to_close_timeout,
|
746
|
+
)
|
747
|
+
|
748
|
+
default_classes << ActivityRegistrationDefaults.new
|
749
|
+
|
750
|
+
def get_registration_options
|
751
|
+
get_options(self.class.registration_options)
|
752
|
+
end
|
753
|
+
|
780
754
|
end
|
781
755
|
|
782
756
|
# Runtime options for an activity.
|