Class: Roby::DecisionControl

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

Instance Method Summary collapse

Instance Method Details

#adding_plan_relation(transaction, parent, child, relations, info) ⇒ Object

Called when a transaction/execution conflict occured, where relations have been added in the plan and are not present in the transaction.

The new relations are of types relations, between parent and child and with info as info object. The transaction has been invalidated prior to this call

The default action is to do nothing



42
# File 'lib/roby/decision_control.rb', line 42

def adding_plan_relation(transaction, parent, child, relations, info); end

#conflict(starting_task, running_tasks) ⇒ Object

Called when there is a conflict between a set of running tasks and a task that should have been started. The default operation is to add an error about it



8
9
10
# File 'lib/roby/decision_control.rb', line 8

def conflict(starting_task, running_tasks)
    starting_task.failed_to_start! TaskStructure::ConflictError.new(starting_task, running_tasks)
end

#execution_agent_failed_to_start(agent, tasks, reason = nil) ⇒ Object

Called when an execution agent fails to start.

The default policy is to mark all executed tasks as failed to start



79
80
81
82
83
# File 'lib/roby/decision_control.rb', line 79

def execution_agent_failed_to_start(agent, tasks, reason = nil)
    tasks.each do |t|
        t.failed_to_start!(reason || agent.failure_reason || agent.terminal_event)
    end
end

#finalized_plan_event(transaction, proxy) ⇒ Object

Called when a transaction/execution conflict occured, where a task included in the transaction has been removed from the plan.

proxy is the transaction representation of the event which has been removed and transaction the transaction. The transaction has been invalidated prior to this call, and the event proxy has been removed from transaction.

The default action is to do nothing



32
# File 'lib/roby/decision_control.rb', line 32

def finalized_plan_event(transaction, proxy); end

#finalized_plan_task(transaction, proxy) ⇒ Object

Called when a transaction/execution conflict occured, where a task included in the transaction has been removed from the plan.

proxy is the transaction’s representation of the task which has been removed and transaction the transaction. The transaction has been invalidated prior to this call, and the task proxy has been removed from transaction.

The default action is to do nothing



21
# File 'lib/roby/decision_control.rb', line 21

def finalized_plan_task(transaction, proxy); end

#pending_dependency_failed(parent, child, reason) ⇒ Object

Called when a child failed a dependency relation, but the parent is not running

It must return true if the dependency failure is considered an error, and false otherwise.

The default policy is to mark the parent as failed to start



62
63
64
65
# File 'lib/roby/decision_control.rb', line 62

def pending_dependency_failed(parent, child, reason)
    parent.failed_to_start!(reason)
    true
end

#pending_executed_by_failed(agent, tasks) ⇒ Object

Called when an execution agent fails to start.

The default policy is to mark all executed tasks as failed to start



70
71
72
73
74
# File 'lib/roby/decision_control.rb', line 70

def pending_executed_by_failed(agent, tasks)
    tasks.each do |t|
        t.failed_to_start!(agent.failure_reason || agent.terminal_event)
    end
end

#removing_plan_relation(transaction, parent, child, relations) ⇒ Object

Called when a transaction/execution conflict occured, where relations have been removed from the plan, which were present in the transaction.

The relations are of types relations, between parent and child and with info as info object. The transaction has been invalidated prior to this call

The default action is to do nothing



53
# File 'lib/roby/decision_control.rb', line 53

def removing_plan_relation(transaction, parent, child, relations); end