class ForemanTasksCore::TaskLauncher::Batch
Public Instance Methods
launch!(input)
click to toggle source
# File lib/foreman_tasks_core/task_launcher/batch.rb, line 4 def launch!(input) trigger(nil, BatchAction, self, input) end
launch_children(parent, input_hash)
click to toggle source
# File lib/foreman_tasks_core/task_launcher/batch.rb, line 8 def launch_children(parent, input_hash) input_hash.each do |task_id, input| launcher = child_launcher(parent) launcher.launch!(transform_input(input)) results[task_id] = launcher.results end end
prepare_batch(input_hash)
click to toggle source
# File lib/foreman_tasks_core/task_launcher/batch.rb, line 16 def prepare_batch(input_hash) success_tasks = input_hash.select do |task_id, _input| results[task_id][:result] == 'success' end success_tasks.reduce({}) do |acc, (key, value)| acc.merge(results[key][:task_id] => value['action_input']['callback']) end end
Private Instance Methods
child_launcher(parent)
click to toggle source
# File lib/foreman_tasks_core/task_launcher/batch.rb, line 27 def child_launcher(parent) Single.new(world, callback, :parent => parent) end
transform_input(input)
click to toggle source
Identity by default
# File lib/foreman_tasks_core/task_launcher/batch.rb, line 32 def transform_input(input) input end