simpler_workflow 0.2.5 → 0.2.6

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.
data/README.md CHANGED
@@ -197,6 +197,31 @@ Another addition in 0.2.0 is the swf command. This command provides a
197
197
  script that starts and stops the workflows and provide other monitoring
198
198
  tools.
199
199
 
200
+ ## Reporting Errors
201
+
202
+ We now log exceptions and errors that occur while running activities or
203
+ handling decision tasks. The default strategy is to log the errors, but
204
+ it is easy to plug in a custom strategy. This is how you can plug in a
205
+ strategy in a Rails initializer:
206
+
207
+ ```ruby
208
+ module SimplerWorkflow
209
+ unless Rails.env.development?
210
+ exception_reporter do |e, context|
211
+ Exceptional.context(context)
212
+ Exceptional.handle(e)
213
+ end
214
+ end
215
+ end
216
+ ```
217
+
218
+ The block passed to the ```exception_reporter``` method will receive the
219
+ exception and the context that has been computed from the activity or
220
+ decition task.
221
+
222
+ This has been extremely helpful in tracking down and fixing errors
223
+ within a workflow that was failing quietly.
224
+
200
225
  ## Contributing
201
226
 
202
227
  We welcome all kinds of contributions. This include code, fixes, issues, documentation, tests... Here's how you can contribute:
@@ -17,7 +17,7 @@ module SimplerWorkflow
17
17
  @domain = domain
18
18
  @name = name
19
19
  @version = version
20
- @failure_policy = :abort
20
+ @failure_policy = :fail
21
21
  self
22
22
  end
23
23
  end
@@ -41,7 +41,7 @@ module SimplerWorkflow
41
41
  end
42
42
 
43
43
  def failure_policy
44
- @failure_policy || :abort
44
+ @failure_policy || :fail
45
45
  end
46
46
 
47
47
  def perform_activity(&block)
@@ -105,7 +105,7 @@ module SimplerWorkflow
105
105
  context[:input] = task.input
106
106
  context[:activity_id] = task.activity_id
107
107
  SimplerWorkflow.exception_reporter.report(e, context)
108
- task.fail! :reason => e.message, :details => { :failure_policy => :abort }.to_json unless task.responded?
108
+ task.fail! :reason => e.message, :details => { :failure_policy => :fail }.to_json unless task.responded?
109
109
  end
110
110
  end
111
111
  Process.exit(0) if @time_to_exit
@@ -10,13 +10,11 @@ module SimplerWorkflow
10
10
  end
11
11
 
12
12
  def report(e, context = {})
13
- if reporter
14
- reporter.call(e, context)
15
- else
16
- SimplerWorkflow.logger.error("[#{tag}] Exception: #{e.message}")
17
- SimplerWorkflow.logger.error("[#{tag}] Context: #{context.inspect}") unless context.empty?
18
- SimplerWorkflow.logger.error("[#{tag}] Backtrace:\n#{e.backtrace.join("\n")}")
19
- end
13
+ reporter.call(e, context) if reporter
14
+ ensure
15
+ SimplerWorkflow.logger.error("[#{tag}] Exception: #{e.message}")
16
+ SimplerWorkflow.logger.error("[#{tag}] Context: #{context.inspect}") unless context.empty?
17
+ SimplerWorkflow.logger.error("[#{tag}] Backtrace:\n#{e.backtrace.join("\n")}")
20
18
  end
21
19
 
22
20
  def tag
@@ -1,3 +1,3 @@
1
1
  module SimplerWorkflow
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -125,8 +125,10 @@ module SimplerWorkflow
125
125
  if event.attributes.keys.include?(:details)
126
126
  details = Map.from_json(event.attributes.details)
127
127
  case details.failure_policy.to_sym
128
- when :abort
128
+ when :abort, :cancel
129
129
  decision_task.cancel_workflow_execution
130
+ when :fail
131
+ decision.task.fail_workflow_execution
130
132
  when :retry
131
133
  logger.info("Retrying activity #{last_activity(decision_task, event).name} #{last_activity(decision_task, event).version}")
132
134
  decision_task.schedule_activity_task last_activity(decision_task, event), :input => last_input(decision_task, event)
@@ -27,7 +27,7 @@ EOM
27
27
  gem.require_paths = ["lib"]
28
28
  gem.version = SimplerWorkflow::VERSION
29
29
 
30
- gem.add_dependency 'aws-sdk', '~> 1.5.0'
30
+ gem.add_dependency 'aws-sdk', '~> 1.6.0'
31
31
  gem.add_dependency 'map'
32
32
  gem.add_development_dependency 'rake'
33
33
  gem.add_development_dependency 'rspec'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simpler_workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-03 00:00:00.000000000 Z
12
+ date: 2012-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: aws-sdk
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: 1.5.0
21
+ version: 1.6.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 1.5.0
29
+ version: 1.6.0
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: map
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -126,7 +126,7 @@ files:
126
126
  - spec/spec_helper.rb
127
127
  homepage: https://github.com/fredjean/simpler_workflow
128
128
  licenses: []
129
- post_install_message: ! "simpler_workflow 0.2.5\n========================\n\nHave
129
+ post_install_message: ! "simpler_workflow 0.2.6\n========================\n\nHave
130
130
  a look at https://github.com/fredjean/simpler_workflow/wiki/MIgrating-to-0.2.0 if
131
131
  you\nare upgrading from a 0.1.x version of the gem. There is a fundamental change
132
132
  in how the \nactivity and decision loops are run. You may need to adjust your application
@@ -141,12 +141,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
141
  - - ! '>='
142
142
  - !ruby/object:Gem::Version
143
143
  version: '0'
144
+ segments:
145
+ - 0
146
+ hash: 2517248019212001977
144
147
  required_rubygems_version: !ruby/object:Gem::Requirement
145
148
  none: false
146
149
  requirements:
147
150
  - - ! '>='
148
151
  - !ruby/object:Gem::Version
149
152
  version: '0'
153
+ segments:
154
+ - 0
155
+ hash: 2517248019212001977
150
156
  requirements: []
151
157
  rubyforge_project:
152
158
  rubygems_version: 1.8.23