Class: OpenWFE::ProcessStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/openwfe/engine/process_status.rb

Overview

ProcessStatus represents information about the status of a workflow process instance.

The status is mainly a list of expressions and a hash of errors.

Instances of this class are obtained via Engine.process_status().

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeProcessStatus

Builds an empty ProcessStatus instance.



91
92
93
94
95
96
97
98
# File 'lib/openwfe/engine/process_status.rb', line 91

def initialize

    @wfid = nil
    @expressions = []
    @errors = {}
    @launch_time = nil
    @variables = nil
end

Instance Attribute Details

#errorsObject (readonly)

A hash whose values are ProcessError instances, the keys are FlowExpressionId instances (fei) (identifying the expressions that are concerned with the error)



70
71
72
# File 'lib/openwfe/engine/process_status.rb', line 70

def errors
  @errors
end

#expressionsObject (readonly)

The list of the expressions currently active in the process instance.

For instance, if your process definition is currently in a concurrence, more than one expressions may be listed here.



63
64
65
# File 'lib/openwfe/engine/process_status.rb', line 63

def expressions
  @expressions
end

#launch_timeObject (readonly)

The time at which the process got launched.



75
76
77
# File 'lib/openwfe/engine/process_status.rb', line 75

def launch_time
  @launch_time
end

#pausedObject

Is the process currently in pause ?



86
87
88
# File 'lib/openwfe/engine/process_status.rb', line 86

def paused
  @paused
end

#variablesObject (readonly)

The variables hash as set in the process environment (the process scope).



81
82
83
# File 'lib/openwfe/engine/process_status.rb', line 81

def variables
  @variables
end

#wfidObject (readonly)

the String workflow instance id of the Process.



55
56
57
# File 'lib/openwfe/engine/process_status.rb', line 55

def wfid
  @wfid
end

Instance Method Details

#<<(item) ⇒ Object

this method is used by Engine.get_process_status() when it prepares its results.



155
156
157
158
159
160
161
162
# File 'lib/openwfe/engine/process_status.rb', line 155

def << (item)

    if item.kind_of?(FlowExpression)
        add_expression item
    else
        add_error item
    end
end

#branchesObject

Returns the count of concurrent branches currently active for this process. The typical ‘sequential only’ process will have a return value of 1 here.



125
126
127
128
# File 'lib/openwfe/engine/process_status.rb', line 125

def branches

    @expressions.size
end

#paused?Boolean

Returns true if the process is in pause.

Returns:

  • (Boolean)


145
146
147
148
149
# File 'lib/openwfe/engine/process_status.rb', line 145

def paused?

    #@expressions.first.paused?
    @paused
end

#tagsObject

Returns the tags currently set in this process.



133
134
135
136
137
138
139
140
# File 'lib/openwfe/engine/process_status.rb', line 133

def tags

    return [] unless @variables

    @variables.keys.select do |k|
        @variables[k].is_a?(OpenWFE::RawExpression::Tag)
    end
end

#to_sObject

A String representation, handy for debugging, quick viewing.



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/openwfe/engine/process_status.rb', line 167

def to_s

    s = []

    s << "-- #{self.class.name} --"
    s << "      wfid :        #{@wfid}"
    s << "      launch_time : #{launch_time}"
    s << "      tags :        #{tags.join(", ")}"
    s << "      errors :      #{@errors.size}"
    s << "      paused :      #{paused?}"

    s << "      expressions :"
    @expressions.each do |fexp|
        s << "         #{fexp.fei.to_s}"
    end

    s.join "\n"
end

#wfnameObject Also known as: workflow_definition_name

Returns the workflow definition name for this process.



103
104
105
106
# File 'lib/openwfe/engine/process_status.rb', line 103

def wfname

    @expressions.first.fei.wfname
end

#wfrevisionObject Also known as: workflow_definition_revision

Returns the workflow definition revision for this process.



113
114
115
116
# File 'lib/openwfe/engine/process_status.rb', line 113

def wfrevision

    @expressions.first.fei.wfrevision
end