ruote 2.1.9 → 2.1.10

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 (81) hide show
  1. data/CHANGELOG.txt +32 -0
  2. data/CREDITS.txt +3 -0
  3. data/Rakefile +4 -4
  4. data/TODO.txt +55 -11
  5. data/examples/barley.rb +2 -1
  6. data/examples/flickr_report.rb +5 -6
  7. data/examples/web_first_page.rb +11 -0
  8. data/lib/ruote/context.rb +36 -13
  9. data/lib/ruote/engine.rb +88 -56
  10. data/lib/ruote/engine/process_error.rb +13 -0
  11. data/lib/ruote/engine/process_status.rb +33 -1
  12. data/lib/ruote/error_handler.rb +122 -0
  13. data/lib/ruote/evt/tracker.rb +27 -10
  14. data/lib/ruote/exp/fe_apply.rb +69 -0
  15. data/lib/ruote/exp/fe_participant.rb +33 -5
  16. data/lib/ruote/exp/flowexpression.rb +37 -5
  17. data/lib/ruote/exp/ro_persist.rb +8 -4
  18. data/lib/ruote/exp/ro_variables.rb +2 -2
  19. data/lib/ruote/fei.rb +59 -7
  20. data/lib/ruote/log/storage_history.rb +2 -0
  21. data/lib/ruote/log/test_logger.rb +28 -19
  22. data/lib/ruote/log/wait_logger.rb +4 -2
  23. data/lib/ruote/parser.rb +2 -1
  24. data/lib/ruote/part/dispatch_pool.rb +10 -10
  25. data/lib/ruote/part/engine_participant.rb +2 -2
  26. data/lib/ruote/part/local_participant.rb +99 -7
  27. data/lib/ruote/part/participant_list.rb +18 -7
  28. data/lib/ruote/part/storage_participant.rb +9 -6
  29. data/lib/ruote/receiver/base.rb +109 -10
  30. data/lib/ruote/storage/base.rb +118 -41
  31. data/lib/ruote/storage/fs_storage.rb +1 -0
  32. data/lib/ruote/storage/hash_storage.rb +2 -1
  33. data/lib/ruote/util/lookup.rb +22 -2
  34. data/lib/ruote/util/misc.rb +5 -5
  35. data/lib/ruote/version.rb +1 -1
  36. data/lib/ruote/worker.rb +50 -63
  37. data/lib/ruote/workitem.rb +64 -0
  38. data/ruote.gemspec +17 -12
  39. data/test/functional/base.rb +3 -1
  40. data/test/functional/concurrent_base.rb +35 -29
  41. data/test/functional/crunner.sh +19 -0
  42. data/test/functional/ct_0_concurrence.rb +17 -30
  43. data/test/functional/ct_1_iterator.rb +20 -17
  44. data/test/functional/ct_2_cancel.rb +32 -25
  45. data/test/functional/eft_12_listen.rb +2 -1
  46. data/test/functional/eft_23_apply.rb +23 -0
  47. data/test/functional/eft_3_participant.rb +27 -0
  48. data/test/functional/ft_11_recursion.rb +1 -1
  49. data/test/functional/ft_13_variables.rb +22 -0
  50. data/test/functional/ft_14_re_apply.rb +3 -0
  51. data/test/functional/ft_15_timeout.rb +1 -0
  52. data/test/functional/ft_20_storage_participant.rb +20 -2
  53. data/test/functional/ft_21_forget.rb +30 -0
  54. data/test/functional/ft_22_process_definitions.rb +2 -1
  55. data/test/functional/ft_24_block_participants.rb +1 -1
  56. data/test/functional/ft_25_receiver.rb +83 -1
  57. data/test/functional/ft_26_participant_timeout.rb +1 -1
  58. data/test/functional/ft_2_errors.rb +2 -5
  59. data/test/functional/ft_30_smtp_participant.rb +47 -45
  60. data/test/functional/ft_36_storage_history.rb +4 -4
  61. data/test/functional/ft_37_engine_participant.rb +14 -10
  62. data/test/functional/ft_38_participant_more.rb +178 -0
  63. data/test/functional/ft_39_wait_for.rb +100 -0
  64. data/test/functional/ft_40_participant_on_reply.rb +87 -0
  65. data/test/functional/ft_41_participants.rb +65 -0
  66. data/test/functional/ft_42_storage_copy.rb +67 -0
  67. data/test/functional/ft_5_on_error.rb +103 -0
  68. data/test/functional/ft_9_subprocesses.rb +2 -1
  69. data/test/functional/storage_helper.rb +5 -1
  70. data/test/functional/test.rb +4 -1
  71. data/test/functional/vertical.rb +46 -0
  72. data/test/unit/storage.rb +17 -1
  73. data/test/unit/storages.rb +27 -7
  74. data/test/unit/ut_11_lookup.rb +36 -0
  75. data/test/unit/ut_16_parser.rb +43 -0
  76. data/test/unit/ut_1_fei.rb +28 -1
  77. data/test/unit/ut_7_workitem.rb +23 -0
  78. metadata +67 -105
  79. data/lib/ruote/log/fs_history.rb +0 -182
  80. data/test/functional/ft_32_fs_history.rb +0 -188
  81. data/test/mpc_test.rb +0 -29
