Method: Bolt::Transport::Base#batch_task_with

Defined in:
lib/bolt/transport/base.rb

#batch_task_with(targets, task, target_mapping, options = {}, position = [], &callback) ⇒ Object

Runs the given task on a batch of targets with variable parameters.

The default implementation only supports batches of size 1 and will fail otherwise.

Transports may override this method to implment their own batch processing.



108
109
110
111
112
113
114
115
116
117
# File 'lib/bolt/transport/base.rb', line 108

def batch_task_with(targets, task, target_mapping, options = {}, position = [], &callback)
  assert_batch_size_one("batch_task_with()", targets)
  target = targets.first
  arguments = target_mapping[target]

  with_events(target, callback, 'task', position) do
    @logger.debug { "Running task '#{task.name}' on #{target.safe_name} with '#{arguments.to_json}'" }
    run_task(target, task, arguments, options, position)
  end
end