aws-flow 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. checksums.yaml +15 -0
  2. data/aws-flow.gemspec +1 -0
  3. data/lib/aws/decider/activity.rb +8 -6
  4. data/lib/aws/decider/async_decider.rb +1 -0
  5. data/lib/aws/decider/async_retrying_executor.rb +3 -3
  6. data/lib/aws/decider/decider.rb +16 -14
  7. data/lib/aws/decider/executor.rb +35 -22
  8. data/lib/aws/decider/flow_defaults.rb +28 -14
  9. data/lib/aws/decider/generic_client.rb +3 -4
  10. data/lib/aws/decider/options.rb +91 -117
  11. data/lib/aws/decider/state_machines.rb +1 -0
  12. data/lib/aws/decider/utilities.rb +15 -0
  13. data/lib/aws/decider/version.rb +1 -1
  14. data/lib/aws/decider/worker.rb +14 -8
  15. data/lib/aws/decider/workflow_client.rb +16 -11
  16. data/lib/aws/runner.rb +43 -39
  17. data/spec/aws/decider/integration/activity_spec.rb +345 -0
  18. data/spec/aws/{integration → decider/integration}/integration_spec.rb +818 -1183
  19. data/spec/aws/decider/integration/setup.rb +3 -0
  20. data/spec/aws/decider/unit/activity_spec.rb +233 -0
  21. data/spec/aws/decider/unit/async_retrying_executor_spec.rb +131 -0
  22. data/spec/aws/{unit → decider/unit}/decider_spec.rb +171 -718
  23. data/spec/aws/decider/unit/executor_spec.rb +123 -0
  24. data/spec/aws/decider/unit/flow_defaults_spec.rb +62 -0
  25. data/spec/aws/decider/unit/misc_spec.rb +101 -0
  26. data/spec/aws/decider/unit/options_spec.rb +289 -0
  27. data/spec/aws/decider/unit/retry_spec.rb +217 -0
  28. data/spec/aws/{unit → decider/unit}/rubyflow.rb +0 -0
  29. data/spec/aws/decider/unit/setup.rb +3 -0
  30. data/spec/aws/decider/unit/worker_spec.rb +325 -0
  31. data/spec/aws/decider/unit/workflow_client_spec.rb +83 -0
  32. data/spec/aws/{unit → flow}/async_backtrace_spec.rb +0 -0
  33. data/spec/aws/{unit → flow}/async_scope_spec.rb +0 -0
  34. data/spec/aws/{unit → flow}/begin_rescue_ensure_spec.rb +1 -0
  35. data/spec/aws/{unit → flow}/external_task_spec.rb +0 -0
  36. data/spec/aws/{unit → flow}/factories.rb +0 -0
  37. data/spec/aws/{unit → flow}/fiber_condition_variable_spec.rb +0 -0
  38. data/spec/aws/{unit → flow}/fiber_spec.rb +0 -0
  39. data/spec/aws/{unit → flow}/flow_spec.rb +0 -0
  40. data/spec/aws/{unit → flow}/future_spec.rb +0 -0
  41. data/spec/aws/{unit → flow}/simple_dfa_spec.rb +0 -0
  42. data/spec/aws/{integration → runner/integration}/runner_integration_spec.rb +16 -43
  43. data/spec/aws/{unit → runner/unit}/runner_unit_spec.rb +18 -18
  44. data/spec/spec_helper.rb +264 -2
  45. metadata +37 -28
  46. data/spec/aws/unit/executor_spec.rb +0 -49
  47. data/spec/aws/unit/options_spec.rb +0 -293
  48. data/spec/aws/unit/preinclude_tests.rb +0 -149
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
5
- prerelease:
4
+ version: 2.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Michael Steger, Paritosh Mohan, Jacques Thomas
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-07-09 00:00:00.000000000 Z
11
+ date: 2014-08-21 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: aws-sdk
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -25,7 +23,6 @@ dependencies:
25
23
  type: :runtime
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
27
  - - ~>
31
28
  - !ruby/object:Gem::Version
@@ -83,48 +80,60 @@ files:
83
80
  - lib/aws/flow/simple_dfa.rb
84
81
  - lib/aws/flow/tasks.rb
85
82
  - lib/aws/runner.rb