metadata CHANGED
@@ -1,12 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruote
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 2
7
- - 1
8
- - 9
9
- version: 2.1.9
4
+ version: 2.1.10
10
5
  platform: ruby
11
6
  authors:
12
7
  - John Mettraux
@@ -16,175 +11,139 @@ autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
13
 
19
- date: 2010-03-23 00:00:00 +09:00
14
+ date: 2010-06-15 00:00:00 +09:00
20
15
  default_executable:
21
16
  dependencies:
22
17
  - !ruby/object:Gem::Dependency
23
18
  name: rufus-json
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
26
22
  requirements:
27
23
  - - ">="
28
24
  - !ruby/object:Gem::Version
29
- segments:
30
- - 0
31
- - 2
32
- - 0
33
- version: 0.2.0
34
- type: :runtime
35
- version_requirements: *id001
25
+ version: 0.2.2
26
+ version:
36
27
  - !ruby/object:Gem::Dependency
37
28
  name: rufus-cloche
38
- prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
29
+ type: :runtime
30
+ version_requirement:
31
+ version_requirements: !ruby/object:Gem::Requirement
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- segments:
44
- - 0
45
- - 1
46
- - 16
47
- version: 0.1.16
48
- type: :runtime
49
- version_requirements: *id002
35
+ version: 0.1.17
36
+ version:
50
37
  - !ruby/object:Gem::Dependency
51
38
  name: rufus-dollar
52
- prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
39
+ type: :runtime
40
+ version_requirement:
41
+ version_requirements: !ruby/object:Gem::Requirement
54
42
  requirements:
55
43
  - - ">="
56
44
  - !ruby/object:Gem::Version
57
- segments:
58
- - 0
59
45
  version: "0"
60
- type: :runtime
61
- version_requirements: *id003
46
+ version:
62
47
  - !ruby/object:Gem::Dependency
63
48
  name: rufus-lru
64
- prerelease: false
65
- requirement: &id004 !ruby/object:Gem::Requirement
49
+ type: :runtime
50
+ version_requirement:
51
+ version_requirements: !ruby/object:Gem::Requirement
66
52
  requirements:
67
53
  - - ">="
68
54
  - !ruby/object:Gem::Version
69
- segments:
70
- - 0
71
55
  version: "0"
72
- type: :runtime
73
- version_requirements: *id004
56
+ version:
74
57
  - !ruby/object:Gem::Dependency
75
58
  name: rufus-mnemo
76
- prerelease: false
77
- requirement: &id005 !ruby/object:Gem::Requirement
59
+ type: :runtime
60
+ version_requirement:
61
+ version_requirements: !ruby/object:Gem::Requirement
78
62
  requirements:
79
63
  - - ">="
80
64
  - !ruby/object:Gem::Version
81
- segments:
82
- - 1
83
- - 1
84
- - 0
85
65
  version: 1.1.0
86
- type: :runtime
87
- version_requirements: *id005
66
+ version:
88
67
  - !ruby/object:Gem::Dependency
89
68
  name: rufus-scheduler
90
- prerelease: false
91
- requirement: &id006 !ruby/object:Gem::Requirement
69
+ type: :runtime
70
+ version_requirement:
71
+ version_requirements: !ruby/object:Gem::Requirement
92
72
  requirements:
