Class: Ddr::Batch::BatchProcessorJob

Inherits:
Object
  • Object
show all
Defined in:
app/jobs/ddr/batch/batch_processor_job.rb

Class Method Summary collapse

Class Method Details

.after_enqueue_set_status(batch_id, operator_id) ⇒ Object



14
15
16
17
18
# File 'app/jobs/ddr/batch/batch_processor_job.rb', line 14

def self.after_enqueue_set_status(batch_id, operator_id)
  batch = Batch.find(batch_id)
  batch.status = Batch::STATUS_QUEUED
  batch.save
end

.perform(batch_id, operator_id) ⇒ Object



5
6
7
8
9
10
11
12
# File 'app/jobs/ddr/batch/batch_processor_job.rb', line 5

def self.perform(batch_id, operator_id)
  ts = Time.now.strftime("%Y%m%d%H%M%S%L")
  logfile = "batch_processor_#{ts}_log.txt"
  batch = Batch.find(batch_id)
  operator = User.find(operator_id)
  bp = BatchProcessor.new(batch, operator, log_file: logfile)
  bp.execute
end