Class: Chimp::SerialExecutionGroup

Inherits:
ExecutionGroup show all
Defined in:
lib/right_chimp/queue/execution_group.rb

Overview

SerialExecutionGroup: run only one job at a time

Instance Attribute Summary

Attributes inherited from ExecutionGroup

#concurrency, #description, #group_id, #started, #time_end, #time_start

Instance Method Summary collapse

Methods inherited from ExecutionGroup

#cancel, #done?, #get_job, #get_job_ids, #get_jobs, #get_jobs_by_status, #get_total_exec_time, #initialize, #job_completed, #push, #queue, #requeue, #requeue_failed_jobs!, #reset!, #results, #running?, #set_jobs, #shift, #size, #sort!, #to_s

Constructor Details

This class inherits a constructor from Chimp::ExecutionGroup

Instance Method Details

#ready?Boolean

Returns:

  • (Boolean)


274
275
276
277
278
279
280
281
# File 'lib/right_chimp/queue/execution_group.rb', line 274

def ready?
  # Make sure only one thread makes the ready question at the same time,
  # otherwise we can run into race conditions. This is critical for SerialExecutionGroup
  ChimpDaemon.instance.semaphore.synchronize do
    ready = get_jobs_by_status(Executor::STATUS_RUNNING).size == 0 && get_jobs_by_status(Executor::STATUS_NONE).size > 0
    return ready
  end
end

#short_nameObject



283
284
285
# File 'lib/right_chimp/queue/execution_group.rb', line 283

def short_name
  'S'
end