module Roby::TaskStructure::ExecutionAgent::Extension
Public Instance Methods
added_execution_agent(child, info)
click to toggle source
Installs the handlers needed for fault handling
See the documentation of used_with_an_execution_agent?
Calls superclass method
# File lib/roby/task_structure/executed_by.rb, line 157 def added_execution_agent(child, info) super if !used_with_an_execution_agent? start_event.on(&ExecutionAgent.method(:establish_agent_aborted_relation)) stop_event.on(&ExecutionAgent.method(:remove_agent_aborted_relation)) self.used_with_an_execution_agent = true end if !child.used_as_execution_agent? if !child.ready_event.emitted? child.ready_event.when_unreachable( true, &ExecutionAgent.method(:execution_agent_failed_to_start)) end child.stop_event.on( &ExecutionAgent.method(:pending_execution_agent_failed)) child.used_as_execution_agent = true end end
adding_execution_agent(child, info)
click to toggle source
Calls superclass method
# File lib/roby/task_structure/executed_by.rb, line 140 def adding_execution_agent(child, info) if running? raise ExecutedTaskAlreadyRunning, "#{self} is already running, cannot add or change its agent" end super if model_agent = model.execution_agent if !child.fullfills?(*model_agent) raise Roby::ModelViolation, "execution agent #{child} does not fullfill the expected #{model_agent}" end end end
executed_by(agent)
click to toggle source
Defines a new execution agent for this task.
# File lib/roby/task_structure/executed_by.rb, line 120 def executed_by(agent) if agent.respond_to?(:as_plan) agent = agent.as_plan end return if execution_agent == agent if !agent.has_event?(:ready) raise ArgumentError, "execution agent tasks should define the :ready event" end old_agent = execution_agent if old_agent && old_agent != agent remove_execution_agent old_agent end add_execution_agent(agent) agent end