Module: BatchProcessor::Batch::JobController
- Extended by:
- ActiveSupport::Concern
- Included in:
- BatchProcessor::BatchBase
- Defined in:
- lib/batch_processor/batch/job_controller.rb
Instance Method Summary collapse
- #job_canceled ⇒ Object
- #job_enqueued ⇒ Object
- #job_failure ⇒ Object
- #job_retried ⇒ Object
- #job_running ⇒ Object
- #job_success ⇒ Object
Instance Method Details
#job_canceled ⇒ Object
81 82 83 84 85 86 87 88 89 90 |
# File 'lib/batch_processor/batch/job_controller.rb', line 81 def job_canceled raise BatchProcessor::NotAbortedError unless aborted? run_callbacks(__method__) do details.pipelined do details.increment(:canceled_jobs_count) details.decrement(:pending_jobs_count) end end end |
#job_enqueued ⇒ Object
27 28 29 30 31 32 |
# File 'lib/batch_processor/batch/job_controller.rb', line 27 def job_enqueued raise BatchProcessor::AlreadyEnqueuedError if enqueued? raise BatchProcessor::NotProcessingError unless processing? run_callbacks(__method__) { details.increment(:enqueued_jobs_count) } end |
#job_failure ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/batch_processor/batch/job_controller.rb', line 69 def job_failure raise BatchProcessor::NotStartedError unless started? raise BatchProcessor::AlreadyFinishedError if finished? run_callbacks(__method__) do details.pipelined do details.increment(:failed_jobs_count) details.decrement(:running_jobs_count) end end end |
#job_retried ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/batch_processor/batch/job_controller.rb', line 45 def job_retried raise BatchProcessor::NotProcessingError unless processing? run_callbacks(__method__) do details.pipelined do details.increment(:total_retries_count) details.increment(:pending_jobs_count) details.decrement(:failed_jobs_count) end end end |
#job_running ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/batch_processor/batch/job_controller.rb', line 34 def job_running raise BatchProcessor::NotProcessingError unless processing? run_callbacks(__method__) do details.pipelined do details.increment(:running_jobs_count) details.decrement(:pending_jobs_count) end end end |
#job_success ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/batch_processor/batch/job_controller.rb', line 57 def job_success raise BatchProcessor::NotStartedError unless started? raise BatchProcessor::AlreadyFinishedError if finished? run_callbacks(__method__) do details.pipelined do details.increment(:successful_jobs_count) details.decrement(:running_jobs_count) end end end |