Class: ExecutionNode
Instance Attribute Summary collapse
-
#execution_instance ⇒ Object
Returns the value of attribute execution_instance.
Attributes inherited from Node
#after_list, #before_list, #code_block, #commands, #exec_block, #id, #is_concurrently, #is_safely, #name, #node_list, #parent
Instance Method Summary collapse
- #draw_block(graph) ⇒ Object
- #init_time ⇒ Object
-
#initialize(parent, block) ⇒ ExecutionNode
constructor
A new instance of ExecutionNode.
- #run(instance) ⇒ Object
Methods inherited from Node
#after_exec, #before_exec, #draw_after_blocks, #draw_before_blocks, #draw_child_nodes, #paint, #print_tree
Constructor Details
#initialize(parent, block) ⇒ ExecutionNode
Returns a new instance of ExecutionNode.
6 7 8 9 10 |
# File 'lib/tree_building/execution_node.rb', line 6 def initialize (parent, block) super(parent, block) self.execution_instance = execution_instance self.name = '[' + ExecutionNode.to_s + ']' end |
Instance Attribute Details
#execution_instance ⇒ Object
Returns the value of attribute execution_instance.
5 6 7 |
# File 'lib/tree_building/execution_node.rb', line 5 def execution_instance @execution_instance end |
Instance Method Details
#draw_block(graph) ⇒ Object
22 23 24 25 |
# File 'lib/tree_building/execution_node.rb', line 22 def draw_block(graph) graph.rect << graph.node(id) graph.node(id).label(name) end |
#init_time ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/tree_building/execution_node.rb', line 13 def init_time @total_time = { :name => @name, :before => 0, :exec => [], } end |
#run(instance) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tree_building/execution_node.rb', line 28 def run(instance) init_time start = Time.now commands.each_with_index do |command, index| _start = Time.now if instance.nil? or instance == 'localhost' puts `#{command}` else $virtual_machines[instance].invoke [[command]] end _finish = Time.now @total_time[:exec].push( {:cmd => command, :time => _finish - _start}) end finish = Time.now @total_time[:total] = finish - start @total_time end |