Class: Roby::TaskStructure::ExecutionAgent

Inherits:
Object
  • Object
show all
Defined in:
lib/roby/task_structure/executed_by.rb

Defined Under Namespace

Modules: Extension, ModelExtension

Class Method Summary collapse

Class Method Details

.establish_agent_aborted_relation(ev) ⇒ Object



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/roby/task_structure/executed_by.rb', line 61

def self.establish_agent_aborted_relation(ev)
    executed_task = ev.task
    execution_agent = executed_task.execution_agent

    # The event handler will be called even if the
    # execution agent has been removed. Check that there is
    # actually an execution agent 
    if execution_agent
        execution_agent.stop_event.forward_to executed_task.aborted_event
    end
end

.execution_agent_failed_to_start(reason, ready_event) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/roby/task_structure/executed_by.rb', line 18

def self.execution_agent_failed_to_start(reason, ready_event)
    execution_agent = ready_event.task

    tasks = []
    execution_agent.each_executed_task do |task|
        tasks << task
    end

    plan = execution_agent.plan
    if !tasks.empty?
        plan.control.execution_agent_failed_to_start(execution_agent, tasks, reason)
    end
end

.pending_execution_agent_failed(event) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/roby/task_structure/executed_by.rb', line 32

def self.pending_execution_agent_failed(event)
    execution_agent = event.task

    if execution_agent.ready?
        tasks = []
        execution_agent.each_executed_task do |task|
            tasks << task if task.pending? || task.starting?
        end
        
        plan = execution_agent.plan
        if !tasks.empty?
            plan.control.pending_executed_by_failed(execution_agent, tasks)
        end
    end
end

.remove_agent_aborted_relation(ev) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/roby/task_structure/executed_by.rb', line 48

def self.remove_agent_aborted_relation(ev)
    executed_task = ev.task
    execution_agent = executed_task.execution_agent

    # The event handler will be called even if the
    # execution agent has been removed. Check that there is
    # actually an execution agent 
    if execution_agent
        execution_agent.stop_event.remove_forwarding executed_task.aborted_event
        executed_task.remove_execution_agent execution_agent
    end
end