ruote 2.3.0.1 → 2.3.0.2
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/CHANGELOG.txt +23 -0
- data/CREDITS.txt +4 -0
- data/LICENSE.txt +1 -1
- data/lib/ruote.rb +2 -0
- data/lib/ruote/context.rb +2 -1
- data/lib/ruote/dashboard.rb +169 -13
- data/lib/ruote/dboard/mutation.rb +282 -0
- data/lib/ruote/dboard/process_error.rb +1 -1
- data/lib/ruote/dboard/process_status.rb +61 -48
- data/lib/ruote/engine.rb +1 -1
- data/lib/ruote/exp/command.rb +1 -1
- data/lib/ruote/exp/commanded.rb +1 -1
- data/lib/ruote/exp/condition.rb +2 -1
- data/lib/ruote/exp/fe_add_branches.rb +1 -1
- data/lib/ruote/exp/fe_apply.rb +1 -1
- data/lib/ruote/exp/fe_await.rb +97 -48
- data/lib/ruote/exp/fe_cancel_process.rb +1 -1
- data/lib/ruote/exp/fe_command.rb +2 -3
- data/lib/ruote/exp/fe_concurrence.rb +162 -66
- data/lib/ruote/exp/fe_concurrent_iterator.rb +25 -7
- data/lib/ruote/exp/fe_cron.rb +1 -1
- data/lib/ruote/exp/fe_cursor.rb +10 -11
- data/lib/ruote/exp/fe_define.rb +1 -1
- data/lib/ruote/exp/fe_echo.rb +1 -1
- data/lib/ruote/exp/fe_equals.rb +1 -1
- data/lib/ruote/exp/fe_error.rb +1 -1
- data/lib/ruote/exp/fe_filter.rb +1 -1
- data/lib/ruote/exp/fe_forget.rb +1 -1
- data/lib/ruote/exp/fe_given.rb +1 -1
- data/lib/ruote/exp/fe_if.rb +87 -7
- data/lib/ruote/exp/fe_inc.rb +1 -1
- data/lib/ruote/exp/fe_iterator.rb +1 -1
- data/lib/ruote/exp/fe_listen.rb +1 -1
- data/lib/ruote/exp/fe_lose.rb +1 -1
- data/lib/ruote/exp/fe_noop.rb +1 -1
- data/lib/ruote/exp/fe_on_error.rb +1 -1
- data/lib/ruote/exp/fe_once.rb +1 -1
- data/lib/ruote/exp/fe_participant.rb +49 -16
- data/lib/ruote/exp/fe_read.rb +1 -1
- data/lib/ruote/exp/fe_redo.rb +1 -1
- data/lib/ruote/exp/fe_ref.rb +1 -1
- data/lib/ruote/exp/fe_registerp.rb +1 -1
- data/lib/ruote/exp/fe_reserve.rb +1 -1
- data/lib/ruote/exp/fe_restore.rb +1 -7
- data/lib/ruote/exp/fe_save.rb +1 -1
- data/lib/ruote/exp/fe_sequence.rb +1 -1
- data/lib/ruote/exp/fe_set.rb +1 -1
- data/lib/ruote/exp/fe_stall.rb +1 -1
- data/lib/ruote/exp/fe_subprocess.rb +1 -1
- data/lib/ruote/exp/fe_that.rb +1 -1
- data/lib/ruote/exp/fe_undo.rb +1 -1
- data/lib/ruote/exp/fe_unregisterp.rb +1 -1
- data/lib/ruote/exp/fe_wait.rb +1 -1
- data/lib/ruote/exp/flow_expression.rb +117 -8
- data/lib/ruote/exp/iterator.rb +1 -1
- data/lib/ruote/exp/ro_attributes.rb +1 -1
- data/lib/ruote/exp/ro_filters.rb +1 -1
- data/lib/ruote/exp/ro_on_x.rb +4 -2
- data/lib/ruote/exp/ro_persist.rb +1 -1
- data/lib/ruote/exp/ro_timers.rb +1 -1
- data/lib/ruote/exp/ro_variables.rb +1 -1
- data/lib/ruote/extract.rb +125 -0
- data/lib/ruote/fei.rb +10 -73
- data/lib/ruote/id/mnemo_wfid_generator.rb +1 -1
- data/lib/ruote/id/wfid_generator.rb +1 -1
- data/lib/ruote/log/default_history.rb +17 -3
- data/lib/ruote/log/fancy_printing.rb +12 -32
- data/lib/ruote/log/storage_history.rb +1 -1
- data/lib/ruote/log/wait_logger.rb +15 -7
- data/lib/ruote/merge.rb +123 -0
- data/lib/ruote/observer.rb +1 -1
- data/lib/ruote/part/block_participant.rb +1 -1
- data/lib/ruote/part/code_participant.rb +1 -1
- data/lib/ruote/part/engine_participant.rb +1 -1
- data/lib/ruote/part/local_participant.rb +9 -1
- data/lib/ruote/part/no_op_participant.rb +1 -1
- data/lib/ruote/part/null_participant.rb +1 -1
- data/lib/ruote/part/participant.rb +1 -1
- data/lib/ruote/part/rev_participant.rb +1 -1
- data/lib/ruote/part/smtp_participant.rb +1 -1
- data/lib/ruote/part/storage_participant.rb +18 -1
- data/lib/ruote/part/template.rb +1 -1
- data/lib/ruote/reader.rb +1 -1
- data/lib/ruote/reader/json.rb +1 -1
- data/lib/ruote/reader/radial.rb +4 -4
- data/lib/ruote/reader/ruby_dsl.rb +1 -1
- data/lib/ruote/reader/xml.rb +1 -1
- data/lib/ruote/receiver/base.rb +13 -1
- data/lib/ruote/storage/base.rb +8 -14
- data/lib/ruote/storage/composite_storage.rb +1 -1
- data/lib/ruote/storage/fs_storage.rb +1 -1
- data/lib/ruote/storage/hash_storage.rb +2 -1
- data/lib/ruote/svc/dispatch_pool.rb +29 -18
- data/lib/ruote/svc/dollar_sub.rb +5 -8
- data/lib/ruote/svc/error_handler.rb +1 -1
- data/lib/ruote/svc/expression_map.rb +1 -1
- data/lib/ruote/svc/participant_list.rb +8 -5
- data/lib/ruote/svc/tracker.rb +154 -56
- data/lib/ruote/svc/treechecker.rb +1 -1
- data/lib/ruote/tree_dot.rb +1 -1
- data/lib/ruote/util/deep.rb +4 -2
- data/lib/ruote/util/filter.rb +1 -1
- data/lib/ruote/util/hashdot.rb +1 -1
- data/lib/ruote/util/look.rb +1 -1
- data/lib/ruote/util/lookup.rb +1 -1
- data/lib/ruote/util/misc.rb +51 -1
- data/lib/ruote/util/mpatch.rb +1 -1
- data/lib/ruote/util/ometa.rb +1 -1
- data/lib/ruote/util/subprocess.rb +1 -1
- data/lib/ruote/util/time.rb +3 -3
- data/lib/ruote/util/tree.rb +43 -4
- data/lib/ruote/version.rb +2 -2
- data/lib/ruote/worker.rb +30 -18
- data/lib/ruote/workitem.rb +1 -1
- data/ruote.gemspec +6 -2
- data/test/functional/base.rb +0 -1
- data/test/functional/concurrent_base.rb +1 -1
- data/test/functional/eft_14_cursor.rb +42 -52
- data/test/functional/eft_16_if.rb +24 -16
- data/test/functional/eft_18_concurrent_iterator.rb +31 -1
- data/test/functional/eft_6_concurrence.rb +149 -34
- data/test/functional/ft_10_dollar.rb +14 -30
- data/test/functional/ft_12_launchitem.rb +15 -0
- data/test/functional/ft_1_process_status.rb +62 -13
- data/test/functional/ft_20_storage_participant.rb +25 -0
- data/test/functional/ft_38_participant_more.rb +1 -1
- data/test/functional/ft_42_storage_copy.rb +1 -3
- data/test/functional/ft_43_participant_on_reply.rb +63 -5
- data/test/functional/ft_66_flank.rb +41 -0
- data/test/functional/ft_6_on_cancel.rb +9 -18
- data/test/functional/ft_71_retries.rb +25 -12
- data/test/functional/ft_79_attach.rb +138 -0
- data/test/functional/ft_7_tags.rb +27 -0
- data/test/functional/ft_80_pause_on_apply.rb +64 -0
- data/test/functional/ft_81_mutation.rb +417 -0
- data/test/functional/ft_82_await_attribute.rb +84 -0
- data/test/functional/ft_83_trackers.rb +79 -0
- data/test/functional/storage.rb +3 -4
- data/test/unit/ut_12_wait_logger.rb +41 -3
- data/test/unit/ut_15_util.rb +30 -0
- data/test/unit/ut_17_merge.rb +54 -53
- data/test/unit/ut_1_fei.rb +2 -2
- data/test/unit/ut_24_radial_reader.rb +7 -0
- data/test/unit/ut_26_deep.rb +14 -0
- data/test/unit/ut_5_tree.rb +38 -28
- metadata +206 -169
- data/couch_url.txt +0 -1
- data/lib/ruote/exp/merge.rb +0 -134
@@ -5,6 +5,7 @@
|
|
5
5
|
# Tue Jun 23 10:55:16 JST 2009
|
6
6
|
#
|
7
7
|
|
8
|
+
#require 'rufus-json/automatic'
|
8
9
|
require File.expand_path('../base', __FILE__)
|
9
10
|
|
10
11
|
|
@@ -37,5 +38,19 @@ class FtLaunchitemTest < Test::Unit::TestCase
|
|
37
38
|
{"a"=>0, "b"=>1, "params"=>{"ref"=>"alpha"}},
|
38
39
|
@dashboard.context.stash[:fields])
|
39
40
|
end
|
41
|
+
|
42
|
+
# Warning: this test requires rufus-json to have a backend ready.
|
43
|
+
#
|
44
|
+
def test_launch_and_variables_with_symbol_keys
|
45
|
+
|
46
|
+
pdef = Ruote.define do
|
47
|
+
echo '${f} / ${v:v}'
|
48
|
+
end
|
49
|
+
|
50
|
+
wfid = @dashboard.launch(pdef, { :f => 'x' }, { :v => 'y' })
|
51
|
+
wait_for(wfid)
|
52
|
+
|
53
|
+
assert_equal 'x / y', @tracer.to_s
|
54
|
+
end
|
40
55
|
end
|
41
56
|
|
@@ -82,7 +82,7 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
82
82
|
assert_equal 1, @dashboard.errors(:count => true)
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
85
|
+
def test_current_tree
|
86
86
|
|
87
87
|
pdef = Ruote.process_definition 'my process' do
|
88
88
|
sequence do
|
@@ -91,10 +91,10 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
91
91
|
end
|
92
92
|
end
|
93
93
|
|
94
|
-
alpha = @dashboard.
|
94
|
+
alpha = @dashboard.register :alpha, Ruote::NullParticipant
|
95
95
|
wfid = @dashboard.launch(pdef)
|
96
96
|
|
97
|
-
wait_for(
|
97
|
+
wait_for('dispatched')
|
98
98
|
|
99
99
|
ps = @dashboard.process(wfid)
|
100
100
|
|
@@ -119,19 +119,55 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
119
119
|
|
120
120
|
e.update_tree([ 'participant', { 'ref' => 'bravo' }, [] ])
|
121
121
|
|
122
|
+
assert_equal(
|
123
|
+
["define", {"my process"=>nil}, [
|
124
|
+
["sequence", {}, [
|
125
|
+
["echo", {"ok"=>nil}, []],
|
126
|
+
["participant", {"ref"=>"alpha"}, []]]]]],
|
127
|
+
ps.original_tree)
|
128
|
+
|
122
129
|
assert_equal(
|
123
130
|
["define", {"my process"=>nil}, [
|
124
131
|
["sequence", {}, [
|
125
132
|
["echo", {"ok"=>nil}, []],
|
126
133
|
["participant", {"ref"=>"bravo"}, []]]]]],
|
127
134
|
ps.current_tree)
|
135
|
+
end
|
136
|
+
|
137
|
+
def test_current_tree_and_re_apply
|
138
|
+
|
139
|
+
pdef = Ruote.process_definition 'my process' do
|
140
|
+
sequence do
|
141
|
+
echo 'ok'
|
142
|
+
participant :ref => :alpha
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
alpha = @dashboard.register :alpha, Ruote::NullParticipant
|
147
|
+
wfid = @dashboard.launch(pdef)
|
148
|
+
|
149
|
+
wait_for('dispatched')
|
150
|
+
|
151
|
+
ps = @dashboard.process(wfid)
|
152
|
+
exp = ps.expressions.find { |fexp| fexp.fei.expid == '0_0_1' }
|
153
|
+
|
154
|
+
@dashboard.re_apply(
|
155
|
+
exp,
|
156
|
+
:tree =>
|
157
|
+
[ 'sequence', {}, [ [ 'alpha', {}, [] ], [ 'alpha', {}, [] ] ] ])
|
158
|
+
|
159
|
+
wait_for('dispatched')
|
160
|
+
|
161
|
+
ps = @dashboard.process(wfid)
|
128
162
|
|
129
163
|
assert_equal(
|
130
164
|
["define", {"my process"=>nil}, [
|
131
165
|
["sequence", {}, [
|
132
166
|
["echo", {"ok"=>nil}, []],
|
133
|
-
["
|
134
|
-
|
167
|
+
["sequence", {"_triggered"=>"on_re_apply"}, [
|
168
|
+
["participant", {"ref"=>"alpha"}, []],
|
169
|
+
["alpha", {}, []]]]]]]],
|
170
|
+
ps.current_tree)
|
135
171
|
end
|
136
172
|
|
137
173
|
def test_tree_when_define_rewrites_it
|
@@ -156,13 +192,15 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
156
192
|
|
157
193
|
assert_equal(
|
158
194
|
["define", {"my process"=>nil}, [
|
159
|
-
["define", {"sub0"=>nil}, [
|
195
|
+
["define", {"sub0"=>nil}, [
|
196
|
+
["echo", {"meh"=>nil}, []]]],
|
160
197
|
["participant", {"ref"=>"alpha"}, []]]],
|
161
198
|
ps.current_tree)
|
162
199
|
|
163
200
|
assert_equal(
|
164
201
|
["define", {"my process"=>nil}, [
|
165
|
-
["define", {"sub0"=>nil}, [
|
202
|
+
["define", {"sub0"=>nil}, [
|
203
|
+
["echo", {"meh"=>nil}, []]]],
|
166
204
|
["participant", {"ref"=>"alpha"}, []]]],
|
167
205
|
ps.original_tree)
|
168
206
|
end
|
@@ -351,11 +389,21 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
351
389
|
assert_trace %w[ a c c d ], pdef
|
352
390
|
|
353
391
|
assert_equal(
|
354
|
-
["define", {"name"=>"test"}, [
|
392
|
+
["define", {"name"=>"test"}, [
|
393
|
+
["sequence", {}, [
|
394
|
+
["alpha", {}, []],
|
395
|
+
["charly", {}, []],
|
396
|
+
["participant", {"ref"=>"charly"}, []]]],
|
397
|
+
["delta", {}, []]]],
|
355
398
|
@dashboard.context.stash[:tree0])
|
356
399
|
|
357
400
|
assert_equal(
|
358
|
-
["define", {"name"=>"test"}, [
|
401
|
+
["define", {"name"=>"test"}, [
|
402
|
+
["sequence", {}, [
|
403
|
+
["alpha", {}, []],
|
404
|
+
["charly", {}, []],
|
405
|
+
["charly", {}, []]]],
|
406
|
+
["participant", {"ref"=>"delta"}, []]]],
|
359
407
|
@dashboard.context.stash[:tree1])
|
360
408
|
end
|
361
409
|
|
@@ -370,7 +418,7 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
370
418
|
end
|
371
419
|
end
|
372
420
|
|
373
|
-
alpha = @dashboard.
|
421
|
+
alpha = @dashboard.register :alpha, Ruote::StorageParticipant
|
374
422
|
|
375
423
|
wfid = @dashboard.launch(pdef)
|
376
424
|
|
@@ -396,9 +444,10 @@ class FtProcessStatusTest < Test::Unit::TestCase
|
|
396
444
|
assert_equal(
|
397
445
|
["define", {"name"=>"test"}, [
|
398
446
|
["define", {"sub0"=>nil}, [
|
399
|
-
["
|
400
|
-
["
|
401
|
-
["
|
447
|
+
["alpha", {}, []]]],
|
448
|
+
["subprocess", {"_triggered"=>"on_cancel", "ref"=>"sub0"}, [
|
449
|
+
["define", {"sub0"=>nil}, [
|
450
|
+
["participant", {"ref"=>"alpha"}, []]]]]]]],
|
402
451
|
@dashboard.process(wfid).current_tree)
|
403
452
|
end
|
404
453
|
|
@@ -723,5 +723,30 @@ class FtStorageParticipantTest < Test::Unit::TestCase
|
|
723
723
|
|
724
724
|
assert_equal 0, @dashboard.storage_participant.size
|
725
725
|
end
|
726
|
+
|
727
|
+
class IuriParticipant < Ruote::StorageParticipant
|
728
|
+
def on_workitem
|
729
|
+
super
|
730
|
+
workitem.fields['count'] = 777
|
731
|
+
do_update
|
732
|
+
end
|
733
|
+
end
|
734
|
+
|
735
|
+
def test_do_update
|
736
|
+
|
737
|
+
@dashboard.register :alpha, IuriParticipant
|
738
|
+
|
739
|
+
wfid = @dashboard.launch(
|
740
|
+
Ruote.define do
|
741
|
+
alpha
|
742
|
+
end)
|
743
|
+
|
744
|
+
@dashboard.wait_for('dispatched')
|
745
|
+
sleep 0.350
|
746
|
+
|
747
|
+
wi = @dashboard.storage_participant.first
|
748
|
+
|
749
|
+
assert_equal(777, wi.fields['count'])
|
750
|
+
end
|
726
751
|
end
|
727
752
|
|
@@ -17,8 +17,6 @@ class FtStorageCopyTest < Test::Unit::TestCase
|
|
17
17
|
|
18
18
|
@dashboard.register_participant '.+', Ruote::StorageParticipant
|
19
19
|
|
20
|
-
#noisy
|
21
|
-
|
22
20
|
wfid = @dashboard.launch(Ruote.process_definition do
|
23
21
|
sequence do
|
24
22
|
alpha :timeout => '2d'
|
@@ -43,7 +41,7 @@ class FtStorageCopyTest < Test::Unit::TestCase
|
|
43
41
|
|
44
42
|
dash = Ruote::Dashboard.new(Ruote::Worker.new(Ruote::HashStorage.new()))
|
45
43
|
|
46
|
-
|
44
|
+
dash.noisy = ENV['NOISY'] == 'true'
|
47
45
|
|
48
46
|
dash.register_participant '.+', Ruote::StorageParticipant
|
49
47
|
|
@@ -128,11 +128,9 @@ class FtParticipantOnReplyTest < Test::Unit::TestCase
|
|
128
128
|
|
129
129
|
@dashboard.register :alpha, MyOtherAwkwardParticipant
|
130
130
|
|
131
|
-
pdef = Ruote.
|
132
|
-
|
133
|
-
|
134
|
-
echo 'over.'
|
135
|
-
end
|
131
|
+
pdef = Ruote.define do
|
132
|
+
alpha
|
133
|
+
echo 'over.'
|
136
134
|
end
|
137
135
|
|
138
136
|
wfid = @dashboard.launch(pdef)
|
@@ -157,5 +155,65 @@ class FtParticipantOnReplyTest < Test::Unit::TestCase
|
|
157
155
|
|
158
156
|
assert_equal 'over.', @tracer.to_s
|
159
157
|
end
|
158
|
+
|
159
|
+
class MyFailingParticipant < Ruote::Participant
|
160
|
+
def on_workitem
|
161
|
+
raise 'flunk!'
|
162
|
+
end
|
163
|
+
def on_error
|
164
|
+
@context.tracer <<
|
165
|
+
"on_error: #{error.class}: #{error.message}: #{msg['action']}\n"
|
166
|
+
workitem.fields['hello'] = 'world'
|
167
|
+
true # returning true to signify we're dealing with the error
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_participant_on_error
|
172
|
+
|
173
|
+
@dashboard.register :alpha, MyFailingParticipant
|
174
|
+
|
175
|
+
pdef = Ruote.define do
|
176
|
+
alpha
|
177
|
+
echo 'over.'
|
178
|
+
end
|
179
|
+
|
180
|
+
wfid = @dashboard.launch(pdef)
|
181
|
+
r = @dashboard.wait_for(wfid)
|
182
|
+
|
183
|
+
assert_equal 'terminated', r['action']
|
184
|
+
assert_equal 'world', r['workitem']['fields']['hello']
|
185
|
+
assert_equal "on_error: RuntimeError: flunk!: dispatch\nover.", @tracer.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
class MyVeryFailingParticipant < Ruote::Participant
|
189
|
+
def on_workitem
|
190
|
+
raise 'flunkito!'
|
191
|
+
end
|
192
|
+
def on_error
|
193
|
+
@context.tracer << "on_error...\n"
|
194
|
+
workitem.fields['hello'] = 'world'
|
195
|
+
false # returning false to signify we're NOT dealing with the error
|
196
|
+
end
|
197
|
+
end
|
198
|
+
|
199
|
+
def test_participant_on_error_return_false
|
200
|
+
|
201
|
+
@dashboard.register :alpha, MyVeryFailingParticipant
|
202
|
+
|
203
|
+
pdef = Ruote.define do
|
204
|
+
alpha
|
205
|
+
echo 'over.'
|
206
|
+
end
|
207
|
+
|
208
|
+
wfid = @dashboard.launch(pdef)
|
209
|
+
r = @dashboard.wait_for(wfid)
|
210
|
+
|
211
|
+
assert_equal 'error_intercepted', r['action']
|
212
|
+
assert_equal 'world', r['msg']['workitem']['fields']['hello']
|
213
|
+
assert_equal 'on_error...', @tracer.to_s
|
214
|
+
|
215
|
+
# Error has not been dealt with within the participant implementation,
|
216
|
+
# it went straight to the common error handler
|
217
|
+
end
|
160
218
|
end
|
161
219
|
|
@@ -129,5 +129,46 @@ class FtFlankTest < Test::Unit::TestCase
|
|
129
129
|
assert_equal 0, @dashboard.storage.get_many('expressions').size
|
130
130
|
assert_equal 0, @dashboard.storage.get_many('workitems').size
|
131
131
|
end
|
132
|
+
|
133
|
+
# for https://groups.google.com/forum/?fromgroups=#!topic/openwferu-users/dZ--leQgEns
|
134
|
+
#
|
135
|
+
def test_ceasing_flank
|
136
|
+
|
137
|
+
@dashboard.register { catchall }
|
138
|
+
|
139
|
+
pdef =
|
140
|
+
Ruote.define do
|
141
|
+
sequence :tag => 'x' do
|
142
|
+
alice :flank => true
|
143
|
+
bob
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
wfid = @dashboard.launch(pdef)
|
148
|
+
|
149
|
+
2.times { @dashboard.wait_for('dispatched') }
|
150
|
+
|
151
|
+
alice =
|
152
|
+
@dashboard.storage_participant.find { |wi|
|
153
|
+
wi.participant_name == 'alice'
|
154
|
+
}
|
155
|
+
|
156
|
+
@dashboard.storage_participant.proceed(alice)
|
157
|
+
@dashboard.wait_for('receive')
|
158
|
+
|
159
|
+
ps = @dashboard.ps(wfid)
|
160
|
+
|
161
|
+
assert_equal %w[ 0 0_0 0_0_1 ], ps.expressions.collect { |e| e.fei.expid }
|
162
|
+
assert_equal 0, ps.errors.size
|
163
|
+
|
164
|
+
bob = @dashboard.storage_participant.first
|
165
|
+
|
166
|
+
@dashboard.storage_participant.proceed(bob)
|
167
|
+
@dashboard.wait_for('terminated')
|
168
|
+
|
169
|
+
sleep 0.350
|
170
|
+
|
171
|
+
assert_equal nil, @dashboard.ps(wfid)
|
172
|
+
end
|
132
173
|
end
|
133
174
|
|
@@ -27,8 +27,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
27
27
|
tracer << "caught\n"
|
28
28
|
end
|
29
29
|
|
30
|
-
#noisy
|
31
|
-
|
32
30
|
wfid = @dashboard.launch(pdef)
|
33
31
|
wait_for(:nemo)
|
34
32
|
|
@@ -48,8 +46,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
48
46
|
|
49
47
|
nemo = @dashboard.register_participant :nemo, Ruote::StorageParticipant
|
50
48
|
|
51
|
-
#noisy
|
52
|
-
|
53
49
|
wfid = @dashboard.launch(pdef)
|
54
50
|
wait_for(:nemo)
|
55
51
|
|
@@ -80,8 +76,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
80
76
|
|
81
77
|
alpha = @dashboard.register_participant :alpha, Ruote::StorageParticipant
|
82
78
|
|
83
|
-
#noisy
|
84
|
-
|
85
79
|
wfid = @dashboard.launch(pdef)
|
86
80
|
|
87
81
|
wait_for(:alpha)
|
@@ -111,8 +105,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
111
105
|
@dashboard.register_participant :alpha, Ruote::StorageParticipant
|
112
106
|
sto = @dashboard.register_participant :bravo, Ruote::StorageParticipant
|
113
107
|
|
114
|
-
#noisy
|
115
|
-
|
116
108
|
wfid = @dashboard.launch(pdef)
|
117
109
|
|
118
110
|
wait_for(:alpha)
|
@@ -142,8 +134,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
142
134
|
@dashboard.register_participant :alpha, Ruote::StorageParticipant
|
143
135
|
@dashboard.register_participant :bravo, Ruote::StorageParticipant
|
144
136
|
|
145
|
-
#noisy
|
146
|
-
|
147
137
|
wfid = @dashboard.launch(pdef)
|
148
138
|
|
149
139
|
wait_for(:alpha)
|
@@ -154,13 +144,18 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
154
144
|
|
155
145
|
assert_equal(
|
156
146
|
["define", {"name"=>"test"}, [
|
157
|
-
["define", {"sub0"=>nil}, [
|
158
|
-
|
147
|
+
["define", {"sub0"=>nil}, [
|
148
|
+
["bravo", {}, []]]],
|
149
|
+
["sequence", {"on_cancel"=>"sub0"}, [
|
150
|
+
["alpha", {}, []]]]]],
|
159
151
|
@dashboard.process(wfid).original_tree)
|
160
152
|
assert_equal(
|
161
153
|
["define", {"name"=>"test"}, [
|
162
|
-
["define", {"sub0"=>nil}, [
|
163
|
-
|
154
|
+
["define", {"sub0"=>nil}, [
|
155
|
+
["bravo", {}, []]]],
|
156
|
+
["subprocess", {"_triggered"=>"on_cancel", "ref"=>"sub0"}, [
|
157
|
+
["define", {"sub0"=>nil}, [
|
158
|
+
["participant", {"ref"=>"bravo"}, []]]]]]]],
|
164
159
|
@dashboard.process(wfid).current_tree)
|
165
160
|
end
|
166
161
|
|
@@ -178,8 +173,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
178
173
|
|
179
174
|
@dashboard.register_participant :alpha, Ruote::StorageParticipant
|
180
175
|
|
181
|
-
#@dashboard.noisy = true
|
182
|
-
|
183
176
|
wfid = @dashboard.launch(pdef)
|
184
177
|
|
185
178
|
wait_for(:alpha)
|
@@ -205,8 +198,6 @@ class FtOnCancelTest < Test::Unit::TestCase
|
|
205
198
|
|
206
199
|
@dashboard.register :alpha, Ruote::StorageParticipant
|
207
200
|
|
208
|
-
#noisy
|
209
|
-
|
210
201
|
wfid = @dashboard.launch(pdef)
|
211
202
|
|
212
203
|
@dashboard.wait_for(:alpha)
|
@@ -11,13 +11,10 @@ require File.expand_path('../base', __FILE__)
|
|
11
11
|
class FtRetriesTest < Test::Unit::TestCase
|
12
12
|
include FunctionalBase
|
13
13
|
|
14
|
-
class BadParticipant
|
15
|
-
include Ruote::LocalParticipant
|
14
|
+
class BadParticipant < Ruote::Participant
|
16
15
|
def on_workitem
|
17
16
|
fail 'badly'
|
18
17
|
end
|
19
|
-
def on_cancel
|
20
|
-
end
|
21
18
|
end
|
22
19
|
|
23
20
|
#
|
@@ -31,8 +28,6 @@ class FtRetriesTest < Test::Unit::TestCase
|
|
31
28
|
alpha :on_error => '4s: retry'
|
32
29
|
end
|
33
30
|
|
34
|
-
#@dashboard.noisy = true
|
35
|
-
|
36
31
|
wfid = @dashboard.launch(pdef)
|
37
32
|
|
38
33
|
@dashboard.wait_for('fail')
|
@@ -60,8 +55,6 @@ class FtRetriesTest < Test::Unit::TestCase
|
|
60
55
|
alpha :on_error => '4x: retry'
|
61
56
|
end
|
62
57
|
|
63
|
-
#@dashboard.noisy = true
|
64
|
-
|
65
58
|
wfid = @dashboard.launch(pdef)
|
66
59
|
|
67
60
|
@dashboard.wait_for('error_intercepted')
|
@@ -83,8 +76,6 @@ class FtRetriesTest < Test::Unit::TestCase
|
|
83
76
|
echo 'over.'
|
84
77
|
end
|
85
78
|
|
86
|
-
#@dashboard.noisy = true
|
87
|
-
|
88
79
|
wfid = @dashboard.launch(pdef)
|
89
80
|
|
90
81
|
@dashboard.wait_for('terminated')
|
@@ -112,8 +103,6 @@ class FtRetriesTest < Test::Unit::TestCase
|
|
112
103
|
alpha :on_error => '1s: retry * 3'
|
113
104
|
end
|
114
105
|
|
115
|
-
#@dashboard.noisy = true
|
116
|
-
|
117
106
|
wfid = @dashboard.launch(pdef)
|
118
107
|
|
119
108
|
@dashboard.wait_for('fail')
|
@@ -139,6 +128,30 @@ class FtRetriesTest < Test::Unit::TestCase
|
|
139
128
|
assert_equal(
|
140
129
|
'#<RuntimeError: badly>',
|
141
130
|
@dashboard.ps(wfid).errors.first.message)
|
131
|
+
|
132
|
+
fails = @dashboard.logger.log.select { |m| m['action'] == 'fail' }
|
133
|
+
assert_equal 3, fails.size
|
134
|
+
end
|
135
|
+
|
136
|
+
#
|
137
|
+
# :on_error => 'retry * 2'
|
138
|
+
#
|
139
|
+
# retry twice, immediately
|
140
|
+
|
141
|
+
def test_retry_star_two
|
142
|
+
|
143
|
+
@dashboard.register_participant :alpha, BadParticipant
|
144
|
+
|
145
|
+
pdef = Ruote.process_definition do
|
146
|
+
alpha :on_error => 'retry * 2'
|
147
|
+
end
|
148
|
+
|
149
|
+
wfid = @dashboard.launch(pdef)
|
150
|
+
|
151
|
+
@dashboard.wait_for('error_intercepted')
|
152
|
+
|
153
|
+
fails = @dashboard.logger.log.select { |m| m['action'] == 'fail' }
|
154
|
+
assert_equal 2, fails.size
|
142
155
|
end
|
143
156
|
end
|
144
157
|
|