Module: OpenWFE::StatusMixin

Included in:
Engine
Defined in:
lib/openwfe/engine/process_status.rb

Overview

This mixin is only included by the Engine class. It contains all the methods about ProcessStatus.

Instance Method Summary collapse

Instance Method Details

#is_paused?(wfid) ⇒ Boolean

Returns true if the process is in pause.

Returns:

  • (Boolean)


352
353
354
355
# File 'lib/openwfe/engine/process_status.rb', line 352

def is_paused? (wfid)

    (get_expression_pool.paused_instances[wfid] != nil)
end

#process_status(wfid) ⇒ Object

Returns the process status of one given process instance.



342
343
344
345
346
347
# File 'lib/openwfe/engine/process_status.rb', line 342

def process_status (wfid)

    wfid = extract_wfid wfid, true

    process_statuses(:wfid => wfid).values[0]
end

#process_statuses(options = {}) ⇒ Object Also known as: list_process_status

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).



286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/openwfe/engine/process_status.rb', line 286

def process_statuses (options={})

    options = { :wfid_prefix => options } if options.is_a?(String)

    result = {}

    expressions = get_expression_storage.find_expressions options

    expressions.each do |fexp|

        next unless (fexp.apply_time or fexp.is_a?(Environment))

        next if fexp.fei.wfid == "0" # skip the engine env

        #(result[fexp.fei.parent_wfid] ||= ProcessStatus.new) << fexp

        parent_wfid = fexp.fei.parent_wfid
        
        ps = result[parent_wfid]

        if not ps

            ps = ProcessStatus.new

            ps.paused = 
                (get_expool.paused_instances[parent_wfid] != nil)

            result[parent_wfid] = ps
        end

        ps << fexp
    end

    result.values.each do |ps|
        get_error_journal.get_error_log(ps.wfid).each do |error|
            ps << error
        end
    end

    class << result
        def to_s
            OpenWFE::pretty_print_process_status(self)
        end
    end

    result
end