class Blender::Driver::SerfAsync
Public Class Methods
new(config = {})
click to toggle source
Calls superclass method
# File lib/blender/drivers/serf_async.rb, line 28 def initialize(config = {}) super @driver = Blender::Driver::Serf.new(config) end
Public Instance Methods
execute(tasks, hosts)
click to toggle source
# File lib/blender/drivers/serf_async.rb, line 33 def execute(tasks, hosts) Log.debug("Serf Async query on #{@driver.filter_by}s [#{hosts.inspect}]") tasks.each do |task| retry_options = task.metadata[:retry_options] hosts.each_slice(@driver.concurrency) do |nodes| Blender::Log.debug("Start query: #{task.start_query.inspect}") start = @driver.run_command(task.start_query.command, nodes) if start.exitstatus != 0 and !task.metadata[:ignore_failure] raise ExecutionFailed, start.stderr end Blender::Log.debug("Using check retry options:#{retry_options}") Retriable.retriable(retry_options) do cmd = @driver.run_command(task.check_query.command, nodes) if cmd.exitstatus != 0 and !task.metadata[:ignore_failure] raise ExecutionFailed, cmd.stderr end end cmd = @driver.run_command(task.reap_query.command, nodes) if cmd.exitstatus != 0 and !task.metadata[:ignore_failure] raise ExecutionFailed, cmd.stderr end end end end