Class: Proxy::Dynflow::Action::Runner
Constant Summary
WithExternalPolling::Poll
Instance Method Summary
collapse
Methods inherited from Shareable
#plan
Instance Method Details
#failed_run? ⇒ Boolean
84
85
86
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 84
def failed_run?
output[:exit_status] != 0
end
|
#finalize ⇒ Object
32
33
34
35
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 32
def finalize
error! 'Script execution failed' if on_proxy? && failed_run?
end
|
#finish_run(update) ⇒ Object
60
61
62
63
64
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 60
def finish_run(update)
output[:exit_status] = update.exit_status
output[:result] = output_result
drop_output_chunks!
end
|
#init_run ⇒ Object
45
46
47
48
49
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 45
def init_run
output[:result] = []
output[:runner_id] = runner_dispatcher.start(suspended_action, initiate_runner)
suspend
end
|
#initiate_runner ⇒ Object
41
42
43
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 41
def initiate_runner
raise NotImplementedError
end
|
#kill_run ⇒ Object
55
56
57
58
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 55
def kill_run
runner_dispatcher.kill(output[:runner_id])
suspend
end
|
#output_result ⇒ Object
88
89
90
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 88
def output_result
(stored_output_chunks + (@pending_output_chunks || [])).map { |c| c[:chunk] }.reduce([], &:concat)
end
|
#poll ⇒ Object
80
81
82
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 80
def poll
runner_dispatcher.refresh_output(output[:runner_id])
end
|
#process_external_event(event) ⇒ Object
66
67
68
69
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 66
def process_external_event(event)
runner_dispatcher.external_event(output[:runner_id], event)
suspend
end
|
#process_update(update) ⇒ Object
71
72
73
74
75
76
77
78
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 71
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 ⇒ Object
37
38
39
|
# File 'lib/smart_proxy_dynflow/action/runner.rb', line 37
def rescue_strategy_for_self
::Dynflow::Action::Rescue::Fail
end
|
#run(event = nil) ⇒ Object
#runner_dispatcher ⇒ Object