93
73
  - - ">="
94
74
  - !ruby/object:Gem::Version
95
- segments:
96
- - 2
97
- - 0
98
- - 5
99
75
  version: 2.0.5
100
- type: :runtime
101
- version_requirements: *id006
76
+ version:
102
77
  - !ruby/object:Gem::Dependency
103
78
  name: rufus-treechecker
104
- prerelease: false
105
- requirement: &id007 !ruby/object:Gem::Requirement
79
+ type: :runtime
80
+ version_requirement:
81
+ version_requirements: !ruby/object:Gem::Requirement
106
82
  requirements:
107
83
  - - ">="
108
84
  - !ruby/object:Gem::Version
109
- segments:
110
- - 1
111
- - 0
112
- - 3
113
85
  version: 1.0.3
114
- type: :runtime
115
- version_requirements: *id007
86
+ version:
116
87
  - !ruby/object:Gem::Dependency
117
88
  name: rake
118
- prerelease: false
119
- requirement: &id008 !ruby/object:Gem::Requirement
89
+ type: :development
90
+ version_requirement:
91
+ version_requirements: !ruby/object:Gem::Requirement
120
92
  requirements:
121
93
  - - ">="
122
94
  - !ruby/object:Gem::Version
123
- segments:
124
- - 0
125
95
  version: "0"
126
- type: :development
127
- version_requirements: *id008
96
+ version:
128
97
  - !ruby/object:Gem::Dependency
129
98
  name: yard
130
- prerelease: false
131
- requirement: &id009 !ruby/object:Gem::Requirement
99
+ type: :development
100
+ version_requirement:
101
+ version_requirements: !ruby/object:Gem::Requirement
132
102
  requirements:
133
103
  - - ">="
134
104
  - !ruby/object:Gem::Version
135
- segments:
136
- - 0
137
105
  version: "0"
138
- type: :development
139
- version_requirements: *id009
106
+ version:
140
107
  - !ruby/object:Gem::Dependency
141
108
  name: json
142
- prerelease: false
143
- requirement: &id010 !ruby/object:Gem::Requirement
109
+ type: :development
110
+ version_requirement:
111
+ version_requirements: !ruby/object:Gem::Requirement
144
112
  requirements:
145
113
  - - ">="
146
114
  - !ruby/object:Gem::Version
147
- segments:
148
- - 0
149
115
  version: "0"
150
- type: :development
151
- version_requirements: *id010
116
+ version:
152
117
  - !ruby/object:Gem::Dependency
153
118
  name: builder
154
- prerelease: false
155
- requirement: &id011 !ruby/object:Gem::Requirement
119
+ type: :development
120
+ version_requirement:
121
+ version_requirements: !ruby/object:Gem::Requirement
156
122
  requirements:
157
123
  - - ">="
158
124
  - !ruby/object:Gem::Version
159
- segments:
160
- - 0
161
125
  version: "0"
162
- type: :development
163
- version_requirements: *id011
126
+ version:
164
127
  - !ruby/object:Gem::Dependency
165
128
  name: mailtrap
166
- prerelease: false
167
- requirement: &id012 !ruby/object:Gem::Requirement
129
+ type: :development
130
+ version_requirement:
131
+ version_requirements: !ruby/object:Gem::Requirement
168
132
  requirements:
169
133
  - - ">="
170
134
  - !ruby/object:Gem::Version
171
- segments:
172
- - 0
173
135
  version: "0"
174
- type: :development
175
- version_requirements: *id012
136
+ version:
176
137
  - !ruby/object:Gem::Dependency
177
138
  name: jeweler
178
- prerelease: false
179
- requirement: &id013 !ruby/object:Gem::Requirement
139
+ type: :development
140
+ version_requirement:
141
+ version_requirements: !ruby/object:Gem::Requirement
180
142
  requirements:
181
143
  - - ">="
182
144
  - !ruby/object:Gem::Version
183
- segments:
184
- - 0
185
145
  version: "0"
186
- type: :development
187
- version_requirements: *id013
146
+ version:
188
147
  description: "\n\
189
148
  ruote is an open source ruby workflow engine.\n "
190
149
  email: jmettraux@gmail.com
@@ -212,6 +171,7 @@ files:
212
171
  - lib/ruote/engine.rb
