Class: Roby::DRoby::RebuiltPlan
- Inherits:
-
Plan
- Object
- Roby::DistributedObject
- Plan
- Roby::DRoby::RebuiltPlan
- Defined in:
- lib/roby/droby/rebuilt_plan.rb
Overview
Plan object that has been rebuilt from an log event stream
It stores additional event propagation information extracted from the stream
Defined Under Namespace
Classes: AtCycleEnd
Constant Summary
Constants included from GUI::RelationsCanvasPlan
GUI::RelationsCanvasPlan::PLAN_STROKE_WIDTH
Instance Attribute Summary collapse
-
#at_cycle_end ⇒ Object
readonly
Set of operations that are scheduled to be done at cycle end.
-
#called_generators ⇒ Array<EventGenerator>
readonly
The set of generators that have been called since the last call to #clear_integrated.
-
#emitted_events ⇒ Array<[Time, Event]>
readonly
The set of events emitted since the last call to #clear_integrated.
-
#failed_emissions ⇒ Object
readonly
The set of events that have failed to emit since the last call to #clear_integrated.
-
#failed_to_start ⇒ Object
readonly
The set of tasks that failed to start since the last call to #clear_integrated.
-
#finalized_events ⇒ Object
readonly
The set of free event generators that have been finalized since the last call to #clear_integrated.
-
#finalized_tasks ⇒ Object
readonly
The set of tasks that have been finalized since the last call to #clear_integrated.
-
#garbaged_events ⇒ Object
readonly
The set of events that got garbage collected.
-
#garbaged_tasks ⇒ Object
readonly
The set of tasks that got garbage collected.
-
#propagated_events ⇒ Object
readonly
The set of event propagations that have been recorded since the last call to # #clear_integrated.
-
#propagated_exceptions ⇒ Object
readonly
The set of exceptions propagated since the last call to #clear_integrated.
-
#scheduler_states ⇒ Array<Schedulers::State>
readonly
The list of scheduler states since the last call to #clear_integrated.
Attributes inherited from Plan
#active_fault_response_tables, #event_logger, #event_relation_graphs, #free_events, #graph_observer, #local_owner, #null_event_relation_graphs, #null_task_relation_graphs, #plan_services, #structure_checks, #task_events, #task_index, #task_relation_graphs, #tasks, #transactions, #triggers
Attributes included from GUI::RelationsCanvasPlan
Attributes included from GUI::GraphvizPlan
Attributes inherited from Roby::DistributedObject
Instance Method Summary collapse
- #clear ⇒ Object
- #clear_integrated ⇒ Object
-
#consolidated_scheduler_state ⇒ Schedulers::State
A consolidated representation of the states in #scheduler_states.
- #finalize_event(object, timestamp = nil) ⇒ Object
- #finalize_task(object, timestamp = nil) ⇒ Object
-
#initialize ⇒ RebuiltPlan
constructor
A new instance of RebuiltPlan.
- #merge(plan) ⇒ Object
Methods inherited from Plan
#[], #add, #add_job_action, #add_mission, #add_mission_task, #add_permanent, #add_permanent_event, #add_permanent_task, #add_plan_service, #add_trigger, #added_transaction, #apply_replacement_operations, #apply_triggers_matches, #call_structure_check_handler, can_gc?, check_failed_missions, #check_structure, #clear!, #compute_subplan_replacement, #compute_useful_free_events, #compute_useful_tasks, #copy_relation_graphs_to, #copy_task_marks, #copy_to, #create_null_relations, #create_relations, #dedupe, #deep_copy, #deep_copy_to, #default_useful_task_graphs, #dup, #each_event_relation_graph, #each_object_in_transaction_stack, #each_relation_graph, #each_task, #each_task_relation_graph, #edit, #empty?, #event_relation_graph_for, #executable?, #execute, #finalized_event, #finalized_task, #find_all_plan_services, #find_local_tasks, #find_plan_difference, #find_plan_service, #find_tasks, #find_triggers_matches, #force_replace, #force_replace_task, #format_exception_set, #handle_force_replace, #handle_replace, #has_free_event?, #has_task?, #has_task_event?, #in_transaction, #in_useful_subplan?, #include?, #inspect, instanciate_relation_graphs, #local_tasks, #locally_useful_roots, #locally_useful_tasks, #make_useless, #merge!, #merge_base, #merge_relation_graphs, #merge_transaction, #merge_transaction!, #merged_plan, #merging_plan, #mission?, #mission_task?, #mission_tasks, #move_plan_service, #normalize_add_arguments, #notify_event_status_change, #notify_task_status_change, #num_events, #num_free_events, #num_tasks, #owns?, #permanent?, #permanent_event?, #permanent_events, #permanent_task?, #permanent_tasks, #query_result_set, #real_plan, #recreate, #refresh_relations, #register_event, #register_task, #registered_plan_services_for, #remote_tasks, #remove_fault_response_table, #remove_free_event, #remove_free_event!, #remove_object, #remove_plan_service, #remove_task, #remove_task!, #remove_transaction, #remove_trigger, #replace, #replace_relation_graphs, #replace_subplan, #replace_task, #replaced, #replan, #root_plan?, #same_plan?, #sibling_on?, #size, #static_garbage_collect, #task_relation_graph_for, #template?, #transaction_stack, #unmark_mission, #unmark_mission_task, #unmark_permanent, #unmark_permanent_event, #unmark_permanent_task, #unneeded_events, #unneeded_tasks, #use_fault_response_table, #useful_events, #useful_task?, #useful_tasks, #validate_graphs, #verify_plan_object_finalization_sanity
Methods included from V5::PlanDumper
Methods included from Identifiable
Methods included from GUI::RelationsCanvasPlan
#display, #display_create, #display_name, #display_parent
Methods included from GUI::GraphvizPlan
#all_events, #apply_layout, #compute_depth, #each_displayed_relation, #each_edge, #each_layout_relation, #layout_relations, #relations_to_dot, #to_dot
Methods included from EventLogging
#log, #log_flush_cycle, #log_queue_size, #log_timepoint, #log_timepoint_group, #log_timepoint_group_end, #log_timepoint_group_start
Methods inherited from Roby::DistributedObject
#add_owner, #clear_owners, #initialize_copy, #owned_by?, #remove_owner
Constructor Details
#initialize ⇒ RebuiltPlan
Returns a new instance of RebuiltPlan.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 59 def initialize super @finalized_tasks = Set.new @finalized_events = Set.new @garbaged_tasks = Set.new @garbaged_events = Set.new @called_generators = [] @emitted_events = [] @propagated_events = [] @failed_emissions = [] @failed_to_start = [] @propagated_exceptions = [] @scheduler_states = [] @at_cycle_end = AtCycleEnd.new([], [], []) end |
Instance Attribute Details
#at_cycle_end ⇒ Object (readonly)
Set of operations that are scheduled to be done at cycle end
19 20 21 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 19 def at_cycle_end @at_cycle_end end |
#called_generators ⇒ Array<EventGenerator> (readonly)
The set of generators that have been called since the last call to #clear_integrated
36 37 38 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 36 def called_generators @called_generators end |
#emitted_events ⇒ Array<[Time, Event]> (readonly)
The set of events emitted since the last call to #clear_integrated
40 41 42 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 40 def emitted_events @emitted_events end |
#failed_emissions ⇒ Object (readonly)
The set of events that have failed to emit since the last call to #clear_integrated
46 47 48 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 46 def failed_emissions @failed_emissions end |
#failed_to_start ⇒ Object (readonly)
The set of tasks that failed to start since the last call to #clear_integrated
49 50 51 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 49 def failed_to_start @failed_to_start end |
#finalized_events ⇒ Object (readonly)
The set of free event generators that have been finalized since the last call to #clear_integrated
25 26 27 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 25 def finalized_events @finalized_events end |
#finalized_tasks ⇒ Object (readonly)
The set of tasks that have been finalized since the last call to #clear_integrated
22 23 24 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 22 def finalized_tasks @finalized_tasks end |
#garbaged_events ⇒ Object (readonly)
The set of events that got garbage collected. For display purposes, they only get removed from the plan at the next cycle.
31 32 33 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 31 def garbaged_events @garbaged_events end |
#garbaged_tasks ⇒ Object (readonly)
The set of tasks that got garbage collected. For display purposes, they only get removed from the plan at the next cycle.
28 29 30 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 28 def garbaged_tasks @garbaged_tasks end |
#propagated_events ⇒ Object (readonly)
The set of event propagations that have been recorded since the last call to # #clear_integrated
43 44 45 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 43 def propagated_events @propagated_events end |
#propagated_exceptions ⇒ Object (readonly)
The set of exceptions propagated since the last call to #clear_integrated
52 53 54 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 52 def propagated_exceptions @propagated_exceptions end |
#scheduler_states ⇒ Array<Schedulers::State> (readonly)
The list of scheduler states since the last call to #clear_integrated
57 58 59 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 57 def scheduler_states @scheduler_states end |
Instance Method Details
#clear ⇒ Object
109 110 111 112 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 109 def clear super clear_integrated end |
#clear_integrated ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 146 def clear_integrated called_generators.clear emitted_events.clear finalized_tasks.clear finalized_events.clear propagated_events.clear failed_emissions.clear failed_to_start.clear scheduler_states.clear propagated_exceptions.clear garbaged_tasks.each do |task| # Do remove the GCed object. We use object.finalization_time # to store the actual finalization time. Pass it again to # #remove_object so that it does not get reset to Time.now remove_task!(task, task.finalization_time) end garbaged_tasks.clear garbaged_events.each do |event| remove_free_event!(event, event.finalization_time) end garbaged_events.clear end |
#consolidated_scheduler_state ⇒ Schedulers::State
A consolidated representation of the states in #scheduler_states
It removes duplicates, and removes “non-scheduled” reports for tasks that have in fine been scheduled
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 120 def consolidated_scheduler_state state = Schedulers::State.new scheduler_states.each do |s| state.pending_non_executable_tasks = s.pending_non_executable_tasks s.called_generators.each do |g| state.non_scheduled_tasks.delete(g.task) state.called_generators << g end s.non_scheduled_tasks.each do |task, reports| reports.each do |report| unless state.non_scheduled_tasks[task].include?(report) state.non_scheduled_tasks[task] << report end end end s.actions.each do |task, reports| reports.each do |report| unless state.actions[task].include?(report) state.actions[task] << report end end end end state end |
#finalize_event(object, timestamp = nil) ⇒ Object
93 94 95 96 97 98 99 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 93 def finalize_event(object, = nil) # Don't do anything. Due to the nature of the plan replay # mechanisms, tasks that are already finalized can very well be # kept included in plans. That is something that would be caught # by the finalization paths in Plan object.clear_relations end |
#finalize_task(object, timestamp = nil) ⇒ Object
101 102 103 104 105 106 107 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 101 def finalize_task(object, = nil) # Don't do anything. Due to the nature of the plan replay # mechanisms, tasks that are already finalized can very well be # kept included in plans. That is something that would be caught # by the finalization paths in Plan object.clear_relations end |
#merge(plan) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/roby/droby/rebuilt_plan.rb', line 75 def merge(plan) super if plan.kind_of?(RebuiltPlan) finalized_tasks.merge(plan.finalized_tasks) finalized_events.merge(plan.finalized_events) garbaged_tasks.merge(plan.garbaged_tasks) garbaged_events.merge(plan.garbaged_events) called_generators.concat(plan.called_generators) emitted_events.concat(plan.emitted_events) propagated_events.concat(plan.propagated_events) failed_emissions.concat(plan.failed_emissions) failed_to_start.concat(plan.failed_to_start) propagated_exceptions.concat(plan.propagated_exceptions) scheduler_states.concat(plan.scheduler_states) end end |