| Module | OpenWFE::StatusMethods |
| In: |
lib/openwfe/engine/status_methods.rb
|
This mixin is only included by the Engine class. It contains all the methods about ProcessStatus.
Returns true if the process is in pause.
# File lib/openwfe/engine/status_methods.rb, line 352
352: def is_paused? (wfid)
353:
354: (get_expression_pool.paused_instances[wfid] != nil)
355: end
Returns the process status of one given process instance.
# File lib/openwfe/engine/status_methods.rb, line 342
342: def process_status (wfid)
343:
344: wfid = extract_wfid wfid, true
345:
346: process_statuses(:wfid => wfid).values[0]
347: end
Returns a hash of ProcessStatus instances. The keys of the hash are workflow instance ids.
A ProcessStatus is a description of the state of a process instance. It enumerates the expressions where the process is currently located (waiting certainly) and the errors the process currently has (hopefully none).
# File lib/openwfe/engine/status_methods.rb, line 286
286: def process_statuses (options={})
287:
288: options = { :wfid_prefix => options } if options.is_a?(String)
289:
290: result = {}
291:
292: expressions = get_expression_storage.find_expressions options
293:
294: expressions.each do |fexp|
295:
296: next unless (fexp.apply_time or fexp.is_a?(Environment))
297:
298: next if fexp.fei.wfid == "0" # skip the engine env
299:
300: #(result[fexp.fei.parent_wfid] ||= ProcessStatus.new) << fexp
301:
302: parent_wfid = fexp.fei.parent_wfid
303:
304: ps = result[parent_wfid]
305:
306: if not ps
307:
308: ps = ProcessStatus.new
309:
310: ps.paused =
311: (get_expool.paused_instances[parent_wfid] != nil)
312:
313: result[parent_wfid] = ps
314: end
315:
316: ps << fexp
317: end
318:
319: result.values.each do |ps|
320: get_error_journal.get_error_log(ps.wfid).each do |error|
321: ps << error
322: end
323: end
324:
325: class << result
326: def to_s
327: OpenWFE::pretty_print_process_status(self)
328: end
329: end
330:
331: result
332: end