openwferu 0.9.15 → 0.9.16
Sign up to get free protection for your applications and to get access to all the features.
- data/README.txt +4 -2
- data/lib/openwfe/engine/engine.rb +143 -25
- data/lib/openwfe/engine/file_persisted_engine.rb +3 -3
- data/lib/openwfe/expool/errorjournal.rb +48 -25
- data/lib/openwfe/expool/expressionpool.rb +77 -106
- data/lib/openwfe/expool/expstorage.rb +6 -5
- data/lib/openwfe/expool/threadedexpstorage.rb +190 -0
- data/lib/openwfe/expool/yamlexpstorage.rb +5 -150
- data/lib/openwfe/expressions/condition.rb +6 -6
- data/lib/openwfe/expressions/environment.rb +7 -2
- data/lib/openwfe/expressions/expressionmap.rb +14 -0
- data/lib/openwfe/expressions/fe_command.rb +2 -1
- data/lib/openwfe/expressions/fe_concurrence.rb +40 -18
- data/lib/openwfe/expressions/fe_cron.rb +14 -11
- data/lib/openwfe/expressions/fe_cursor.rb +2 -3
- data/lib/openwfe/expressions/fe_define.rb +34 -31
- data/lib/openwfe/expressions/fe_equals.rb +11 -21
- data/lib/openwfe/expressions/fe_filter_definition.rb +0 -2
- data/lib/openwfe/expressions/fe_fqv.rb +1 -3
- data/lib/openwfe/expressions/fe_if.rb +37 -12
- data/lib/openwfe/expressions/fe_iterator.rb +1 -1
- data/lib/openwfe/expressions/fe_listen.rb +147 -28
- data/lib/openwfe/expressions/fe_losfor.rb +13 -1
- data/lib/openwfe/expressions/fe_misc.rb +70 -11
- data/lib/openwfe/expressions/fe_participant.rb +3 -3
- data/lib/openwfe/expressions/fe_reserve.rb +1 -1
- data/lib/openwfe/expressions/fe_save.rb +11 -12
- data/lib/openwfe/expressions/fe_sequence.rb +22 -29
- data/lib/openwfe/expressions/fe_sleep.rb +11 -7
- data/lib/openwfe/expressions/fe_subprocess.rb +24 -10
- data/lib/openwfe/expressions/fe_value.rb +35 -15
- data/lib/openwfe/expressions/fe_when.rb +2 -4
- data/lib/openwfe/expressions/flowexpression.rb +73 -37
- data/lib/openwfe/expressions/merge.rb +2 -4
- data/lib/openwfe/expressions/raw.rb +40 -31
- data/lib/openwfe/expressions/raw_prog.rb +18 -9
- data/lib/openwfe/expressions/raw_xml.rb +1 -8
- data/lib/openwfe/expressions/simplerep.rb +27 -5
- data/lib/openwfe/expressions/time.rb +45 -15
- data/lib/openwfe/expressions/timeout.rb +2 -1
- data/lib/openwfe/expressions/wtemplate.rb +2 -2
- data/lib/openwfe/flowexpressionid.rb +62 -16
- data/lib/openwfe/listeners/listener.rb +28 -37
- data/lib/openwfe/listeners/listeners.rb +1 -1
- data/lib/openwfe/listeners/socketlisteners.rb +7 -15
- data/lib/openwfe/logging.rb +5 -4
- data/lib/openwfe/{rest → orest}/controlclient.rb +3 -5
- data/lib/openwfe/{rest → orest}/definitions.rb +0 -2
- data/lib/openwfe/{rest → orest}/exception.rb +0 -0
- data/lib/openwfe/{rest → orest}/oldrestservlet.rb +1 -1
- data/lib/openwfe/{rest → orest}/osocket.rb +1 -1
- data/lib/openwfe/{rest → orest}/restclient.rb +0 -2
- data/lib/openwfe/orest/workitem.rb +206 -0
- data/lib/openwfe/{rest → orest}/worklistclient.rb +15 -5
- data/lib/openwfe/{rest → orest}/xmlcodec.rb +4 -1
- data/lib/openwfe/participants/enoparticipants.rb +4 -14
- data/lib/openwfe/participants/participantmap.rb +16 -12
- data/lib/openwfe/participants/participants.rb +46 -1
- data/lib/openwfe/participants/socketparticipants.rb +1 -6
- data/lib/openwfe/service.rb +15 -6
- data/lib/openwfe/storage/yamlcustom.rb +3 -0
- data/lib/openwfe/storage/yamlfilestorage.rb +3 -1
- data/lib/openwfe/util/dollar.rb +21 -14
- data/lib/openwfe/util/lru.rb +29 -10
- data/lib/openwfe/util/observable.rb +4 -1
- data/lib/openwfe/util/otime.rb +3 -0
- data/lib/openwfe/util/scheduler.rb +346 -114
- data/lib/openwfe/utils.rb +67 -13
- data/lib/openwfe/version.rb +1 -1
- data/lib/openwfe/workitem.rb +22 -165
- data/lib/openwfe/worklist/oldrest.rb +2 -2
- data/test/bm/bm_1_xml_vs_prog.rb +56 -0
- data/test/{ft_26_load.rb → bm/ft_26_load.rb} +0 -0
- data/test/{ft_26b_load.rb → bm/ft_26b_load.rb} +0 -0
- data/test/{ft_26c_load.rb → bm/ft_26c_load.rb} +16 -4
- data/test/clone_test.rb +62 -0
- data/test/cron_test.rb +56 -1
- data/test/cronline_test.rb +17 -8
- data/test/description_test.rb +57 -0
- data/test/dollar_test.rb +17 -6
- data/test/eno_test.rb +22 -9
- data/test/fe_lookup_att_test.rb +50 -0
- data/test/fei_test.rb +18 -9
- data/test/flowtestbase.rb +24 -2
- data/test/ft_0.rb +10 -12
- data/test/ft_0e_multibody.rb +34 -0
- data/test/ft_10_loop.rb +4 -6
- data/test/ft_11_ppd.rb +5 -20
- data/test/ft_14b_subprocess.rb +2 -2
- data/test/ft_15_iterator.rb +56 -4
- data/test/ft_15b_iterator.rb +48 -0
- data/test/ft_16_fqv.rb +18 -3
- data/test/ft_23c_wait.rb +7 -5
- data/test/ft_25_cancel.rb +5 -3
- data/test/ft_27_getflowpos.rb +14 -11
- data/test/ft_28_fileparticipant.rb +3 -4
- data/test/ft_2_concurrence.rb +8 -12
- data/test/ft_2b_concurrence.rb +3 -2
- data/test/ft_30_socketlistener.rb +5 -6
- data/test/ft_32c_journal.rb +2 -2
- data/test/ft_32d_journal.rb +5 -6
- data/test/ft_33_description.rb +8 -3
- data/test/ft_34_cancelwfid.rb +3 -3
- data/test/ft_38_tag.rb +7 -10
- data/test/ft_39_reserve.rb +4 -2
- data/test/ft_3_equals.rb +18 -13
- data/test/ft_44b_restore.rb +2 -6
- data/test/ft_49_condition.rb +16 -12
- data/test/ft_4_misc.rb +51 -12
- data/test/ft_50_xml_attribute.rb +1 -1
- data/test/ft_54_listen.rb +96 -10
- data/test/ft_54b_listen.rb +68 -0
- data/test/ft_55_ptimeout.rb +1 -2
- data/test/ft_58_ejournal.rb +8 -33
- data/test/ft_59_ps.rb +2 -3
- data/test/ft_59b_ps_for_pat.rb +59 -0
- data/test/ft_5_time.rb +45 -4
- data/test/ft_60_ecancel.rb +7 -7
- data/test/ft_61_elsub.rb +1 -1
- data/test/ft_64_alias.rb +1 -1
- data/test/ft_67_schedlaunch.rb +29 -16
- data/test/ft_69_cancelmissing.rb +1 -1
- data/test/ft_6_lambda.rb +8 -6
- data/test/ft_70_lookupvar.rb +2 -2
- data/test/ft_71_log.rb +60 -0
- data/test/ft_72_lookup_processes.rb +79 -0
- data/test/ft_73_cancel_sub.rb +144 -0
- data/test/ft_74_block_and_workitem_dup.rb +63 -0
- data/test/ft_75_ruby_attributes.rb +87 -0
- data/test/ft_76_merge_isolate.rb +90 -0
- data/test/ft_7_lose.rb +2 -1
- data/test/ft_tests.rb +9 -0
- data/test/lookup_att_test.rb +90 -0
- data/test/misc_test.rb +33 -50
- data/test/orest_test.rb +1 -1
- data/test/participant_test.rb +32 -8
- data/test/pending.rb +6 -7
- data/test/rake_ltest.rb +3 -0
- data/test/rake_qtest.rb +4 -1
- data/test/raw_prog_test.rb +1 -1
- data/test/restart_cron_test.rb +6 -6
- data/test/restart_sleep_test.rb +8 -8
- data/test/ruby_procdef_test.rb +2 -2
- data/test/rutest_utils.rb +9 -3
- data/test/scheduler_1_test.rb +88 -0
- data/test/scheduler_test.rb +49 -4
- data/test/sec_test.rb +18 -11
- metadata +51 -34
- data/test/cron_test_2.rb +0 -50
@@ -41,6 +41,7 @@
|
|
41
41
|
require 'openwfe/utils'
|
42
42
|
require 'openwfe/storage/yamlcustom'
|
43
43
|
require 'openwfe/storage/yamlfilestorage'
|
44
|
+
require 'openwfe/expool/threadedexpstorage'
|
44
45
|
|
45
46
|
require 'openwfe/expressions/flowexpression'
|
46
47
|
require 'openwfe/expressions/raw_xml'
|
@@ -74,8 +75,6 @@ module OpenWFE
|
|
74
75
|
#
|
75
76
|
def each_of_kind (kind, &block)
|
76
77
|
|
77
|
-
return unless block
|
78
|
-
|
79
78
|
each_object_path do |path|
|
80
79
|
|
81
80
|
#ldebug { "each_of_kind() path is #{path}" }
|
@@ -83,13 +82,13 @@ module OpenWFE
|
|
83
82
|
#next unless matches(path, kind)
|
84
83
|
# was not OK in case of <bob activity="clean office" />
|
85
84
|
|
86
|
-
expression = load_object
|
85
|
+
expression = load_object path
|
87
86
|
|
88
87
|
next unless expression.is_a?(kind)
|
89
88
|
|
90
89
|
expression.application_context = @application_context
|
91
90
|
|
92
|
-
block.call expression
|
91
|
+
block.call expression.fei, expression
|
93
92
|
end
|
94
93
|
end
|
95
94
|
|
@@ -106,8 +105,10 @@ module OpenWFE
|
|
106
105
|
|
107
106
|
a = self.class.split_file_path path
|
108
107
|
next unless a
|
108
|
+
|
109
109
|
wfid = a[0]
|
110
110
|
next if wfid_prefix and ( ! wfid.match "^#{wfid_prefix}")
|
111
|
+
|
111
112
|
flow_expression = load_object path
|
112
113
|
|
113
114
|
block.call flow_expression.fei, flow_expression
|
@@ -180,152 +181,6 @@ module OpenWFE
|
|
180
181
|
#++
|
181
182
|
end
|
182
183
|
|
183
|
-
#
|
184
|
-
# This mixin gathers all the logic for a threaded expression storage,
|
185
|
-
# one that doesn't immediately stores workitems (removes overriding
|
186
|
-
# operations).
|
187
|
-
# Using this threaded storage brings a very important perf benefit.
|
188
|
-
#
|
189
|
-
module ThreadedStorageMixin
|
190
|
-
|
191
|
-
THREADED_FREQ = "427" # milliseconds
|
192
|
-
#
|
193
|
-
# the frequency at which the event queue should be processed
|
194
|
-
|
195
|
-
#
|
196
|
-
# Will take care of stopping the 'queue processing' thread.
|
197
|
-
#
|
198
|
-
def stop
|
199
|
-
|
200
|
-
get_scheduler.unschedule(@thread_id) if @thread_id
|
201
|
-
|
202
|
-
process_queue()
|
203
|
-
#
|
204
|
-
# flush every remaining events (especially the :delete ones)
|
205
|
-
end
|
206
|
-
|
207
|
-
#
|
208
|
-
# calls process_queue() before the call the super class each_of_kind()
|
209
|
-
# method
|
210
|
-
#
|
211
|
-
def each_of_kind (kind, &block)
|
212
|
-
|
213
|
-
#ldebug { "each_of_kind()" }
|
214
|
-
|
215
|
-
process_queue()
|
216
|
-
super
|
217
|
-
end
|
218
|
-
|
219
|
-
#
|
220
|
-
# calls process_queue() before the call the super class each()
|
221
|
-
# method
|
222
|
-
#
|
223
|
-
def each (wfid_prefix=nil, &block)
|
224
|
-
|
225
|
-
process_queue()
|
226
|
-
super
|
227
|
-
end
|
228
|
-
|
229
|
-
protected
|
230
|
-
|
231
|
-
#
|
232
|
-
# starts the thread that does the actual persistence.
|
233
|
-
#
|
234
|
-
def start_processing_thread
|
235
|
-
|
236
|
-
@events = {}
|
237
|
-
@op_count = 0
|
238
|
-
|
239
|
-
@thread_id = get_scheduler.schedule_every THREADED_FREQ do
|
240
|
-
process_queue
|
241
|
-
end
|
242
|
-
end
|
243
|
-
|
244
|
-
#
|
245
|
-
# queues an event for later (well within a second) persistence
|
246
|
-
#
|
247
|
-
def queue (event, fei, fe=nil)
|
248
|
-
synchronize do
|
249
|
-
|
250
|
-
old_size = @events.size
|
251
|
-
@op_count += 1
|
252
|
-
|
253
|
-
@events[fei] = [ event, fei, fe ]
|
254
|
-
|
255
|
-
ldebug do
|
256
|
-
"queue() ops #{@op_count} "+
|
257
|
-
"size #{old_size} -> #{@events.size}"
|
258
|
-
end
|
259
|
-
end
|
260
|
-
end
|
261
|
-
|
262
|
-
#
|
263
|
-
# the actual "do persist" order
|
264
|
-
#
|
265
|
-
def process_queue
|
266
|
-
|
267
|
-
return unless @events.size > 0
|
268
|
-
#
|
269
|
-
# trying to exit as quickly as possible
|
270
|
-
|
271
|
-
ldebug do
|
272
|
-
"process_queue() #{@events.size} events #{@op_count} ops"
|
273
|
-
end
|
274
|
-
|
275
|
-
synchronize do
|
276
|
-
@events.each_value do |v|
|
277
|
-
event = v[0]
|
278
|
-
begin
|
279
|
-
if event == :update
|
280
|
-
self[v[1]] = v[2]
|
281
|
-
else
|
282
|
-
safe_delete(v[1])
|
283
|
-
end
|
284
|
-
rescue Exception => e
|
285
|
-
lwarn do
|
286
|
-
"process_queue() ':#{event}' exception\n" +
|
287
|
-
OpenWFE::exception_to_s(e)
|
288
|
-
end
|
289
|
-
end
|
290
|
-
end
|
291
|
-
@op_count = 0
|
292
|
-
@events.clear
|
293
|
-
end
|
294
|
-
end
|
295
|
-
|
296
|
-
#
|
297
|
-
# a call to delete that tolerates missing .yaml files
|
298
|
-
#
|
299
|
-
def safe_delete (fei)
|
300
|
-
begin
|
301
|
-
self.delete(fei)
|
302
|
-
rescue Exception => e
|
303
|
-
# lwarn do
|
304
|
-
# "safe_delete() exception\n" +
|
305
|
-
# OpenWFE::exception_to_s(e)
|
306
|
-
# end
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
#
|
311
|
-
# Adds the queue() method as an observer to the update and remove
|
312
|
-
# events of the expression pool.
|
313
|
-
# :update and :remove mean changes to expressions in the persistence
|
314
|
-
# that's why they are observed.
|
315
|
-
#
|
316
|
-
def observe_expool
|
317
|
-
|
318
|
-
get_expression_pool.add_observer(:update) do |event, fei, fe|
|
319
|
-
ldebug { ":update for #{fei.to_debug_s}" }
|
320
|
-
queue(event, fei, fe)
|
321
|
-
end
|
322
|
-
get_expression_pool.add_observer(:remove) do |event, fei|
|
323
|
-
ldebug { ":remove for #{fei.to_debug_s}" }
|
324
|
-
queue(event, fei)
|
325
|
-
end
|
326
|
-
end
|
327
|
-
end
|
328
|
-
|
329
184
|
#
|
330
185
|
# With this extension of YmalFileExpressionStorage, persistence occurs
|
331
186
|
# in a separate thread, for a snappier response.
|
@@ -118,7 +118,7 @@ module OpenWFE
|
|
118
118
|
|
119
119
|
ldebug { "do_eval_condition() 0 for '#{conditional}'" }
|
120
120
|
|
121
|
-
conditional =
|
121
|
+
conditional = unescape conditional
|
122
122
|
|
123
123
|
ldebug { "do_eval_condition() 1 for '#{conditional}'" }
|
124
124
|
|
@@ -146,12 +146,12 @@ module OpenWFE
|
|
146
146
|
(result == "true" or result == true)
|
147
147
|
end
|
148
148
|
|
149
|
-
|
149
|
+
#
|
150
|
+
# unescapes '>' and '<'
|
151
|
+
#
|
152
|
+
def unescape (s)
|
150
153
|
|
151
|
-
s
|
152
|
-
s.gsub!(">", ">")
|
153
|
-
s.gsub!("<", "<")
|
154
|
-
s
|
154
|
+
s.gsub("&", "&").gsub(">", ">").gsub("<", "<")
|
155
155
|
end
|
156
156
|
|
157
157
|
#
|
@@ -158,7 +158,9 @@ module OpenWFE
|
|
158
158
|
def reschedule (scheduler)
|
159
159
|
|
160
160
|
@variables.each do |key, value|
|
161
|
-
|
161
|
+
|
162
|
+
#ldebug { "reschedule() - item of class #{value.class}" }
|
163
|
+
|
162
164
|
next unless value.kind_of? Schedulable
|
163
165
|
value.application_context = @application_context
|
164
166
|
value.reschedule(scheduler)
|
@@ -172,8 +174,11 @@ module OpenWFE
|
|
172
174
|
# environment just before the engine environment).
|
173
175
|
#
|
174
176
|
def get_root_environment
|
177
|
+
|
175
178
|
#ldebug { "get_root_environment\n#{self}" }
|
176
|
-
|
179
|
+
|
180
|
+
return self unless @parent_id
|
181
|
+
|
177
182
|
get_parent.get_root_environment
|
178
183
|
end
|
179
184
|
|
@@ -79,6 +79,7 @@ module OpenWFE
|
|
79
79
|
super
|
80
80
|
|
81
81
|
@expressions = {}
|
82
|
+
@ancestors = {}
|
82
83
|
|
83
84
|
register DefineExpression
|
84
85
|
|
@@ -111,6 +112,7 @@ module OpenWFE
|
|
111
112
|
|
112
113
|
register RevalExpression
|
113
114
|
register PrintExpression
|
115
|
+
register LogExpression
|
114
116
|
|
115
117
|
register LoseExpression
|
116
118
|
register ForgetExpression
|
@@ -204,6 +206,18 @@ module OpenWFE
|
|
204
206
|
name = OpenWFE::to_dash(name)
|
205
207
|
@expressions[name] = expression_class
|
206
208
|
end
|
209
|
+
expression_class.ancestors.each do |ancestor|
|
210
|
+
(@ancestors[ancestor] ||= []) << expression_class
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
#
|
215
|
+
# Returns an array of expression classes that have the given
|
216
|
+
# class/module among their ancestors.
|
217
|
+
#
|
218
|
+
def get_expression_classes (ancestor)
|
219
|
+
|
220
|
+
@ancestors[ancestor]
|
207
221
|
end
|
208
222
|
|
209
223
|
def to_s
|
@@ -139,15 +139,17 @@ module OpenWFE
|
|
139
139
|
attr_accessor \
|
140
140
|
:sync_expression
|
141
141
|
|
142
|
+
|
142
143
|
def apply (workitem)
|
143
144
|
|
144
|
-
sync =
|
145
|
+
sync = lookup_sym_attribute(
|
146
|
+
:sync, workitem, :default => :generic)
|
145
147
|
|
146
148
|
@sync_expression =
|
147
149
|
get_expression_map.get_sync_class(sync).new(self, workitem)
|
148
150
|
|
149
151
|
@children.each do |child|
|
150
|
-
@sync_expression.add_child
|
152
|
+
@sync_expression.add_child child
|
151
153
|
end
|
152
154
|
|
153
155
|
store_itself()
|
@@ -272,7 +274,7 @@ module OpenWFE
|
|
272
274
|
#
|
273
275
|
class SyncExpression < ObjectWithMeta
|
274
276
|
|
275
|
-
def initialize
|
277
|
+
def initialize
|
276
278
|
|
277
279
|
super
|
278
280
|
end
|
@@ -313,12 +315,15 @@ module OpenWFE
|
|
313
315
|
@count = determine_count(synchable, workitem)
|
314
316
|
@cancel_remaining = cancel_remaining?(synchable, workitem)
|
315
317
|
|
316
|
-
merge = synchable.
|
317
|
-
|
318
|
+
merge = synchable.lookup_sym_attribute(
|
319
|
+
:merge, workitem, :default => :first)
|
320
|
+
|
321
|
+
merge_type = synchable.lookup_sym_attribute(
|
322
|
+
:merge_type, workitem, :default => :mix)
|
318
323
|
|
319
324
|
#synchable.ldebug { "new() merge_type is '#{merge_type}'" }
|
320
325
|
|
321
|
-
@merge_array = MergeArray.new
|
326
|
+
@merge_array = MergeArray.new synchable.fei, merge, merge_type
|
322
327
|
|
323
328
|
@unready_queue = []
|
324
329
|
end
|
@@ -459,17 +464,17 @@ module OpenWFE
|
|
459
464
|
|
460
465
|
def cancel_remaining? (synchable_expression, workitem)
|
461
466
|
|
462
|
-
s = synchable_expression.
|
463
|
-
:remaining, workitem, :cancel)
|
467
|
+
s = synchable_expression.lookup_sym_attribute(
|
468
|
+
:remaining, workitem, :default => :cancel)
|
464
469
|
|
465
|
-
|
470
|
+
(s == :cancel)
|
466
471
|
end
|
467
472
|
|
468
473
|
def determine_count (synchable_expression, workitem)
|
469
474
|
|
470
|
-
|
471
|
-
return -1 if not
|
472
|
-
i =
|
475
|
+
c = synchable_expression.lookup_attribute :count, workitem
|
476
|
+
return -1 if not c
|
477
|
+
i = c.to_i
|
473
478
|
return -1 if i < 1
|
474
479
|
i
|
475
480
|
end
|
@@ -484,18 +489,21 @@ module OpenWFE
|
|
484
489
|
include MergeMixin
|
485
490
|
|
486
491
|
attr_accessor \
|
492
|
+
:synchable_fei,
|
487
493
|
:workitem,
|
488
494
|
:workitems_by_arrival,
|
489
495
|
:workitems_by_altitude,
|
490
496
|
:merge,
|
491
497
|
:merge_type
|
492
498
|
|
493
|
-
def initialize (merge, merge_type)
|
499
|
+
def initialize (synchable_fei, merge, merge_type)
|
500
|
+
|
501
|
+
@synchable_fei = synchable_fei
|
494
502
|
|
495
|
-
@merge = merge
|
496
|
-
@merge_type = merge_type
|
503
|
+
@merge = merge
|
504
|
+
@merge_type = merge_type
|
497
505
|
|
498
|
-
ensure_merge_settings
|
506
|
+
ensure_merge_settings
|
499
507
|
|
500
508
|
@workitem = nil
|
501
509
|
|
@@ -539,7 +547,8 @@ module OpenWFE
|
|
539
547
|
end
|
540
548
|
|
541
549
|
#key = synchable.children.index wi.last_expression_id
|
542
|
-
key = wi.last_expression_id.child_id
|
550
|
+
#key = wi.last_expression_id.child_id
|
551
|
+
key = get_child_id wi
|
543
552
|
|
544
553
|
@workitem.attributes[key.to_s] =
|
545
554
|
OpenWFE::fulldup(wi.attributes)
|
@@ -548,7 +557,8 @@ module OpenWFE
|
|
548
557
|
def push_by_arrival (wi)
|
549
558
|
|
550
559
|
#index = synchable.children.index wi.last_expression_id
|
551
|
-
index = Integer(wi.last_expression_id.child_id)
|
560
|
+
#index = Integer(wi.last_expression_id.child_id)
|
561
|
+
index = Integer(get_child_id(wi))
|
552
562
|
|
553
563
|
@workitems_by_arrival << wi
|
554
564
|
@workitems_by_altitude[index] = wi
|
@@ -610,6 +620,18 @@ module OpenWFE
|
|
610
620
|
@merge_type == :isolate
|
611
621
|
end
|
612
622
|
|
623
|
+
#
|
624
|
+
# Returns the child id of the expression that just
|
625
|
+
# replied with the given workitem.
|
626
|
+
#
|
627
|
+
def get_child_id (workitem)
|
628
|
+
|
629
|
+
return workitem.fei.child_id \
|
630
|
+
if workitem.fei.wfid == @synchable_fei.wfid
|
631
|
+
|
632
|
+
workitem.fei.last_sub_instance_id
|
633
|
+
end
|
634
|
+
|
613
635
|
#
|
614
636
|
# Making sure @merge and @merge_type are set to
|
615
637
|
# appropriate values.
|
@@ -84,7 +84,7 @@ module OpenWFE
|
|
84
84
|
@counter = 0
|
85
85
|
|
86
86
|
if @children.size < 1
|
87
|
-
reply_to_parent
|
87
|
+
reply_to_parent workitem
|
88
88
|
return
|
89
89
|
end
|
90
90
|
|
@@ -104,6 +104,8 @@ module OpenWFE
|
|
104
104
|
|
105
105
|
@children = nil
|
106
106
|
|
107
|
+
determine_scheduler_tags
|
108
|
+
|
107
109
|
#
|
108
110
|
# schedule self
|
109
111
|
|
@@ -114,23 +116,18 @@ module OpenWFE
|
|
114
116
|
# (have to do it after the reschedule, so that the schedule
|
115
117
|
# info is stored within the variable)
|
116
118
|
|
117
|
-
set_variable
|
119
|
+
set_variable @name, self
|
118
120
|
|
119
121
|
#
|
120
122
|
# resume flow
|
121
123
|
|
122
|
-
reply_to_parent
|
124
|
+
reply_to_parent workitem
|
123
125
|
end
|
124
126
|
|
125
127
|
def reply (workitem)
|
126
128
|
# discard silently... should never get called though
|
127
129
|
end
|
128
130
|
|
129
|
-
#def cancel ()
|
130
|
-
#end
|
131
|
-
#
|
132
|
-
# implemented in parent TimeExpression class
|
133
|
-
|
134
131
|
#
|
135
132
|
# This is the method called each time the scheduler triggers
|
136
133
|
# this cron. The contained segment of process will get
|
@@ -179,17 +176,23 @@ module OpenWFE
|
|
179
176
|
if @tab
|
180
177
|
get_scheduler.schedule(
|
181
178
|
@tab,
|
182
|
-
{
|
179
|
+
{
|
180
|
+
:schedulable => self,
|
181
|
+
:job_id => @scheduler_job_id,
|
182
|
+
:tags => @scheduler_tags })
|
183
183
|
else
|
184
184
|
get_scheduler.schedule_every(
|
185
185
|
@every,
|
186
|
-
{
|
186
|
+
{
|
187
|
+
:schedulable => self,
|
188
|
+
:job_id => @scheduler_job_id,
|
189
|
+
:tags => @scheduler_tags })
|
187
190
|
end
|
188
191
|
|
189
192
|
ldebug { "reschedule() name is '#{@name}'" }
|
190
193
|
ldebug { "reschedule() job id is '#{@scheduler_job_id}'" }
|
191
194
|
|
192
|
-
#store_itself
|
195
|
+
#store_itself
|
193
196
|
#
|
194
197
|
# done by the containing environment itself
|
195
198
|
end
|
@@ -83,9 +83,6 @@ module OpenWFE
|
|
83
83
|
:current_child_id,
|
84
84
|
:current_child_fei
|
85
85
|
|
86
|
-
#
|
87
|
-
# apply / reply
|
88
|
-
|
89
86
|
def apply (workitem)
|
90
87
|
|
91
88
|
@loop_id = 0
|
@@ -161,8 +158,10 @@ module OpenWFE
|
|
161
158
|
# takes care of cancelling the current child if necessary
|
162
159
|
#
|
163
160
|
def cancel
|
161
|
+
|
164
162
|
get_expression_pool.cancel(@current_child_fei) \
|
165
163
|
if @current_child_fei
|
164
|
+
|
166
165
|
super
|
167
166
|
end
|
168
167
|
|
@@ -52,21 +52,18 @@ module OpenWFE
|
|
52
52
|
|
53
53
|
names :define, :process_definition, :workflow_definition
|
54
54
|
|
55
|
+
attr_accessor :body_fei
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
#
|
57
|
+
#--
|
59
58
|
# Evaluates the definition, but doesn't apply its body, will
|
60
59
|
# simply return the body fei.
|
61
60
|
#
|
62
|
-
def evaluate (workitem)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
@body_fei
|
69
|
-
end
|
61
|
+
#def evaluate (workitem)
|
62
|
+
# @eval_only = true
|
63
|
+
# apply workitem
|
64
|
+
# @body_fei
|
65
|
+
#end
|
66
|
+
#++
|
70
67
|
|
71
68
|
#
|
72
69
|
# Called at the end of the 'evaluation', the 'apply' operation on
|
@@ -74,19 +71,20 @@ module OpenWFE
|
|
74
71
|
#
|
75
72
|
def reply_to_parent (workitem)
|
76
73
|
|
77
|
-
return if @eval_only
|
74
|
+
#return if @eval_only
|
78
75
|
|
79
|
-
|
80
|
-
super workitem
|
81
|
-
return
|
82
|
-
end
|
76
|
+
#puts "/// \n bf #{@body_fei} \n wi.fei #{workitem.fei}"
|
83
77
|
|
84
|
-
|
85
|
-
|
78
|
+
return super(workitem) \
|
79
|
+
if @body_fei == nil or @body_fei == workitem.fei
|
80
|
+
#unless @body_fei
|
86
81
|
|
87
|
-
|
82
|
+
#_fei = @body_fei
|
83
|
+
#@body_fei = nil
|
84
|
+
#store_itself
|
85
|
+
#get_expression_pool.apply _fei, workitem
|
88
86
|
|
89
|
-
get_expression_pool.apply
|
87
|
+
get_expression_pool.apply @body_fei, workitem
|
90
88
|
end
|
91
89
|
|
92
90
|
#
|
@@ -113,7 +111,10 @@ module OpenWFE
|
|
113
111
|
|
114
112
|
protected
|
115
113
|
|
116
|
-
|
114
|
+
#
|
115
|
+
# Determines the flowExpressionId of the next child to apply.
|
116
|
+
#
|
117
|
+
def next_child (current_fei)
|
117
118
|
|
118
119
|
next_fei = super
|
119
120
|
|
@@ -121,26 +122,28 @@ module OpenWFE
|
|
121
122
|
|
122
123
|
rawchild = get_expression_pool.fetch_expression next_fei
|
123
124
|
|
125
|
+
return next_child(next_fei) unless rawchild
|
126
|
+
|
124
127
|
unless rawchild.is_definition?
|
125
|
-
|
126
|
-
|
128
|
+
|
129
|
+
unless @body_fei
|
130
|
+
@body_fei = next_fei
|
131
|
+
store_itself
|
132
|
+
end
|
133
|
+
return next_child(next_fei)
|
127
134
|
end
|
128
135
|
|
129
136
|
exp_class = get_expression_map.get_class rawchild
|
130
137
|
|
131
138
|
if exp_class == DefineExpression
|
132
|
-
#
|
133
|
-
# binds the FlowExpressionId of the current child
|
134
|
-
# as a variable and recurses to the next child
|
135
|
-
#
|
136
139
|
set_variable rawchild.definition_name, next_fei
|
137
|
-
return
|
140
|
+
return next_child(next_fei)
|
138
141
|
end
|
139
142
|
|
140
|
-
#
|
141
|
-
# our next child will simply get applied
|
142
|
-
|
143
143
|
next_fei
|
144
|
+
#
|
145
|
+
# expression is a 'set', a 'filter-definition' or
|
146
|
+
# something like that, let it get applied
|
144
147
|
end
|
145
148
|
end
|
146
149
|
|