213
172
  - lib/ruote/engine/process_error.rb
214
173
  - lib/ruote/engine/process_status.rb
174
+ - lib/ruote/error_handler.rb
215
175
  - lib/ruote/evt/tracker.rb
216
176
  - lib/ruote/exp/command.rb
217
177
  - lib/ruote/exp/commanded.rb
@@ -256,7 +216,6 @@ files:
256
216
  - lib/ruote/fei.rb
257
217
  - lib/ruote/id/mnemo_wfid_generator.rb
258
218
  - lib/ruote/id/wfid_generator.rb
259
- - lib/ruote/log/fs_history.rb
260
219
  - lib/ruote/log/storage_history.rb
261
220
  - lib/ruote/log/test_logger.rb
262
221
  - lib/ruote/log/wait_logger.rb
@@ -308,6 +267,7 @@ files:
308
267
  - test/functional/base.rb
309
268
  - test/functional/concurrent_base.rb
310
269
  - test/functional/crunner.rb
270
+ - test/functional/crunner.sh
311
271
  - test/functional/ct_0_concurrence.rb
312
272
  - test/functional/ct_1_iterator.rb
313
273
  - test/functional/ct_2_cancel.rb
@@ -366,13 +326,17 @@ files:
366
326
  - test/functional/ft_2_errors.rb
367
327
  - test/functional/ft_30_smtp_participant.rb
368
328
  - test/functional/ft_31_part_blocking.rb
369
- - test/functional/ft_32_fs_history.rb
370
329
  - test/functional/ft_33_participant_subprocess_priority.rb
371
330
  - test/functional/ft_34_cursor_rewind.rb
372
331
  - test/functional/ft_35_add_service.rb
373
332
  - test/functional/ft_36_storage_history.rb
374
333
  - test/functional/ft_37_engine_participant.rb
334
+ - test/functional/ft_38_participant_more.rb
335
+ - test/functional/ft_39_wait_for.rb
375
336
  - test/functional/ft_3_participant_registration.rb
337
+ - test/functional/ft_40_participant_on_reply.rb
338
+ - test/functional/ft_41_participants.rb
339
+ - test/functional/ft_42_storage_copy.rb
376
340
  - test/functional/ft_4_cancel.rb
377
341
  - test/functional/ft_5_on_error.rb
378
342
  - test/functional/ft_6_on_cancel.rb
@@ -389,7 +353,7 @@ files:
389
353
  - test/functional/rtest.rb
390
354
  - test/functional/storage_helper.rb
391
355
  - test/functional/test.rb
392
- - test/mpc_test.rb
356
+ - test/functional/vertical.rb
393
357
  - test/path_helper.rb
394
358
  - test/pdef.xml
395
359
  - test/test.rb
@@ -428,20 +392,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
428
392
  requirements:
429
393
  - - ">="
430
394
  - !ruby/object:Gem::Version
431
- segments:
432
- - 0
433
395
  version: "0"
396
+ version:
434
397
  required_rubygems_version: !ruby/object:Gem::Requirement
435
398
  requirements:
436
399
  - - ">="
437
400
  - !ruby/object:Gem::Version
438
- segments:
439
- - 0
440
401
  version: "0"
402
+ version:
441
403
  requirements: []
442
404
 
443
405
  rubyforge_project: ruote
444
- rubygems_version: 1.3.6
406
+ rubygems_version: 1.3.5
445
407
  signing_key:
446
408
  specification_version: 3
447
409
  summary: an open source ruby workflow engine
