Class: Swarm::Process
Instance Attribute Summary
Attributes inherited from HiveDweller
#hive, #id
Instance Method Summary
collapse
Methods inherited from HiveDweller
#==, all, #attributes, #change_attribute, #changed?, create, define_getter, define_setter, #delete, each, fetch, ids, inherited, #initialize, many_to_one, #new?, new_from_storage, one_to_many, reify_from_hash, #reload!, #save, #set_attributes, set_columns, #storage, #storage_id, storage_id_for_key, storage_type, #to_hash
Instance Method Details
#_launch ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/swarm/process.rb', line 22
def _launch
new_expression = SequenceExpression.create(
hive: hive,
parent_id: id,
position: [0],
workitem: workitem,
process_id: id
)
new_expression.apply
self.root_expression_id = new_expression.id
save
end
|
#finished? ⇒ Boolean
35
36
37
38
|
# File 'lib/swarm/process.rb', line 35
def finished?
reload!
root_expression&.replied?
end
|
#launch ⇒ Object
17
18
19
20
|
# File 'lib/swarm/process.rb', line 17
def launch
hive.queue('launch', self)
self
end
|
#move_on_from(expression) ⇒ Object
46
47
48
49
50
51
52
|
# File 'lib/swarm/process.rb', line 46
def move_on_from(expression)
self.workitem = expression.workitem
save
return unless parent_expression
parent_expression.move_on_from(self)
end
|
#node_at_position(position) ⇒ Object
40
41
42
43
44
|
# File 'lib/swarm/process.rb', line 40
def node_at_position(position)
raise ArgumentError unless position == 0
process_definition.tree
end
|
#process_definition_name ⇒ Object
54
55
56
|
# File 'lib/swarm/process.rb', line 54
def process_definition_name
process_definition.name
end
|
#wait_until_finished(timeout: 5) ⇒ Object
13
14
15
|
# File 'lib/swarm/process.rb', line 13
def wait_until_finished(timeout: 5)
Swarm::Support.wait_until(timeout: timeout) { finished? }
end
|