class Proxy::Dynflow::Runner::Parent
Public Class Methods
new(targets = {}, suspended_action: nil, id: nil)
click to toggle source
targets = { identifier => { :execution_plan_id => “…”, :run_step_id => id,
:input => { ... } }
Calls superclass method
Proxy::Dynflow::Runner::Base::new
# File lib/smart_proxy_dynflow/runner/parent.rb, line 8 def initialize(targets = {}, suspended_action: nil, id: nil) @targets = targets @exit_statuses = {} super suspended_action: suspended_action, id: id end
Public Instance Methods
broadcast_data(data, type)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 38 def broadcast_data(data, type) @outputs.each_value { |output| output.add_output(data, type) } end
dispatch_exception(context, exception)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 50 def dispatch_exception(context, exception) @outputs.each_value { |output| output.add_exception(context, exception) } end
generate_updates()
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 14 def generate_updates base = {} base[@suspended_action] = Runner::Update.new(Proxy::Dynflow::ContinuousOutput.new, @exit_status) if @exit_status # Operate on all hosts if the main process ended or only on hosts for which we have updates @outputs.reject { |_, output| @exit_status.nil? && output.empty? } .reduce(base) do |acc, (identifier, output)| @outputs[identifier] = Proxy::Dynflow::ContinuousOutput.new # Create a new ContinuousOutput for next round of updates exit_status = @exit_statuses[identifier] || @exit_status if @exit_status acc.merge(host_action(identifier) => Runner::Update.new(output, exit_status)) end end
host_action(identifier)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 32 def host_action(identifier) options = @targets[identifier].slice('execution_plan_id', 'run_step_id') .merge(:world => Proxy::Dynflow::Core.world) Dynflow::Action::Suspended.new OpenStruct.new(options) end
initialize_continuous_outputs()
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 26 def initialize_continuous_outputs @outputs = @targets.keys.reduce({}) do |acc, target| acc.merge(target => Proxy::Dynflow::ContinuousOutput.new) end end
publish_data(_data, _type)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 42 def publish_data(_data, _type) true end
publish_data_for(identifier, data, type)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 46 def publish_data_for(identifier, data, type) @outputs[identifier].add_output(data, type) end
publish_exit_status_for(identifier, exit_status)
click to toggle source
# File lib/smart_proxy_dynflow/runner/parent.rb, line 54 def publish_exit_status_for(identifier, exit_status) @exit_statuses[identifier] = exit_status end