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, #delete, each, fetch, ids, inherited, #initialize, many_to_one, #new?, new_from_storage, one_to_many, #reload!, #save, #set_attributes, set_columns, #storage, #storage_id, storage_id_for_key, storage_type, #to_hash
Instance Method Details
#_launch ⇒ Object
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/swarm/process.rb', line 20
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
33
34
35
36
|
# File 'lib/swarm/process.rb', line 33
def finished?
reload!
root_expression && root_expression.replied?
end
|
#launch ⇒ Object
15
16
17
18
|
# File 'lib/swarm/process.rb', line 15
def launch
hive.queue('launch', self)
self
end
|
#move_on_from(expression) ⇒ Object
43
44
45
46
47
48
49
|
# File 'lib/swarm/process.rb', line 43
def move_on_from(expression)
self.workitem = expression.workitem
save
if parent_expression
parent_expression.move_on_from(self)
end
end
|
#node_at_position(position) ⇒ Object
38
39
40
41
|
# File 'lib/swarm/process.rb', line 38
def node_at_position(position)
raise ArgumentError unless position == 0
process_definition.tree
end
|
#wait_until_finished(timeout: 5) ⇒ Object
11
12
13
|
# File 'lib/swarm/process.rb', line 11
def wait_until_finished(timeout: 5)
Swarm::Support.wait_until(timeout: timeout) { finished? }
end
|