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.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/Rakefile +18 -31
- data/aws-flow.gemspec +1 -1
- data/lib/aws/decider.rb +1 -2
- data/lib/aws/decider/activity.rb +99 -53
- data/lib/aws/decider/activity_definition.rb +43 -7
- data/lib/aws/decider/async_decider.rb +56 -57
- data/lib/aws/decider/async_retrying_executor.rb +4 -5
- data/lib/aws/decider/data_converter.rb +2 -2
- data/lib/aws/decider/decider.rb +46 -41
- data/lib/aws/decider/decision_context.rb +2 -2
- data/lib/aws/decider/exceptions.rb +6 -6
- data/lib/aws/decider/executor.rb +15 -11
- data/lib/aws/decider/flow_defaults.rb +54 -22
- data/lib/aws/decider/generic_client.rb +7 -7
- data/lib/aws/decider/history_helper.rb +0 -0
- data/lib/aws/decider/implementation.rb +5 -5
- data/lib/aws/decider/options.rb +285 -155
- data/lib/aws/decider/state_machines.rb +10 -10
- data/lib/aws/decider/task_handler.rb +5 -5
- data/lib/aws/decider/task_poller.rb +152 -15
- data/lib/aws/decider/utilities.rb +14 -14
- data/lib/aws/decider/version.rb +1 -1
- data/lib/aws/decider/worker.rb +21 -20
- data/lib/aws/decider/workflow_client.rb +78 -31
- data/lib/aws/decider/workflow_clock.rb +1 -1
- data/lib/aws/decider/workflow_definition.rb +5 -5
- data/lib/aws/decider/workflow_definition_factory.rb +1 -1
- data/lib/aws/decider/workflow_enabled.rb +1 -1
- data/lib/aws/flow/async_backtrace.rb +19 -18
- data/lib/aws/flow/async_scope.rb +32 -16
- data/lib/aws/flow/begin_rescue_ensure.rb +61 -56
- data/lib/aws/flow/fiber.rb +14 -6
- data/lib/aws/flow/flow_utils.rb +9 -6
- data/lib/aws/flow/future.rb +43 -18
- data/lib/aws/flow/implementation.rb +34 -18
- data/lib/aws/flow/simple_dfa.rb +12 -4
- data/lib/aws/flow/tasks.rb +120 -86
- data/{test/aws → spec/aws/integration}/integration_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/async_backtrace_spec.rb +1 -0
- data/{test/aws → spec/aws/unit}/async_scope_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/begin_rescue_ensure_spec.rb +90 -2
- data/{test/aws → spec/aws/unit}/decider_spec.rb +41 -53
- data/{test/aws → spec/aws/unit}/external_task_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/factories.rb +0 -0
- data/{test/aws → spec/aws/unit}/fiber_condition_variable_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/fiber_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/flow_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/future_spec.rb +0 -0
- data/{test/aws → spec/aws/unit}/preinclude_tests.rb +0 -0
- data/{test/aws → spec/aws/unit}/rubyflow.rb +0 -0
- data/{test/aws → spec/aws/unit}/simple_dfa_spec.rb +0 -0
- data/{test/aws → spec}/spec_helper.rb +0 -0
- metadata +30 -30
data/lib/aws/decider/version.rb
CHANGED
data/lib/aws/decider/worker.rb
CHANGED
@@ -20,12 +20,12 @@ module AWS
|
|
20
20
|
|
21
21
|
# A generic Activity/Workflow worker class.
|
22
22
|
class GenericWorker
|
23
|
-
# Creates a new GenericWorker
|
23
|
+
# Creates a new `GenericWorker`.
|
24
24
|
# @param service
|
25
25
|
# The AWS service class to use.
|
26
26
|
#
|
27
27
|
# @param domain
|
28
|
-
# The SWF domain to use.
|
28
|
+
# The Amazon SWF domain to use.
|
29
29
|
#
|
30
30
|
# @param task_list_to_poll
|
31
31
|
# The list of tasks to poll for this worker.
|
@@ -56,7 +56,7 @@ module AWS
|
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
#
|
59
|
+
# @api private
|
60
60
|
def camel_case_to_snake_case(camel_case)
|
61
61
|
camel_case.
|
62
62
|
gsub(/(.)([A-Z])/,'\1_\2').
|
@@ -113,7 +113,7 @@ module AWS
|
|
113
113
|
# The service used with this workflow worker.
|
114
114
|
#
|
115
115
|
# @param [String] domain
|
116
|
-
# The SWF domain to operate on.
|
116
|
+
# The Amazon SWF domain to operate on.
|
117
117
|
#
|
118
118
|
# @param [Array] task_list
|
119
119
|
# The default task list to put all of the decision requests.
|
@@ -137,8 +137,8 @@ module AWS
|
|
137
137
|
add_workflow_implementation(workflow_class)
|
138
138
|
end
|
139
139
|
|
140
|
-
# Called by {#add_implementation}
|
141
|
-
#
|
140
|
+
# Called by {#add_implementation}.
|
141
|
+
# @api private
|
142
142
|
def add_workflow_implementation(workflow_class)
|
143
143
|
workflow_class.workflows.delete_if do |workflow_type|
|
144
144
|
workflow_type.version.nil? || workflow_type.name.nil?
|
@@ -183,7 +183,7 @@ module AWS
|
|
183
183
|
# Starts the workflow with a {WorkflowTaskPoller}.
|
184
184
|
#
|
185
185
|
# @param [true,false] should_register
|
186
|
-
# Indicates whether
|
186
|
+
# Indicates whether the workflow needs to be registered with Amazon SWF first. If {#register} was already called
|
187
187
|
# for this workflow worker, specify `false`.
|
188
188
|
#
|
189
189
|
def start(should_register = true)
|
@@ -216,24 +216,24 @@ module AWS
|
|
216
216
|
end
|
217
217
|
|
218
218
|
|
219
|
-
#
|
219
|
+
# Used to implement an activity worker. You can use the `ActivityWorker` class to conveniently poll a task list for
|
220
220
|
# activity tasks.
|
221
221
|
#
|
222
222
|
# You configure the activity worker with activity implementation objects. This worker class then polls for activity
|
223
223
|
# tasks in the specified task list. When an activity task is received, it looks up the appropriate implementation
|
224
224
|
# that you provided, and calls the activity method to process the task. Unlike the {WorkflowWorker}, which creates a
|
225
|
-
# new instance for every decision task, the ActivityWorker simply uses the object you provided.
|
225
|
+
# new instance for every decision task, the `ActivityWorker` simply uses the object you provided.
|
226
226
|
#
|
227
227
|
class ActivityWorker < GenericWorker
|
228
228
|
|
229
|
-
# Creates a new ActivityWorker instance.
|
229
|
+
# Creates a new `ActivityWorker` instance.
|
230
230
|
#
|
231
231
|
# @param service
|
232
|
-
# The SWF [Client](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html) used to register
|
232
|
+
# The Amazon SWF [Client](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html) used to register
|
233
233
|
# this activity worker.
|
234
234
|
#
|
235
235
|
# @param [String] domain
|
236
|
-
# The SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) to operate on.
|
236
|
+
# The Amazon SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) to operate on.
|
237
237
|
#
|
238
238
|
# @param [Array] task_list
|
239
239
|
# The default task list to put all of the activity requests.
|
@@ -257,7 +257,7 @@ module AWS
|
|
257
257
|
super(service, domain, task_list, *args)
|
258
258
|
end
|
259
259
|
|
260
|
-
# Adds an
|
260
|
+
# Adds an activity implementation to this `ActivityWorker`.
|
261
261
|
#
|
262
262
|
# @param [Activity] class_or_instance
|
263
263
|
# The {Activity} class or instance to add.
|
@@ -267,7 +267,7 @@ module AWS
|
|
267
267
|
end
|
268
268
|
|
269
269
|
|
270
|
-
# Registers the activity type
|
270
|
+
# Registers the activity type.
|
271
271
|
def register
|
272
272
|
@activity_type_options.each do |activity_type_options|
|
273
273
|
begin
|
@@ -289,7 +289,7 @@ module AWS
|
|
289
289
|
end
|
290
290
|
end
|
291
291
|
|
292
|
-
# Adds an
|
292
|
+
# Adds an activity implementation to this `ActivityWorker`.
|
293
293
|
#
|
294
294
|
# @param [Activity] class_or_instance
|
295
295
|
# The {Activity} class or instance to add.
|
@@ -314,10 +314,10 @@ module AWS
|
|
314
314
|
end
|
315
315
|
|
316
316
|
|
317
|
-
# Starts the
|
317
|
+
# Starts the activity that was added to the `ActivityWorker`.
|
318
318
|
#
|
319
319
|
# @param [true, false] should_register
|
320
|
-
# Set to false if the
|
320
|
+
# Set to `false` if the activity should not register itself (it is already registered).
|
321
321
|
#
|
322
322
|
def start(should_register = true)
|
323
323
|
register if should_register
|
@@ -327,17 +327,18 @@ module AWS
|
|
327
327
|
end
|
328
328
|
end
|
329
329
|
|
330
|
-
# Starts the
|
330
|
+
# Starts the activity that was added to the `ActivityWorker` and, optionally, sets the {ActivityTaskPoller}.
|
331
331
|
#
|
332
332
|
# @param [true, false] should_register
|
333
|
-
# Set to `false` if the
|
333
|
+
# Set to `false` if the activity should not register itself (it is already registered).
|
334
334
|
#
|
335
335
|
# @param [ActivityTaskPoller] poller
|
336
|
-
# The {ActivityTaskPoller} to use. If this is not set, a default ActivityTaskPoller will be created.
|
336
|
+
# The {ActivityTaskPoller} to use. If this is not set, a default {ActivityTaskPoller} will be created.
|
337
337
|
#
|
338
338
|
def run_once(should_register = true, poller = nil)
|
339
339
|
register if should_register
|
340
340
|
poller = ActivityTaskPoller.new(@service, @domain, @task_list, @activity_definition_map, @executor, @options) if poller.nil?
|
341
|
+
Kernel.exit if @shutting_down
|
341
342
|
poller.poll_and_process_single_task(@options.use_forking)
|
342
343
|
end
|
343
344
|
end
|
@@ -16,13 +16,54 @@
|
|
16
16
|
module AWS
|
17
17
|
module Flow
|
18
18
|
|
19
|
+
# Contains data about an Amazon SWF domain.
|
20
|
+
#
|
21
|
+
# @!attribute name
|
22
|
+
# The domain name.
|
23
|
+
#
|
19
24
|
class MinimalDomain
|
20
25
|
attr_accessor :name
|
26
|
+
|
27
|
+
# Creates a new `MinimalDomain` instance.
|
28
|
+
#
|
29
|
+
# @param domain
|
30
|
+
# The [AWS::SimpleWorkflow::Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html)
|
31
|
+
# that this instance will refer to.
|
32
|
+
#
|
21
33
|
def initialize(domain); @domain = domain; end
|
22
34
|
end
|
23
35
|
|
36
|
+
# Contains data about a workflow execution. This class represents a minimal set of data needed by the AWS Flow
|
37
|
+
# Framework for Ruby, based on the
|
38
|
+
# [AWS::SimpleWorkflow::WorkflowExecution](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/WorkflowExecution.html)
|
39
|
+
# class.
|
40
|
+
#
|
41
|
+
# @!attribute domain
|
42
|
+
# The domain that the workflow is running in. See {MinimalWorkflowExecution#initialize} for details.
|
43
|
+
#
|
44
|
+
# @!attribute run_id
|
45
|
+
# The unique run indentifier for this workflow. See {MinimalWorkflowExecution#initialize} for details.
|
46
|
+
#
|
47
|
+
# @!attribute workflow_id
|
48
|
+
# The unique identifier for this workflow. See {MinimalWorkflowExecution#initialize} for details.
|
49
|
+
#
|
24
50
|
class MinimalWorkflowExecution
|
25
51
|
attr_accessor :workflow_id, :run_id, :domain
|
52
|
+
|
53
|
+
# Creates a new `MinimalWorkflowExecution` instance
|
54
|
+
#
|
55
|
+
# @param (Domain) domain
|
56
|
+
# The Amazon SWF domain that the workflow is running in; an instance of
|
57
|
+
# [AWS::SimpleWorkflow::Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html).
|
58
|
+
#
|
59
|
+
# @param (String) workflow_id
|
60
|
+
# The unique workflow indentifier for this workflow; From
|
61
|
+
# [AWS::SimpleWorkflow::WorkflowExecution#workflow_id](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/WorkflowExecution.html#workflow_id-instance_method).
|
62
|
+
#
|
63
|
+
# @param (String) run_id
|
64
|
+
# The unique run indentifier for this workflow. From
|
65
|
+
# [AWS::SimpleWorkflow::WorkflowExecution#run_id](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/WorkflowExecution.html#run_id-instance_method).
|
66
|
+
#
|
26
67
|
def initialize(domain, workflow_id, run_id)
|
27
68
|
@domain = domain
|
28
69
|
@workflow_id = workflow_id
|
@@ -30,11 +71,11 @@ module AWS
|
|
30
71
|
end
|
31
72
|
end
|
32
73
|
|
33
|
-
# A future provided by a
|
74
|
+
# A future provided by a
|
75
|
+
# [AWS::SimpleWorkflow::WorkflowExecution](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/WorkflowExecution.html).
|
34
76
|
#
|
35
77
|
# @!attribute _workflow_execution
|
36
|
-
# A MinimalWorkflowExecution
|
37
|
-
# instance that this future belongs to.
|
78
|
+
# A {MinimalWorkflowExecution} instance that this future belongs to.
|
38
79
|
#
|
39
80
|
# @!attribute return_value
|
40
81
|
# The return value of the future.
|
@@ -43,28 +84,34 @@ module AWS
|
|
43
84
|
attr_accessor :_workflow_execution, :return_value
|
44
85
|
|
45
86
|
|
46
|
-
# Creates a new workflow future
|
87
|
+
# Creates a new workflow future.
|
47
88
|
#
|
48
89
|
# @param workflow_execution
|
90
|
+
# The {MinimalWorkflowExecution} to assign to this future.
|
49
91
|
#
|
50
92
|
def initialize(workflow_execution)
|
51
93
|
@_workflow_execution = workflow_execution.dup
|
52
94
|
@return_value = Future.new
|
53
95
|
end
|
54
96
|
|
55
|
-
#
|
56
|
-
#
|
97
|
+
# Determines whether the object is a flow future. The contract is that flow futures must have a `get` method.
|
98
|
+
#
|
99
|
+
# @return
|
100
|
+
# Always returns `true` for a {WorkflowFuture} object.
|
57
101
|
def is_flow_future?
|
58
102
|
true
|
59
103
|
end
|
60
104
|
|
105
|
+
# @api private
|
61
106
|
def method_missing(method_name, *args, &block)
|
62
107
|
@return_value.send(method_name, *args, &block)
|
63
108
|
end
|
64
109
|
|
65
|
-
|
66
|
-
#
|
67
|
-
# @return
|
110
|
+
# Gets the current value of the workflow execution.
|
111
|
+
#
|
112
|
+
# @return {MinimalWorkflowExecution}
|
113
|
+
# The workflow execution that this future belongs to.
|
114
|
+
#
|
68
115
|
def workflow_execution
|
69
116
|
@_workflow_execution
|
70
117
|
end
|
@@ -73,16 +120,16 @@ module AWS
|
|
73
120
|
|
74
121
|
|
75
122
|
|
76
|
-
#
|
123
|
+
# @api private
|
77
124
|
class NoInput
|
78
125
|
def empty?; return true; end
|
79
126
|
end
|
80
127
|
|
81
128
|
|
82
|
-
#
|
129
|
+
# Represents a client for a workflow execution.
|
83
130
|
#
|
84
131
|
# @!attribute domain
|
85
|
-
# The SWF domain used for this workflow.
|
132
|
+
# The Amazon SWF domain used for this workflow.
|
86
133
|
#
|
87
134
|
# @!attribute [Hash, WorkflowOptions] options
|
88
135
|
# Workflow options for this client.
|
@@ -90,14 +137,14 @@ module AWS
|
|
90
137
|
class WorkflowClient < GenericClient
|
91
138
|
attr_accessor :domain, :options
|
92
139
|
|
93
|
-
# Creates a new {WorkflowClient}
|
140
|
+
# Creates a new {WorkflowClient}.
|
94
141
|
#
|
95
142
|
# @param service
|
96
|
-
# The SWF [Client](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html) to use for
|
143
|
+
# The Amazon SWF [Client](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Client.html) to use for
|
97
144
|
# creating this {WorkflowClient}.
|
98
145
|
#
|
99
146
|
# @param domain
|
100
|
-
# The SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) in which to
|
147
|
+
# The Amazon SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) in which to
|
101
148
|
# start the workflow execution.
|
102
149
|
#
|
103
150
|
# @param workflow_class
|
@@ -115,10 +162,10 @@ module AWS
|
|
115
162
|
end
|
116
163
|
|
117
164
|
|
118
|
-
#
|
165
|
+
# @api private
|
119
166
|
def self.default_option_class; WorkflowOptions; end
|
120
167
|
|
121
|
-
# Gets the events for this workflow client
|
168
|
+
# Gets the events for this workflow client.
|
122
169
|
#
|
123
170
|
def events
|
124
171
|
@execution.events if @execution
|
@@ -136,7 +183,7 @@ module AWS
|
|
136
183
|
# Begins executing this workflow.
|
137
184
|
#
|
138
185
|
# @param input
|
139
|
-
# Input to provide to the
|
186
|
+
# Input to provide to the workflow.
|
140
187
|
#
|
141
188
|
# @param [Hash, StartWorkflowOptions] block
|
142
189
|
# A hash of {StartWorkflowOptions} to use for this workflow execution.
|
@@ -171,8 +218,8 @@ module AWS
|
|
171
218
|
end
|
172
219
|
|
173
220
|
|
174
|
-
# Called by {#signal_workflow_execution}
|
175
|
-
#
|
221
|
+
# Called by {#signal_workflow_execution}.
|
222
|
+
# @api private
|
176
223
|
def signal_external_workflow(signal_name, workflow_execution, &block)
|
177
224
|
options = Utilities::interpret_block_for_options(SignalWorkflowOptions, block)
|
178
225
|
options.signal_name ||= signal_name
|
@@ -183,8 +230,8 @@ module AWS
|
|
183
230
|
@service.signal_workflow_execution(options.get_full_options)
|
184
231
|
end
|
185
232
|
|
186
|
-
# Called by {#signal_workflow_execution}
|
187
|
-
#
|
233
|
+
# Called by {#signal_workflow_execution}.
|
234
|
+
# @api private
|
188
235
|
def signal_internal_workflow(signal_name, workflow_execution, &block)
|
189
236
|
get_decision_context
|
190
237
|
options = Utilities::interpret_block_for_options(SignalWorkflowOptions, block)
|
@@ -215,8 +262,8 @@ module AWS
|
|
215
262
|
end
|
216
263
|
|
217
264
|
|
218
|
-
# Called by {#start_execution}
|
219
|
-
#
|
265
|
+
# Called by {#start_execution}.
|
266
|
+
# @api private
|
220
267
|
def start_internal_workflow(input = NoInput.new, &block)
|
221
268
|
get_decision_context
|
222
269
|
options = Utilities::interpret_block_for_options(StartWorkflowOptions, block)
|
@@ -288,8 +335,8 @@ module AWS
|
|
288
335
|
end
|
289
336
|
|
290
337
|
|
291
|
-
# Called by {#start_execution}
|
292
|
-
#
|
338
|
+
# Called by {#start_execution}.
|
339
|
+
# @api private
|
293
340
|
def start_external_workflow(input = NoInput.new, &block)
|
294
341
|
options = Utilities::interpret_block_for_options(StartWorkflowOptions, block)
|
295
342
|
options = Utilities::merge_all_options(@options, options)
|
@@ -350,19 +397,19 @@ module AWS
|
|
350
397
|
end
|
351
398
|
|
352
399
|
|
353
|
-
# Instances of WorkflowFactory are generated by {#workflow_factory}.
|
400
|
+
# Represents a workflow factory. Instances of `WorkflowFactory` are generated by {#workflow_factory}.
|
354
401
|
class WorkflowFactory
|
355
402
|
|
356
403
|
|
357
|
-
# Creates a new WorkflowFactory with the provided parameters. The construction parameters will be used for any
|
404
|
+
# Creates a new `WorkflowFactory` with the provided parameters. The construction parameters will be used for any
|
358
405
|
# workflow clients generated by this workflow factory.
|
359
406
|
#
|
360
407
|
# @param service
|
361
408
|
# The service to use for workflow clients generated by this workflow factory
|
362
409
|
#
|
363
410
|
# @param domain
|
364
|
-
# The SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) to use for
|
365
|
-
# workflow clients generated by this workflow factory
|
411
|
+
# The Amazon SWF [Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html) to use for
|
412
|
+
# workflow clients generated by this workflow factory.
|
366
413
|
#
|
367
414
|
# @param block
|
368
415
|
# A block of {StartWorkflowOptions} to use for clients generated by this workflow factory.
|
@@ -382,7 +429,7 @@ module AWS
|
|
382
429
|
# Get a {WorkflowClient} with the parameters used in the construction of this {WorkflowFactory}.
|
383
430
|
#
|
384
431
|
# @return [WorkflowClient]
|
385
|
-
# A workflow client
|
432
|
+
# A workflow client created with the parameters used when creating the {WorkflowFactory}.
|
386
433
|
#
|
387
434
|
def get_client
|
388
435
|
WorkflowClient.new(@service, @domain, @workflow_class, @options)
|
@@ -44,7 +44,7 @@ module AWS
|
|
44
44
|
# Get the current time.
|
45
45
|
#
|
46
46
|
# @return [Time]
|
47
|
-
# A `Time` object initialized to the
|
47
|
+
# A `Time` object initialized to the current time in milliseconds for a replay. This is the same time that
|
48
48
|
# is provided by the `:replay_current_time_millis` attribute.
|
49
49
|
#
|
50
50
|
def current_time
|
@@ -16,10 +16,10 @@
|
|
16
16
|
module AWS
|
17
17
|
module Flow
|
18
18
|
|
19
|
-
# Every workflow implementation needs to be a subclass of this class.
|
19
|
+
# Represents a workflow definition. Every workflow implementation needs to be a subclass of this class.
|
20
20
|
#
|
21
|
-
# Usually there should be no need to instantiate the class manually
|
22
|
-
# start the workflow
|
21
|
+
# Usually there should be no need to instantiate the class manually. Instead, the @execute method is called to
|
22
|
+
# start the workflow. You can think of this class as having factory class methods.
|
23
23
|
class WorkflowDefinition
|
24
24
|
|
25
25
|
attr_reader :decision_helper
|
@@ -44,9 +44,9 @@ module AWS
|
|
44
44
|
method_output.set(@instance.send(@workflow_method))
|
45
45
|
else
|
46
46
|
ruby_input = @converter.load input
|
47
|
-
# Have to have
|
47
|
+
# Have to have `ruby_input` in order to be able to handle sending
|
48
48
|
# arbitrary arguments correctly, as otherwise it will seem as if
|
49
|
-
# @workflow_method will always have an arity of 1
|
49
|
+
# @workflow_method will always have an arity of 1.
|
50
50
|
method_output.set(@instance.send(@workflow_method, *ruby_input))
|
51
51
|
end
|
52
52
|
end
|
@@ -41,7 +41,7 @@ module AWS
|
|
41
41
|
|
42
42
|
def delete_workflow_definition(definition)
|
43
43
|
FlowFiber.unset(FlowFiber.current, :decision_context)
|
44
|
-
#
|
44
|
+
# Indicates to GC that these values are no longer needed.
|
45
45
|
FlowFiber.local_variables.each_pair do |key, value|
|
46
46
|
value = nil
|
47
47
|
FlowFiber.local_variables.delete(key)
|
@@ -17,7 +17,7 @@ module AWS
|
|
17
17
|
module Flow
|
18
18
|
# This method is for internal use only and may be changed or removed
|
19
19
|
# without prior notice. Use {#workflow_client} instead.
|
20
|
-
#
|
20
|
+
# @api private
|
21
21
|
def workflow_factory(client, domain, &options)
|
22
22
|
WorkflowFactory.new(client, domain, options)
|
23
23
|
end
|
@@ -13,21 +13,21 @@
|
|
13
13
|
# permissions and limitations under the License.
|
14
14
|
##
|
15
15
|
|
16
|
-
# This file contains AsyncBacktrace, which takes care of decorating and properly filtering backtraces
|
16
|
+
# This file contains AsyncBacktrace, which takes care of decorating and properly filtering backtraces.
|
17
17
|
|
18
18
|
module AWS
|
19
19
|
module Flow
|
20
20
|
module Core
|
21
|
-
#
|
21
|
+
# @api private
|
22
22
|
class AsyncBacktrace
|
23
23
|
|
24
|
-
#
|
24
|
+
# @api private
|
25
25
|
def initialize(parent, backtrace)
|
26
26
|
@backtrace = AsyncBacktrace.filter(backtrace)
|
27
27
|
@parent = parent
|
28
28
|
end
|
29
29
|
|
30
|
-
#
|
30
|
+
# @api private
|
31
31
|
def backtrace
|
32
32
|
if @parent
|
33
33
|
AsyncBacktrace.merge(@backtrace, @parent.backtrace)
|
@@ -36,10 +36,10 @@ module AWS
|
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
|
-
#
|
39
|
+
# @api private
|
40
40
|
class << self
|
41
41
|
|
42
|
-
#
|
42
|
+
# @api private
|
43
43
|
def create(parent, frames_to_skip)
|
44
44
|
|
45
45
|
unless @disable_async_backtrace
|
@@ -48,21 +48,22 @@ module AWS
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
-
#
|
51
|
+
# @api private
|
52
52
|
def create_from_exception(parent, exception)
|
53
53
|
unless @disable_async_backtrace
|
54
54
|
AsyncBacktrace.new(parent, exception.backtrace);
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
-
#
|
58
|
+
# Removes all framework-related frames after application frames. Keep framework frames before application
|
59
59
|
# frames.
|
60
60
|
#
|
61
61
|
# @todo
|
62
62
|
# The correct implementation should not have framework frames before application frames as it is expected to
|
63
|
-
# call Kernel.caller with the correct number.
|
63
|
+
# call Kernel.caller with the correct number. In cases when this number is not correct,
|
64
64
|
# the frames are kept to not create confusion.
|
65
65
|
#
|
66
|
+
# @api private
|
66
67
|
def filter(backtrace)
|
67
68
|
if @disable_filtering
|
68
69
|
backtrace
|
@@ -71,7 +72,7 @@ module AWS
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
#
|
75
|
+
# @api private
|
75
76
|
def merge(*backtraces)
|
76
77
|
result = []
|
77
78
|
backtraces.each do | b |
|
@@ -83,27 +84,27 @@ module AWS
|
|
83
84
|
result
|
84
85
|
end
|
85
86
|
|
86
|
-
#
|
87
|
+
# @api private
|
87
88
|
def disable_filtering
|
88
89
|
@disable_filtering = true
|
89
90
|
end
|
90
91
|
|
91
|
-
#
|
92
|
+
# @api private
|
92
93
|
def enable_filtering
|
93
94
|
@disable_filtering = false
|
94
95
|
end
|
95
96
|
|
96
|
-
#
|
97
|
+
# @api private
|
97
98
|
def disable
|
98
99
|
@disable_async_backtrace = true
|
99
100
|
end
|
100
101
|
|
101
|
-
#
|
102
|
+
# @api private
|
102
103
|
def enable
|
103
104
|
@disable_async_backtrace = false
|
104
105
|
end
|
105
106
|
|
106
|
-
#
|
107
|
+
# @api private
|
107
108
|
def caller(skip)
|
108
109
|
random_var = Kernel.caller 0
|
109
110
|
this_stuff = 1.upto(6).map { |x| Kernel.caller(x) }
|
@@ -113,11 +114,11 @@ module AWS
|
|
113
114
|
|
114
115
|
private
|
115
116
|
|
116
|
-
#
|
117
|
+
# @api private
|
117
118
|
def do_filter(backtrace)
|
118
119
|
return nil unless backtrace
|
119
|
-
#
|
120
|
-
# then cut all frames starting from asynchrony frame
|
120
|
+
# Keep asynchrony frames at the top of the backtrace only
|
121
|
+
# then cut all frames starting from asynchrony frame.
|
121
122
|
skip_asynchrony_frames = false
|
122
123
|
@backtrace = backtrace.take_while do |frame|
|
123
124
|
if ! $RUBY_FLOW_FILES.select {|file| Regexp.new(file) =~ frame}.empty?
|