Class Ruote::ProcessStatus
In: lib/ruote/dboard/process_status.rb
Parent: Object

A ‘view’ on the status of a process instance.

Returned by the process and the processes methods of Ruote::Dashboard.

Methods

Attributes

errors  [R]  An array of errors currently plaguing the process instance. Hopefully, this array is empty.
expressions  [R]  The expressions that compose the process instance.
root_expression  [R]  Returns the expression at the root of the process instance.
schedules  [R]  An array of schedules (open structs yielding information about the schedules of this process)
stored_workitems  [R]  An array of the workitems currently in the storage participant for this process instance.

Do not confuse with workitems

trackers  [R]  TODO

Public Class methods

Public Instance methods

Returns a hash tagname => array of feis of all the tags set in the process instance.

Returns a hash fei => variable_hash containing all the variable bindings (expression by expression) of the process instance.

Returns the current version of the process definition tree. If no manipulation (gardening) was performed on the tree, this method yields the same result as the original_tree method.

Returns nil if there are no expressions (happens in the case of an orphan workitem)

For a process

  Ruote.process_definition :name => 'review', :revision => '0.1' do
    author
    reviewer
  end

will yield ‘review’.

For a process

  Ruote.process_definition :name => 'review', :revision => '0.1' do
    author
    reviewer
  end

will yield ‘0.1’.

Given a fei, returns the flow expression with that fei (only looks in the expressions stored here, in this ProcessStatus instance, doesn‘t query the storage).

Returns a parseable UTC datetime string which indicates when the process was last active.

Returns a Time instance indicating when the process instance was launched.

Returns the expressions where the flow is currently, ak the leaves of the execution tree.

Whereas position only looks at participant expressions (and errors), leaves looks at any expressions that is a leave (which has no child at this point).

Returns an array of FlowExpression instances. (Note that they may have their attribute error set).

Returns the process definition tree as it was when this process instance was launched.

Returns the list of "past tags", tags that have been entered and left.

The list elements look like:

  [ full_tagname, fei_as_string, nil_or_left_status, variables ]

For example:

  [ 'a', '0_1_0!8f233fb935c!20120106-jagitepi', nil, {} ]

or

  [ 'stage0/stage1', '0_1_0!8fb935c666d!20120106-jagitepi', 'cancelling', nil ]

The second to last entry is nil when the tag (its expression) replied normally, if it was cancelled or something else, the entry contains a string describing the reason (‘cancelling’ here). The last entry is the variables as they were at the tag point when the execution left the tag.

Returns the ‘position’ of the process.

  pdef = Ruote.process_definition do
    alpha :task => 'clean car'
  end
  wfid = engine.launch(pdef)

  sleep 0.500

  engine.process(wfid) # => [["0_0", "alpha", {"task"=>"clean car"}]]

A process with concurrent branches will yield multiple ‘positions’.

It uses workitems underneath.

If you want to list all the expressions where the "flow currently is" regardless they are participant expressions or errors, look at the leaves method.

Given an expression id, returns the root (top ancestor) for its expression.

Returns a list of all the expressions that have no parent expression. The list is sorted with the deeper (closer to the original root) first.

Returns the workitem as was applied at the root expression.

Returns nil if no root expression could be found.

Returns a hash tagname => fei of tags set at the root of the process instance.

Returns nil if there is no defined root expression.

Returns a ‘dot’ representation of the process. A graph describing the tree of flow expressions that compose the process.

Outputs the process status as a hash (easily JSONifiable).

Returns the process variables set for this process instance.

Returns nil if there is no defined root expression.

Returns the unique identifier for this process instance.

Returns a list of the workitems currently ‘out’ to participants

For example, with an instance of

  Ruote.process_definition do
    concurrence do
      alpha :task => 'clean car'
      bravo :task => 'sell car'
    end
  end

calling engine.process(wfid).workitems will yield two workitems (alpha and bravo).

Warning : do not confuse the workitems here with the workitems held in a storage participant or equivalent.

[Validate]