simpler_workflow 0.1.12 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +50 -0
- data/README.md +17 -2
- data/bin/swf +19 -27
- data/lib/aws/simple_workflow/decision_task_additions.rb +11 -1
- data/lib/simpler_workflow/activity.rb +40 -26
- data/lib/simpler_workflow/tasks.rb +47 -0
- data/lib/simpler_workflow/version.rb +1 -1
- data/lib/simpler_workflow/workflow.rb +46 -31
- data/lib/simpler_workflow.rb +16 -9
- data/lib/tasks/simpler_workflow.rake +2 -0
- data/simpler_workflow.gemspec +13 -1
- metadata +18 -5
- data/lib/simpler_workflow/default_exception_reporter.rb +0 -26
data/CHANGELOG.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
0.2.0
|
2
|
+
=====
|
3
|
+
|
4
|
+
Switches from running activity and decision loops in a thread to running
|
5
|
+
them as child process. This will simplify monitoring the different loops
|
6
|
+
and provide insulation from the other loops.
|
7
|
+
|
8
|
+
* Adds ```simpler_workflow:work``` rake task to locate, load and run the
|
9
|
+
activity and decision loops.
|
10
|
+
* Adds the option to perform an action after forking a child process.
|
11
|
+
* Adds a swf script used to manage the workflow. The following actions
|
12
|
+
are supported:
|
13
|
+
* *start* - Start the activity and decision loops located under
|
14
|
+
lib/workflow as a daemon
|
15
|
+
* *run* - runs the activity and decision loops without daemonizing
|
16
|
+
them.
|
17
|
+
* *stop* - stops the activity and decision loops.
|
18
|
+
* *pstree* - shows the child processes
|
19
|
+
* *shutdown* - shuts down the activity and decision loops
|
20
|
+
* *tail* - tails the logs associated with the workflow.
|
21
|
+
* Preloads the Rails environment (if running under Rails) to reduce the
|
22
|
+
amount of time spent loading it after forking. May also reduce the
|
23
|
+
memory footprint of the application by sharing memory (on some
|
24
|
+
platform).
|
25
|
+
|
26
|
+
Migrating to 0.2.0
|
27
|
+
------------------
|
28
|
+
|
29
|
+
The workflow definitions should stay the same. You can either choose to
|
30
|
+
use the ```swf``` script to manage the workflows, build on top of the ```simpler_workflow:work```
|
31
|
+
rake task or keep your existing scripts.
|
32
|
+
|
33
|
+
You will need to add ```Process.waitall``` to prevent the parent
|
34
|
+
process from exiting prematurely.
|
35
|
+
|
36
|
+
Using the ```SimplerWorkflow.after_fork``` method
|
37
|
+
-------------------------------------------------
|
38
|
+
|
39
|
+
You can use the ```SimplerWorkflow.after_form``` method to perform
|
40
|
+
actions after the child processes have been forked. This is useful to
|
41
|
+
re-establish ActiveRecord connections when using PostgreSQL for example.
|
42
|
+
Here's an example of this usage:
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
SimplerWorkflow.after_fork do
|
46
|
+
ActiveRecord::Base.establish_connection
|
47
|
+
end
|
48
|
+
```
|
49
|
+
|
50
|
+
It's usage is very similar to Resque's usage.
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SimplerWorkflow
|
2
2
|
|
3
|
-
[![Build Status](https://secure.travis-ci.org/
|
3
|
+
[![Build Status](https://secure.travis-ci.org/fredjean/simpler_workflow.png)](http://travis-ci.org/fredjean/simpler_workflow)
|
4
4
|
|
5
5
|
A wrapper around Amazon's Simple Workflow Service meant to simplify declaring and using activities and workflow. Provides some sane defaults
|
6
6
|
and work around some idiosyncracies of the platform.
|
@@ -90,7 +90,9 @@ end
|
|
90
90
|
my_activity.start_activity_loop
|
91
91
|
```
|
92
92
|
|
93
|
-
The activity manages a loop that waits for messages from SWF.
|
93
|
+
The activity manages a loop that waits for messages from SWF. It runs
|
94
|
+
under it's own sub-process to make it easier to manage and isolate each
|
95
|
+
of the activities.
|
94
96
|
|
95
97
|
Activities are passed a task parameter. This parameter is provided to the activity by SWF and provides a lot of information about the task
|
96
98
|
at end. One item passed is the input attribute.
|
@@ -150,6 +152,9 @@ The next step is to start the decision loop:
|
|
150
152
|
my_workflow.decision_loop
|
151
153
|
```
|
152
154
|
|
155
|
+
The decision loop will be launched in it's own sub-process and will
|
156
|
+
proceed to poll SWF for decision tasks.
|
157
|
+
|
153
158
|
#### Customizing the workflow
|
154
159
|
|
155
160
|
There are hooks for different section of the decision loop. You can specify what happens when the workflow is started with the ```on_start_execution```
|
@@ -182,6 +187,16 @@ Here are a few recommendations on when to change the version of a workflow or ac
|
|
182
187
|
2. You may want to bump a version if you have work in progress under an existing workflow and you need to introduce changes for new work. You will need to keep the older activity and or workflow around while it completes.
|
183
188
|
3. You do not need to bump the version when you change the work performed by the activity or the decision loop itself. This is code that is directly managed by SimplerWorkflow and isn't communicated to AWS. This only works if you do not want previous workflows to finish using the previous version of the code though.
|
184
189
|
|
190
|
+
## Running Workflows
|
191
|
+
|
192
|
+
There is a new Rake task called ```simpler_workflow:work``` that will
|
193
|
+
look for workflows located under the ```lib/workflow``` directory. This
|
194
|
+
makes it much easier to put together a few workflow and manage them.
|
195
|
+
|
196
|
+
Another addition in 0.2.0 is the swf command. This command provides a
|
197
|
+
script that starts and stops the workflows and provide other monitoring
|
198
|
+
tools.
|
199
|
+
|
185
200
|
## Contributing
|
186
201
|
|
187
202
|
We welcome all kinds of contributions. This include code, fixes, issues, documentation, tests... Here's how you can contribute:
|
data/bin/swf
CHANGED
@@ -1,29 +1,27 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
|
+
# Mostly based on @ahoward's https://gist.github.com/3098500 with a few fixes and
|
4
|
+
# adjustments.
|
3
5
|
|
4
6
|
# setup
|
5
7
|
#
|
6
8
|
require 'fileutils'
|
7
9
|
|
10
|
+
pwd = ENV['PWD']
|
8
11
|
script = File.expand_path(__FILE__).gsub(%r|\breleases/\d+\b|, 'current')
|
9
|
-
|
10
|
-
rails_root = File.dirname(script_dir)
|
12
|
+
rails_root = pwd.gsub(%r|\breleases/\d+\b|, 'current')
|
11
13
|
|
12
14
|
Dir.chdir(rails_root)
|
13
15
|
|
14
|
-
|
15
|
-
|
16
|
-
FileUtils.mkdir_p(File.join(rails_root, 'log', 'jobs'))
|
17
|
-
FileUtils.touch(File.join(rails_root, 'log', 'jobs', 'pid'))
|
18
|
-
|
19
|
-
%w(
|
20
|
-
BACKGROUND PIDFILE QUEUE VVERBOSE INTERVAL COUNT
|
21
|
-
).each{|key| ENV.delete(key)}
|
16
|
+
FileUtils.mkdir_p(File.join(rails_root, 'log', 'workflow'))
|
17
|
+
FileUtils.touch(File.join(rails_root, 'log', 'workflow', 'pid'))
|
22
18
|
|
23
19
|
quiet = ARGV.delete('-q') || ARGV.delete('--quiet')
|
24
20
|
mode = ARGV.shift || 'run'
|
25
21
|
|
26
|
-
pidfile = './log/
|
22
|
+
pidfile = './log/workflow/pid'
|
23
|
+
lockfile = File.open('./log/workflow/lock', "w")
|
24
|
+
|
27
25
|
pid = Integer(IO.read(pidfile).strip) rescue nil
|
28
26
|
running = begin; Process.kill(0, pid); true; rescue Object; false; end
|
29
27
|
|
@@ -34,15 +32,12 @@
|
|
34
32
|
puts(pid) if running
|
35
33
|
|
36
34
|
when 'run'
|
37
|
-
exit(42) unless
|
35
|
+
exit(42) unless lockfile.flock(File::LOCK_EX | File::LOCK_NB)
|
38
36
|
|
39
|
-
|
40
|
-
ENV['QUEUE'] = 'jobs'
|
41
|
-
ENV['VVERBOSE'] = '1'
|
42
|
-
exec "rake environment resque:work"
|
37
|
+
exec "rake simpler_workflow:work"
|
43
38
|
|
44
39
|
when 'start'
|
45
|
-
exit(42) unless
|
40
|
+
exit(42) unless lockfile.flock(File::LOCK_EX | File::LOCK_NB)
|
46
41
|
|
47
42
|
unless running
|
48
43
|
FileUtils.rm_f(pidfile)
|
@@ -54,6 +49,7 @@
|
|
54
49
|
pid = Integer(a.read.strip)
|
55
50
|
a.close
|
56
51
|
puts(pid) unless quiet
|
52
|
+
File.open(pidfile, "w") { |f| f.write(pid) }
|
57
53
|
exit
|
58
54
|
end
|
59
55
|
exit!(0) if fork
|
@@ -66,7 +62,7 @@
|
|
66
62
|
'stdout' => STDOUT,
|
67
63
|
'stderr' => STDERR,
|
68
64
|
}.each do |basename, io|
|
69
|
-
path = File.join("log/
|
65
|
+
path = File.join("log/workflow/#{ basename }")
|
70
66
|
begin
|
71
67
|
open(path, 'a+'){|fd| io.reopen(fd)}
|
72
68
|
rescue
|
@@ -77,18 +73,13 @@
|
|
77
73
|
Process.setsid rescue nil
|
78
74
|
File.umask(0) rescue nil
|
79
75
|
|
80
|
-
|
81
|
-
# Looks like a good place to load and run a task that launches a workflow...
|
82
|
-
ENV['PIDFILE'] = pidfile
|
83
|
-
ENV['QUEUE'] = 'jobs'
|
84
|
-
ENV['VVERBOSE'] = '1' if ENV['RAILS_ENV'] != 'production'
|
85
|
-
exec "rake environment resque:work"
|
76
|
+
exec "rake simpler_workflow:work"
|
86
77
|
end
|
87
78
|
|
88
79
|
when 'stop'
|
89
80
|
if running
|
90
81
|
begin
|
91
|
-
Process.kill('
|
82
|
+
Process.kill('QUIT', pid)
|
92
83
|
rescue Errno::ESRCH
|
93
84
|
nil
|
94
85
|
end
|
@@ -135,10 +126,11 @@
|
|
135
126
|
exec "#{ script } start -q >/dev/null 2>&1"
|
136
127
|
|
137
128
|
when 'tail'
|
138
|
-
exec "tail -F ./log/
|
129
|
+
exec "tail -F ./log/workflow/*"
|
139
130
|
|
140
131
|
when 'pstree'
|
141
132
|
exec "pstree #{ pid }" if running
|
142
133
|
end
|
143
|
-
|
134
|
+
|
144
135
|
__END__
|
136
|
+
|
@@ -3,10 +3,20 @@ require 'aws/simple_workflow/decision_task'
|
|
3
3
|
module AWS
|
4
4
|
class SimpleWorkflow
|
5
5
|
module DecisionTaskAdditions
|
6
|
+
def self.extended(inst)
|
7
|
+
inst.class.__send__ :alias_method, :_original_events, :events
|
8
|
+
end
|
9
|
+
|
6
10
|
def scheduled_event(event)
|
7
|
-
|
11
|
+
events.to_a[event.attributes.scheduled_event_id - 1]
|
12
|
+
end
|
13
|
+
|
14
|
+
def events
|
15
|
+
@__original_events ||= _original_events
|
8
16
|
end
|
17
|
+
|
9
18
|
end
|
19
|
+
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
@@ -52,11 +52,8 @@ module SimplerWorkflow
|
|
52
52
|
logger.info("Performing task #{name}")
|
53
53
|
@perform_task.call(task)
|
54
54
|
rescue => e
|
55
|
-
|
56
|
-
|
57
|
-
context[:input] = task.input
|
58
|
-
context[:activity_id] = task.activity_id
|
59
|
-
SimplerWorkflow.exception_reporter.report(e, context)
|
55
|
+
logger.error e.message
|
56
|
+
logger.error e.backtrace.join("\n")
|
60
57
|
task.fail! :reason => e.message[0..250], :details => {:failure_policy => failure_policy}.to_json
|
61
58
|
end
|
62
59
|
|
@@ -65,33 +62,50 @@ module SimplerWorkflow
|
|
65
62
|
end
|
66
63
|
|
67
64
|
def start_activity_loop
|
68
|
-
|
65
|
+
SimplerWorkflow.child_processes << fork do
|
66
|
+
|
67
|
+
$0 = "Activity: #{name} #{version}"
|
68
|
+
|
69
|
+
Signal.trap('QUIT') do
|
70
|
+
logger.info("Received SIGQUIT")
|
71
|
+
@time_to_exit = true
|
72
|
+
end
|
73
|
+
|
74
|
+
Signal.trap('INT') do
|
75
|
+
logger.info("Received SIGINT")
|
76
|
+
Process.exit!(0)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
if SimplerWorkflow.after_fork
|
81
|
+
SimplerWorkflow.after_fork.call
|
82
|
+
end
|
83
|
+
|
69
84
|
loop do
|
70
85
|
begin
|
71
86
|
logger.info("Starting activity_loop for #{name}")
|
72
|
-
domain.activity_tasks.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
task.complete!
|
82
|
-
end
|
87
|
+
domain.activity_tasks.poll_for_single_task(name.to_s) do |task|
|
88
|
+
logger.info("Received task...")
|
89
|
+
perform_task(task)
|
90
|
+
unless task.responded?
|
91
|
+
if next_activity
|
92
|
+
result = {:next_activity => next_activity}.to_json
|
93
|
+
task.complete!(:result => result)
|
94
|
+
else
|
95
|
+
task.complete!
|
83
96
|
end
|
84
|
-
rescue => e
|
85
|
-
context = {}
|
86
|
-
context[:activity_type] = [name.to_s, version]
|
87
|
-
context[:input] = task.input
|
88
|
-
context[:activity_id] = task.activity_id
|
89
|
-
SimplerWorkflow.exception_reporter.report(e, context)
|
90
|
-
task.fail! :reason => e.message, :details => { :failure_policy => :abort }.to_json unless task.responded?
|
91
97
|
end
|
92
98
|
end
|
93
|
-
|
94
|
-
|
99
|
+
Process.exit(0) if @time_to_exit
|
100
|
+
rescue Timeout::Error
|
101
|
+
if @time_to_exit
|
102
|
+
Process.exit(0)
|
103
|
+
else
|
104
|
+
retry
|
105
|
+
end
|
106
|
+
rescue => e
|
107
|
+
logger.error(e.message)
|
108
|
+
logger.error(e.backtrace.join("\n"))
|
95
109
|
end
|
96
110
|
end
|
97
111
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# require 'simpler_workflow/tasks'
|
2
|
+
# will give you the simpler_workflow tasks.
|
3
|
+
# Much inspiration was derived from https://github.com/defunkt/resque
|
4
|
+
|
5
|
+
namespace :simpler_workflow do
|
6
|
+
task :setup
|
7
|
+
|
8
|
+
desc "Runs the workflows."
|
9
|
+
task :work => [:preload, :setup] do
|
10
|
+
require 'simpler_workflow'
|
11
|
+
|
12
|
+
Signal.trap('QUIT') do
|
13
|
+
SimplerWorkflow.child_processes.each do |child|
|
14
|
+
Process.kill('QUIT', child)
|
15
|
+
end
|
16
|
+
exit(0)
|
17
|
+
end
|
18
|
+
|
19
|
+
Signal.trap('INT') do
|
20
|
+
SimplerWorkflow.child_processes.each do |child|
|
21
|
+
Process.kill('INT', child)
|
22
|
+
end
|
23
|
+
exit(0)
|
24
|
+
end
|
25
|
+
|
26
|
+
pattern = ENV['WORKFLOW'] || 'lib/workflow/*.rb'
|
27
|
+
|
28
|
+
FileList.new(pattern).each do |f|
|
29
|
+
load f
|
30
|
+
end
|
31
|
+
|
32
|
+
Process.waitall
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Preloads the Rails environment if this is running under Rails."
|
36
|
+
task :preload => :setup do
|
37
|
+
if defined?(Rails) && Rails.respond_to?(:application)
|
38
|
+
# Rails 3
|
39
|
+
Rails.application.eager_load!
|
40
|
+
elsif defined?(Rails::Initializer)
|
41
|
+
# Rails 2.3
|
42
|
+
$rails_rake_task = false
|
43
|
+
Rails::Initializer.run :load_application_classes
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
@@ -29,37 +29,56 @@ module SimplerWorkflow
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def decision_loop
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
32
|
+
SimplerWorkflow.child_processes << fork do
|
33
|
+
|
34
|
+
$0 = "Workflow: #{name} #{version}"
|
35
|
+
|
36
|
+
Signal.trap('QUIT') do
|
37
|
+
logger.info("Received SIGQUIT")
|
38
|
+
@time_to_exit = true
|
39
|
+
end
|
40
|
+
|
41
|
+
Signal.trap('INT') do
|
42
|
+
logger.info("Received SIGINT")
|
43
|
+
Process.exit!(0)
|
44
|
+
end
|
45
|
+
|
46
|
+
if SimplerWorkflow.after_fork
|
47
|
+
SimplerWorkflow.after_fork.call
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
loop do
|
52
|
+
begin
|
53
|
+
logger.info("Waiting for a decision task for #{name.to_s}, #{version} listening to #{task_list}")
|
54
|
+
domain.decision_tasks.poll_for_single_task(task_list) do |decision_task|
|
55
|
+
decision_task.extend AWS::SimpleWorkflow::DecisionTaskAdditions
|
56
|
+
logger.info("Received decision task")
|
57
|
+
decision_task.new_events.each do |event|
|
58
|
+
logger.info("Processing #{event.event_type}")
|
59
|
+
case event.event_type
|
60
|
+
when 'WorkflowExecutionStarted'
|
61
|
+
start_execution(decision_task, event)
|
62
|
+
when 'ActivityTaskCompleted'
|
63
|
+
activity_completed(decision_task, event)
|
64
|
+
when 'ActivityTaskFailed'
|
65
|
+
activity_failed(decision_task, event)
|
66
|
+
when 'ActivityTaskTimedOut'
|
67
|
+
activity_timed_out(decision_task, event)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
Process.exit 0 if @time_to_exit
|
72
|
+
rescue Timeout::Error => e
|
73
|
+
if @time_to_exit
|
74
|
+
Process.exit 0
|
75
|
+
else
|
76
|
+
retry
|
49
77
|
end
|
50
78
|
end
|
51
|
-
|
52
|
-
context = {
|
53
|
-
:workflow_execution => decision_task.workflow_execution,
|
54
|
-
:workflow => to_workflow_type,
|
55
|
-
:decision_task => decision_task
|
56
|
-
}
|
57
|
-
SimplerWorkflow.exception_reporter.report(e, context)
|
58
|
-
raise e
|
79
|
+
nil
|
59
80
|
end
|
60
81
|
end
|
61
|
-
rescue Timeout::Error => e
|
62
|
-
retry
|
63
82
|
end
|
64
83
|
|
65
84
|
def task_list
|
@@ -126,10 +145,6 @@ module SimplerWorkflow
|
|
126
145
|
end
|
127
146
|
end
|
128
147
|
|
129
|
-
def to_workflow_type
|
130
|
-
{ :name => name, :version => version }
|
131
|
-
end
|
132
|
-
|
133
148
|
def start_workflow(input, options = {})
|
134
149
|
options[:input] = input
|
135
150
|
domain.workflow_types[name.to_s, version].start_execution(options)
|
data/lib/simpler_workflow.rb
CHANGED
@@ -2,32 +2,40 @@ require 'aws-sdk'
|
|
2
2
|
require 'aws/simple_workflow/decision_task_additions'
|
3
3
|
require 'map'
|
4
4
|
|
5
|
+
require 'simpler_workflow/tasks' if defined?(Rake)
|
6
|
+
|
5
7
|
module SimplerWorkflow
|
6
8
|
extend self
|
7
9
|
|
10
|
+
# Provides a handle to a domain.
|
8
11
|
def domain(domain_name)
|
9
12
|
@domains ||= {}
|
10
13
|
@domains[domain_name.to_sym] ||= Domain.new(domain_name)
|
11
14
|
end
|
12
15
|
|
16
|
+
# Provides a handle to the SimpleWorkflow underlying service.
|
13
17
|
def swf
|
14
18
|
@swf ||= ::AWS::SimpleWorkflow.new
|
15
19
|
end
|
16
20
|
|
21
|
+
# The logger used. Falls back to the Rails logger.
|
17
22
|
def logger
|
18
23
|
$logger || Rails.logger
|
19
24
|
end
|
20
25
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
# Sets the code to be called after a process fork when a block is provided.
|
27
|
+
# Returns the previously set block (or nil) otherwise.
|
28
|
+
#
|
29
|
+
# @param block The block that will be called after a process is forked.
|
30
|
+
# @return Proc the block that was passed earlier (or nil)
|
31
|
+
def after_fork(&block)
|
32
|
+
block ? (@after_fork = block) : @after_fork
|
27
33
|
end
|
34
|
+
attr_writer :after_fork
|
28
35
|
|
29
|
-
|
30
|
-
|
36
|
+
# The list of child processes that have been forked from the main process.
|
37
|
+
def child_processes
|
38
|
+
@child_processes ||= []
|
31
39
|
end
|
32
40
|
|
33
41
|
autoload :Version, 'simpler_workflow/version'
|
@@ -35,7 +43,6 @@ module SimplerWorkflow
|
|
35
43
|
autoload :Workflow, 'simpler_workflow/workflow'
|
36
44
|
autoload :Activity, 'simpler_workflow/activity'
|
37
45
|
autoload :OptionsAsMethods, 'simpler_workflow/options_as_methods'
|
38
|
-
autoload :DefaultExceptionReporter, 'simpler_workflow/default_exception_reporter'
|
39
46
|
end
|
40
47
|
|
41
48
|
class Map
|
data/simpler_workflow.gemspec
CHANGED
@@ -6,7 +6,19 @@ Gem::Specification.new do |gem|
|
|
6
6
|
gem.email = ["fred@snugghome.com"]
|
7
7
|
gem.description = %q{A wrapper around Amazon's Simple Workflow Service}
|
8
8
|
gem.summary = %q{A wrapper and DSL around Amazon's Simple Workflow Service with the goal of making it almost pleasant to define workflows.}
|
9
|
-
gem.homepage = "https://github.com/
|
9
|
+
gem.homepage = "https://github.com/fredjean/simpler_workflow"
|
10
|
+
gem.post_install_message =<<EOM
|
11
|
+
simpler_workflow #{SimplerWorkflow::VERSION}
|
12
|
+
========================
|
13
|
+
|
14
|
+
Have a look at https://github.com/fredjean/simpler_workflow/wiki/MIgrating-to-0.2.0 if you
|
15
|
+
are upgrading from a 0.1.x version of the gem. There is a fundamental change in how the
|
16
|
+
activity and decision loops are run. You may need to adjust your application for this to work.
|
17
|
+
|
18
|
+
Thank you for installing simpler_workflow. I hope you find it useful.
|
19
|
+
|
20
|
+
-- Fred
|
21
|
+
EOM
|
10
22
|
|
11
23
|
gem.files = `git ls-files`.split($\)
|
12
24
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
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.
|
4
|
+
version: 0.2.0
|
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-
|
12
|
+
date: 2012-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|
@@ -102,6 +102,7 @@ files:
|
|
102
102
|
- .gitignore
|
103
103
|
- .rspec
|
104
104
|
- .travis.yml
|
105
|
+
- CHANGELOG.md
|
105
106
|
- Gemfile
|
106
107
|
- LICENSE
|
107
108
|
- README.md
|
@@ -111,19 +112,25 @@ files:
|
|
111
112
|
- lib/aws/simple_workflow/decision_task_additions.rb
|
112
113
|
- lib/simpler_workflow.rb
|
113
114
|
- lib/simpler_workflow/activity.rb
|
114
|
-
- lib/simpler_workflow/default_exception_reporter.rb
|
115
115
|
- lib/simpler_workflow/domain.rb
|
116
116
|
- lib/simpler_workflow/options_as_methods.rb
|
117
|
+
- lib/simpler_workflow/tasks.rb
|
117
118
|
- lib/simpler_workflow/version.rb
|
118
119
|
- lib/simpler_workflow/workflow.rb
|
119
120
|
- lib/simpler_workflow/workflow_collection.rb
|
121
|
+
- lib/tasks/simpler_workflow.rake
|
120
122
|
- simpler_workflow.gemspec
|
121
123
|
- spec/domain_spec.rb
|
122
124
|
- spec/simpler_workflow_spec.rb
|
123
125
|
- spec/spec_helper.rb
|
124
|
-
homepage: https://github.com/
|
126
|
+
homepage: https://github.com/fredjean/simpler_workflow
|
125
127
|
licenses: []
|
126
|
-
post_install_message:
|
128
|
+
post_install_message: ! "simpler_workflow 0.2.0\n========================\n\nHave
|
129
|
+
a look at https://github.com/fredjean/simpler_workflow/wiki/MIgrating-to-0.2.0 if
|
130
|
+
you\nare upgrading from a 0.1.x version of the gem. There is a fundamental change
|
131
|
+
in how the \nactivity and decision loops are run. You may need to adjust your application
|
132
|
+
for this to work.\n\nThank you for installing simpler_workflow. I hope you find
|
133
|
+
it useful.\n\n-- Fred\n"
|
127
134
|
rdoc_options: []
|
128
135
|
require_paths:
|
129
136
|
- lib
|
@@ -133,12 +140,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
140
|
- - ! '>='
|
134
141
|
- !ruby/object:Gem::Version
|
135
142
|
version: '0'
|
143
|
+
segments:
|
144
|
+
- 0
|
145
|
+
hash: -1625844284378708087
|
136
146
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
147
|
none: false
|
138
148
|
requirements:
|
139
149
|
- - ! '>='
|
140
150
|
- !ruby/object:Gem::Version
|
141
151
|
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
hash: -1625844284378708087
|
142
155
|
requirements: []
|
143
156
|
rubyforge_project:
|
144
157
|
rubygems_version: 1.8.23
|
@@ -1,26 +0,0 @@
|
|
1
|
-
# Default exception handler. Just logs to the logger and re-raise
|
2
|
-
# so the exception can be managed as usual.
|
3
|
-
|
4
|
-
module SimplerWorkflow
|
5
|
-
class DefaultExceptionReporter
|
6
|
-
attr_accessor :reporter, :tag
|
7
|
-
|
8
|
-
def initialize(&block)
|
9
|
-
@reporter = block if block_given?
|
10
|
-
end
|
11
|
-
|
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
|
20
|
-
end
|
21
|
-
|
22
|
-
def tag
|
23
|
-
@tag || "SimplerWorkflow"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|