86
- - spec/aws/integration/integration_spec.rb
87
- - spec/aws/integration/runner_integration_spec.rb
88
- - spec/aws/unit/async_backtrace_spec.rb
89
- - spec/aws/unit/async_scope_spec.rb
90
- - spec/aws/unit/begin_rescue_ensure_spec.rb
91
- - spec/aws/unit/decider_spec.rb
92
- - spec/aws/unit/executor_spec.rb
93
- - spec/aws/unit/external_task_spec.rb
94
- - spec/aws/unit/factories.rb
95
- - spec/aws/unit/fiber_condition_variable_spec.rb
96
- - spec/aws/unit/fiber_spec.rb
97
- - spec/aws/unit/flow_spec.rb
98
- - spec/aws/unit/future_spec.rb
99
- - spec/aws/unit/options_spec.rb
100
- - spec/aws/unit/preinclude_tests.rb
101
- - spec/aws/unit/rubyflow.rb
102
- - spec/aws/unit/runner_unit_spec.rb
103
- - spec/aws/unit/simple_dfa_spec.rb
83
+ - spec/aws/decider/integration/activity_spec.rb
84
+ - spec/aws/decider/integration/integration_spec.rb
85
+ - spec/aws/decider/integration/setup.rb
86
+ - spec/aws/decider/unit/activity_spec.rb
87
+ - spec/aws/decider/unit/async_retrying_executor_spec.rb
88
+ - spec/aws/decider/unit/decider_spec.rb
89
+ - spec/aws/decider/unit/executor_spec.rb
90
+ - spec/aws/decider/unit/flow_defaults_spec.rb
91
+ - spec/aws/decider/unit/misc_spec.rb
92
+ - spec/aws/decider/unit/options_spec.rb
93
+ - spec/aws/decider/unit/retry_spec.rb
94
+ - spec/aws/decider/unit/rubyflow.rb
95
+ - spec/aws/decider/unit/setup.rb
96
+ - spec/aws/decider/unit/worker_spec.rb
97
+ - spec/aws/decider/unit/workflow_client_spec.rb
98
+ - spec/aws/flow/async_backtrace_spec.rb
99
+ - spec/aws/flow/async_scope_spec.rb
100
+ - spec/aws/flow/begin_rescue_ensure_spec.rb
101
+ - spec/aws/flow/external_task_spec.rb
102
+ - spec/aws/flow/factories.rb
103
+ - spec/aws/flow/fiber_condition_variable_spec.rb
104
+ - spec/aws/flow/fiber_spec.rb
105
+ - spec/aws/flow/flow_spec.rb
106
+ - spec/aws/flow/future_spec.rb
107
+ - spec/aws/flow/simple_dfa_spec.rb
108
+ - spec/aws/runner/integration/runner_integration_spec.rb
109
+ - spec/aws/runner/unit/runner_unit_spec.rb
104
110
  - spec/spec_helper.rb
105
111
  homepage: https://aws.amazon.com/swf/details/flow/
106
112
  licenses: []
113
+ metadata: {}
107
114
  post_install_message:
108
115
  rdoc_options: []
109
116
  require_paths:
110
117
  - lib
111
118
  - lib/aws/
112
119
  required_ruby_version: !ruby/object:Gem::Requirement
113
- none: false
114
120
  requirements:
121
+ - - ~>
122
+ - !ruby/object:Gem::Version
123
+ version: '1.9'
115
124
  - - ! '>='
116
125
  - !ruby/object:Gem::Version
117
- version: '0'
126
+ version: 1.9.1
118
127
  required_rubygems_version: !ruby/object:Gem::Requirement
119
- none: false
120
128
  requirements:
121
129
  - - ! '>='
122
130
  - !ruby/object:Gem::Version
123
131
  version: '0'
124
132
  requirements: []
125
133
  rubyforge_project:
126
- rubygems_version: 1.8.23
134
+ rubygems_version: 2.2.2
127
135
  signing_key:
128
- specification_version: 3
136
+ specification_version: 4
129
137
  summary: AWS Flow Framework for Ruby
130
138
  test_files: []