@@ -1,182 +0,0 @@
1
- #--
2
- # Copyright (c) 2005-2010, John Mettraux, jmettraux@gmail.com
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining a copy
5
- # of this software and associated documentation files (the "Software"), to deal
6
- # in the Software without restriction, including without limitation the rights
7
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- # copies of the Software, and to permit persons to whom the Software is
9
- # furnished to do so, subject to the following conditions:
10
- #
11
- # The above copyright notice and this permission notice shall be included in
12
- # all copies or substantial portions of the Software.
13
- #
14
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- # THE SOFTWARE.
21
- #
22
- # Made in Japan.
23
- #++
24
-
25
- require 'fileutils'
26
- require 'rufus/json'
27
-
28
-
29
- module Ruote
30
-
31
- #
32
- # Logs the ruote engine history to files.
33
- #
34
- # REMEMBER : this FsHistory only logs 1 worker. StorageHistory is better
35
- # to let all the workers output history in the shared storage.
36
- #
37
- class FsHistory
38
-
39
- def initialize (context, options={})
40
-
41
- @context = context
42
- @options = options
43
-
44
- @path =
45
- @options['history_path'] ||
46
- @context['history_path'] ||
47
- File.join('work', 'log')
48
-
49
- FileUtils.mkdir_p(@path)
50
-
51
- @last = nil
52
- @file = nil
53
-
54
- if @context.worker
55
-
56
- # only care about logging if there is a worker present
57
-
58
- @context.worker.subscribe(:all, self)
59
- rotate_if_necessary
60
- end
61
- end
62
-
63
- # Makes sure to close the history file.
64
- #
65
- def shutdown
66
-
67
- @file.close rescue nil
68
- end
69
-
70
- # Returns the messages concerning the process given by its wfid,
71
- # or an empty array if there were no such process seen.
72
- #
73
- def by_process (wfid)
74
-
75
- files = Dir[File.join(@path, '*.json')].sort.reverse
76
-
77
- history = []
78
-
79
- files.each do |f|
80
-
81
- lines = File.readlines(f).reverse
82
-
83
- lines.each do |l|
84
-
85
- a = Rufus::Json.decode(l) rescue nil
86
-
87
- next unless a
88
-
89
- at, msg = a
90
-
91
- m_wfid = msg['wfid'] || (msg['fei']['wfid'] rescue nil)
92
-
93
- next if m_wfid != wfid
94
-
95
- history.unshift(a)
96
-
97
- return history if msg['action'] == 'launch'
98
- end
99
- end
100
-
101
- history # shouldn't occur, unless history [file] got lost
102
- end
103
-
104
- RANGE_REGEXP = /_([0-9]{4}-[0-9]{2}-[0-9]{2}).json$/
105
-
106
- # Returns an array [ most recent date, oldest date ] (Time instances).
107
- #
108
- def range
109
-
110
- files = Dir[File.join(@path, '*.json')].sort
111
-
112
- [ files.last, files.first ].inject([]) do |a, fn|
113
- if m = RANGE_REGEXP.match(fn)
114
- a << Time.parse(m[1])
115
- end
116
- a
117
- end
118
- end
119
-
120
- # Returns an array of messages for a given day or an empty array if nothing
121
- # happened at that date.
122
- #
123
- def by_date (date)
124
-
125
- date = Time.parse(date.to_s).strftime('%Y-%m-%d')
126
-
127
- lines = File.readlines(File.join(@path, "history_#{date}.json")) rescue []
128
-
129
- lines.inject([]) do |a, l|
130
- if r = (Rufus::Json.decode(l) rescue nil)
131
- a << r
132
- end
133
- a
134
- end
135
- end
136
-
137
- #def history_to_tree (wfid)
138
- # # (NOTE why not ?)
139
- #end
140
-
141
- # The history system doesn't implement purge! so that when purge! is called
142
- # on the engine, the history is not cleared.
143
- #
144
- # Call this *dangerous* clear! method to clean out any history file.
145
- #
146
- def clear!
147
-
148
- Dir[File.join(@path, "#{engine.engine_id}_*.txt")].each do |f|
149
- FileUtils.rm_f(f) rescue nil
150
- end
151
- end
152
-
153
- # This is the method called by the workqueue. Incoming engine events
154
- # are 'processed' here.
155
- #
156
- def notify (msg)
157
-
158
- rotate_if_necessary
159
-
160
- @file.puts(Rufus::Json.encode(
161
- [ "#{@last.strftime('%Y-%m-%d %T')}.#{"%06d" % @last.usec}", msg ]))
162
- @file.flush
163
- end
164
-
165
- protected
166
-
167
- def rotate_if_necessary
168
-
169
- prev = @last
170
- @last = Time.now.utc
171
-
172
- return if prev && prev.day == @last.day
173
-
174
- @file.close rescue nil
175
-
176
- fn = [ 'history', @last.strftime('%Y-%m-%d') ].join('_') + '.json'
177
-
178
- @file = File.open(File.join(@path, fn), 'a')
179
- end
180
- end
181
- end
182
-