Module: RocketJob::Batch::StateMachine

Extended by:
ActiveSupport::Concern
Included in:
RocketJob::Batch
Defined in:
lib/rocket_job/batch/state_machine.rb

Overview

State machine for sliced jobs

Instance Method Summary collapse

Instance Method Details

#cleanup!Object

Drop the input and output collections



49
50
51
52
# File 'lib/rocket_job/batch/state_machine.rb', line 49

def cleanup!
  input_categories.each { |category| input(category).drop }
  output_categories.each { |category| output(category).drop }
end

#pausable?Boolean

A batch job can only be processed:

  • Whilst Queued (before processing).

  • During processing.

I.e. Not during before_batch and after_batch.

Returns:

  • (Boolean)


59
60
61
# File 'lib/rocket_job/batch/state_machine.rb', line 59

def pausable?
  queued? || paused? || (running? && (sub_state == :processing))
end