lib/right_chimp/exec/Executor.rb in right_chimp-2.1.26 vs lib/right_chimp/exec/Executor.rb in right_chimp-2.1.27

- old
+ new

@@ -2,11 +2,11 @@ # Superclass for Executors-- objects that run things on servers # module Chimp class Executor - attr_accessor :server, :array, :exec, :inputs, :template, :owner, :group, :delay, + attr_accessor :server, :array, :exec, :inputs, :template, :owner, :group, :delay, :concurrency, :job_id, :job_uuid, :job_notes, :status, :dry_run, :verbose, :quiet, :timeout, :retry_count, :retry_sleep, :time_start, :time_end, :error attr_reader :results @@ -35,10 +35,11 @@ @retry_count = h[:retry_count].to_i || 0 @retry_sleep = h[:retry_sleep].to_i || 30 @timeout = h[:timeout].to_i || 3600 @delay = h[:delay].to_i || 0 + @concurrency = h[:concurrency].to_i @error = nil @status = STATUS_NONE @owner = nil @dry_run = false @@ -106,10 +107,10 @@ # def run_with_retry(&block) Log.debug "Running job '#{@job_id}' with status '#{@status}'" # If we are not the first job in this group, wait @delay ChimpDaemon.instance.semaphore.synchronize do - if @group.started >= ChimpQueue.instance.max_threads && @delay.nonzero? + if @group.started >= @concurrency && @delay.nonzero? Log.info "[#{@job_uuid}] Sleeping #{@delay} seconds between tasks" sleep @delay end @group.started += 1 end