139
+ has_rdoc:
@@ -1,49 +0,0 @@
1
- ##
2
- # Copyright 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License").
5
- # You may not use this file except in compliance with the License.
6
- # A copy of the License is located at
7
- #
8
- # http://aws.amazon.com/apache2.0
9
- #
10
- # or in the "license" file accompanying this file. This file is distributed
11
- # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12
- # express or implied. See the License for the specific language governing
13
- # permissions and limitations under the License.
14
- ##
15
-
16
- require 'aws/decider'
17
-
18
- describe AWS::Flow::ForkingExecutor do
19
- context "#remove_completed_pids" do
20
- context "with block=false" do
21
- it "should reap all completed child processes" do
22
- executor = AWS::Flow::ForkingExecutor.new(max_workers: 3)
23
-
24
- executor.execute { sleep 1 }
25
- executor.execute { sleep 1 }
26
- executor.execute { sleep 5 }
27
- executor.pids.size.should == 3
28
- sleep 2
29
- executor.send(:remove_completed_pids, false)
30
- # The two processes that are completed will be reaped.
31
- executor.pids.size.should == 1
32
- end
33
- end
34
- context "with block=true" do
35
- it "should wait for and reap the first child process available" do
36
- executor = AWS::Flow::ForkingExecutor.new(max_workers: 3)
37
-
38
- executor.execute { sleep 1 }
39
- executor.execute { sleep 1 }
40
- executor.execute { sleep 5 }
41
- executor.pids.size.should == 3
42
- sleep 2
43
- executor.send(:remove_completed_pids, true)
44
- # One of the two processes that are completed will be reaped
45
- executor.pids.size.should == 2
46
- end
47
- end
48
- end
49
- end
@@ -1,293 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe AWS::Flow::OptionsMethods do
4
-
5
- class FooDefaults < AWS::Flow::Defaults
6
- def default_foo; 1; end
7
- def default_baz; 2; end
8
- def default_xyz; 3; end
9
- end
10
- class FooOptions < AWS::Flow::Options
11
- include AWS::Flow::OptionsMethods
12
- property(:default_foo)
13
- property(:foo)
14
- property(:bar)
15
- property(:baz)
16
- property(:xyz)
17
- property(:default_baz)
18
- default_classes << FooDefaults.new
19
-
20
- def default_keys
21
- [:default_foo, :default_baz, :default_xyz]
22
- end
23
- def make_runtime_key(key)
24
- key.to_s.gsub(/default_/, "").to_sym
25
- end
26
- end
27
-
28
- context "#get_full_options" do
29
- it "should return merged default and regular options" do
30
- options = FooOptions.new(
31
- default_foo: 10,
32
- bar: 10,
33
- xyz: 10
34
- )
35
- options.get_full_options[:foo].should == "10"
36
- options.get_full_options[:bar].should == "10"
37
- options.get_full_options[:baz].should == "2"
38
- options.get_full_options[:xyz].should == "10"
39
-
40
- end
41
- end
42
-
43
- context "#get_runtime_options" do
44
- it "should return the runtime values for the default options" do
45
- options = FooOptions.new(
46
- default_foo: 10,
47
- bar: 10
48
- )
49
- options.get_runtime_options.has_key?(:foo).should == true
50
- options.get_runtime_options.has_key?(:baz).should == true
51
- options.get_runtime_options[:foo].should == "10"
52
- options.get_runtime_options[:baz].should == "2"
53
- options.get_runtime_options.has_key?(:bar).should == false
54
- end
55
- end
56
- context "#get_default_options" do
57
- it "should return the default values for the default options" do
58
- options = FooOptions.new(
59
- default_foo: 10,
60
- baz: 10
61
- )
62
- options.get_default_options.has_key?(:default_foo).should == true
63
- options.get_default_options.has_key?(:default_baz).should == true
64
- options.get_default_options[:default_foo].should == "10"
65
- options.get_default_options[:default_baz].should == "2"
66
- end
67
- end
68
- end
69
-
70
- describe AWS::Flow::ActivityOptions do
71
- context "#defaults" do
72
- it "should be initialized correctly" do
73
- options = AWS::Flow::ActivityOptions.new
74
- options.default_task_schedule_to_start_timeout.should == "NONE"
75
- options.default_task_schedule_to_close_timeout.should == "NONE"
76
- options.default_task_start_to_close_timeout.should == "NONE"
77
- options.default_task_heartbeat_timeout.should == "NONE"
78
- options.data_converter.should ==
79
- AWS::Flow::FlowConstants.default_data_converter
80
- end
81
-
82
- it "should change to the value passed in" do
83
- options = AWS::Flow::ActivityOptions.new({
84
- default_task_schedule_to_start_timeout: 20,
85
- default_task_schedule_to_close_timeout: 50,
86
- default_task_start_to_close_timeout: 30,
87
- default_task_heartbeat_timeout: 5,
88
- })
89
- options.default_task_schedule_to_start_timeout.should == "20"
90
- options.default_task_schedule_to_close_timeout.should == "50"
91
- options.default_task_start_to_close_timeout.should == "30"
92
- options.default_task_heartbeat_timeout.should == "5"
93
- end
94
-
95
- it "should remain the same when a non default value is set" do
96
- options = AWS::Flow::ActivityOptions.new
97
- options.schedule_to_start_timeout = 20
98
- options.schedule_to_close_timeout = 50
99
- options.start_to_close_timeout = 30
100
- options.heartbeat_timeout = 5
101
-
102
- options.default_task_schedule_to_start_timeout.should == "NONE"
103
- options.default_task_schedule_to_close_timeout.should == "NONE"
104
- options.default_task_start_to_close_timeout.should == "NONE"
105
- options.default_task_heartbeat_timeout.should == "NONE"
106
- end
107
-
108
- it "should not override non default values when non default values are set" do
109
- options = AWS::Flow::ActivityOptions.new
110
- options.schedule_to_start_timeout = 20
111
- options.schedule_to_close_timeout = 50
112
- options.start_to_close_timeout = 30
113
- options.heartbeat_timeout = 5
114
-
115
- options.schedule_to_start_timeout.should == "20"
116
- options.schedule_to_close_timeout.should == "50"
117
- options.start_to_close_timeout.should == "30"
118
- options.heartbeat_timeout.should == "5"
119
- end
120
-
121
-
122
- end
123
-
124
- context "#default_keys" do
125
- it "should return the correct set of default keys" do
126
- AWS::Flow::ActivityOptions.new.default_keys.should == [
127
- :default_task_heartbeat_timeout,
128
- :default_task_schedule_to_close_timeout,
129
- :default_task_schedule_to_start_timeout,
130
- :default_task_start_to_close_timeout,
131
- :default_task_list
132
- ]
133
- end
134
-
135
- end
136
- context "#make_runtime_key" do
137
- it "should correctly convert default keys to runtime keys" do
138
- AWS::Flow::ActivityOptions.new.make_runtime_key(
139
- :default_task_foo
140
- ).should == :foo
141
- end
142
-
143
- it "should do nothing if an option without leading default_ is passed in" do
144
- AWS::Flow::ActivityOptions.new.make_runtime_key(:foo).should == :foo
145
- end
146
-
147
- it "should handle the special case of default_task_list properly" do
148
- AWS::Flow::ActivityOptions.new.make_runtime_key(
149
- :default_task_list
150
- ).should == :task_list
151
- end
152
- end
153
- end
154
-
155
- describe AWS::Flow::WorkflowOptions do
156
- context "#defaults" do
157
- it "should be initialized correctly" do
158
- options = AWS::Flow::WorkflowOptions.new
159
- options.default_task_start_to_close_timeout.should == "30"
160
- options.default_child_policy.should == "TERMINATE"
161
- options.tag_list.should == []
162
- options.data_converter.should ==
163
- AWS::Flow::FlowConstants.default_data_converter
164
- end
165
-
166
- it "should change to the value passed in" do
167
- options = AWS::Flow::WorkflowOptions.new({
168
- default_task_start_to_close_timeout: 20,
169
- default_execution_start_to_close_timeout: 120,
170
- default_child_policy: "ABANDON",
171
- })
172
- options.default_task_start_to_close_timeout.should == "20"
173
- options.default_execution_start_to_close_timeout.should == "120"
174
- options.default_child_policy.should == "ABANDON"
175
- end
176
-
177
- it "should remain the same when a non default value is set" do
178
- options = AWS::Flow::WorkflowOptions.new
179
- options.task_start_to_close_timeout = 20
180
- options.execution_start_to_close_timeout = 120
181
- options.child_policy = "ABANDON"
182
-
183
- options.default_task_start_to_close_timeout.should == "30"
184
- options.default_execution_start_to_close_timeout.nil?.should == true
185
- options.default_child_policy.should == "TERMINATE"
186
- end
187
-
188
- it "should not override non default values when non default values are set" do
189
- options = AWS::Flow::WorkflowOptions.new
190
- options.task_start_to_close_timeout = 20
191
- options.execution_start_to_close_timeout = 120
192
- options.child_policy = "ABANDON"
193
-
194
- options.task_start_to_close_timeout.should == "20"
195
- options.execution_start_to_close_timeout.should == "120"
196
- options.child_policy.should == "ABANDON"
197
- end
198
-
199
- end
200
-
201
- context "#default_keys" do
202
- it "should return the correct set of default keys" do
203
- AWS::Flow::WorkflowOptions.new.default_keys.should == [
204
- :default_task_start_to_close_timeout,
205
- :default_execution_start_to_close_timeout,
206
- :default_task_list,
207
- :default_child_policy
208
- ]
209
- end
210
-
211
- end
212
- context "#make_runtime_key" do
213
- it "should correctly convert default keys to runtime keys" do
214
- AWS::Flow::WorkflowOptions.new.make_runtime_key(
215
- :default_foo
216
- ).should == :foo
217
- end
218
-
219
- it "should do nothing if an option without leading default_ is passed in" do
220
- AWS::Flow::WorkflowOptions.new.make_runtime_key(:foo).should == :foo
221
- end
222
-
223
- it "should handle the special case of default_task_list properly" do
224
- AWS::Flow::WorkflowOptions.new.make_runtime_key(
225
- :default_task_list
226
- ).should == :task_list
227
- end
228
- end
229
-
230
- end
231
-
232
- describe AWS::Flow::WorkflowDefaults do
233
- context "#default_task_start_to_close_timeout" do
234
- it "should return a value of 30" do
235
- AWS::Flow::WorkflowDefaults.new.default_task_start_to_close_timeout
236
- .should == 30
237
- end
238
- end
239
-
240
- context "#default_child_policy" do
241
- it "should return TERMINATE" do
242
- AWS::Flow::WorkflowDefaults.new.default_child_policy.should == "TERMINATE"
243
- end
244
- end
245
-
246
- context "#tag_list" do
247
- it "should return an empty array" do
248
- AWS::Flow::WorkflowDefaults.new.tag_list.should == []
249
- end
250
- end
251
-
252
- context "#data_converter" do
253
- it "should return the default data converter" do
254
- AWS::Flow::WorkflowDefaults.new.data_converter
255
- .should == AWS::Flow::FlowConstants.default_data_converter
256
- end
257
- end
258
- end
259
-
260
- describe AWS::Flow::ActivityDefaults do
261
- context "#default_task_schedule_to_start_timeout" do
262
- it "should return Float::INFINITY" do
263
- AWS::Flow::ActivityDefaults.new.default_task_schedule_to_start_timeout
264
- .should == Float::INFINITY
265
- end
266
- end
267
-
268
- context "#default_task_schedule_to_close_timeout" do
269
- it "should return Float::INFINITY" do
270
- AWS::Flow::ActivityDefaults.new.default_task_schedule_to_close_timeout
271
- .should == Float::INFINITY
272
- end
273
- end
274
- context "#default_task_start_to_close_timeout" do
275
- it "should return Float::INFINITY" do
276
- AWS::Flow::ActivityDefaults.new.default_task_start_to_close_timeout
277
- .should == Float::INFINITY
278
- end
279
- end
280
- context "#default_task_heartbeat_timeout" do
281
- it "should return Float::INFINITY" do
282
- AWS::Flow::ActivityDefaults.new.default_task_heartbeat_timeout
283
- .should == Float::INFINITY
284
- end
285
- end
286
- context "#data_converter" do
287
- it "should return the default data converter" do
288
- AWS::Flow::ActivityDefaults.new.data_converter
289
- .should == AWS::Flow::FlowConstants.default_data_converter
290
- end
291
- end
292
- end
293
-