class Proxy::Dynflow::Action::Runner
Public Instance Methods
failed_run?()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 81 def failed_run? output[:exit_status] != 0 end
finalize()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 30 def finalize # To mark the task as a whole as failed error! 'Script execution failed' if on_proxy? && failed_run? end
finish_run(update)
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 58 def finish_run(update) output[:exit_status] = update.exit_status output[:result] = output_result end
init_run()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 43 def init_run output[:result] = [] output[:runner_id] = runner_dispatcher.start(suspended_action, initiate_runner) suspend end
initiate_runner()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 39 def initiate_runner raise NotImplementedError end
kill_run()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 53 def kill_run runner_dispatcher.kill(output[:runner_id]) suspend end
output_result()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 85 def output_result (stored_output_chunks + (@pending_output_chunks || [])).map { |c| c[:chunk] }.reduce([], &:concat) end
poll()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 77 def poll runner_dispatcher.refresh_output(output[:runner_id]) end
process_external_event(event)
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 63 def process_external_event(event) runner_dispatcher.external_event(output[:runner_id], event) suspend end
process_update(update)
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 68 def process_update(update) output_chunk(update.continuous_output.raw_outputs) unless update.continuous_output.raw_outputs.empty? if update.exit_status finish_run(update) else suspend end end
rescue_strategy_for_self()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 35 def rescue_strategy_for_self ::Dynflow::Action::Rescue::Fail end
run(event = nil)
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 9 def run(event = nil) case event when nil init_run when Proxy::Dynflow::Runner::Update process_update(event) when Proxy::Dynflow::Runner::ExternalEvent process_external_event(event) when ::Dynflow::Action::Cancellable::Cancel kill_run when ::Proxy::Dynflow::Action::WithExternalPolling::Poll poll suspend else raise "Unexpected event #{event.inspect}" end rescue => e action_logger.error(e) process_update(Proxy::Dynflow::Runner::Update.encode_exception('Proxy error', e)) end
runner_dispatcher()
click to toggle source
# File lib/smart_proxy_dynflow/action/runner.rb, line 49 def runner_dispatcher Proxy::Dynflow::Runner::Dispatcher.instance end