Class: Roby::TaskStructure::ExecutionAgent

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

Overview

Graph class for the execution agent relation

Defined Under Namespace

Modules: Extension, ModelExtension

Class Method Summary collapse

Class Method Details

.establish_agent_aborted_relation(event) ⇒ Object



57
58
59
60
61
62
63
64
65
# File 'lib/roby/task_structure/executed_by.rb', line 57

def self.establish_agent_aborted_relation(event)
    executed_task = event.task
    return unless (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
    execution_agent.stop_event.forward_to executed_task.aborted_event
end

.execution_agent_failed_to_start(reason, ready_event) ⇒ Object



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

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

    tasks = execution_agent.each_executed_task.to_a

    plan = execution_agent.plan
    plan.control.execution_agent_failed_to_start(
        execution_agent, tasks, reason
    )
end

.pending_execution_agent_failed(event) ⇒ Object



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

def self.pending_execution_agent_failed(event)
    execution_agent = event.task
    return unless execution_agent.ready?

    tasks = execution_agent.each_executed_task.find_all do |task|
        task.pending? || task.starting?
    end
    return if tasks.empty?

    plan = execution_agent.plan
    plan.control.pending_executed_by_failed(execution_agent, tasks)
end

.remove_agent_aborted_relation(stop_event) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/roby/task_structure/executed_by.rb', line 45

def self.remove_agent_aborted_relation(stop_event)
    executed_task = stop_event.task

    # The event handler will be called even if the
    # execution agent has been removed. Check that there is
    # actually an execution agent
    return unless (execution_agent = executed_task.execution_agent)

    execution_agent.stop_event.remove_forwarding executed_task.aborted_event
    executed_task.remove_execution_agent execution_agent
end