Class: ActiveBatch::BatchSchedulerJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- ActiveBatch::BatchSchedulerJob
- Defined in:
- app/jobs/active_batch/batch_scheduler_job.rb
Instance Method Summary collapse
Instance Method Details
#perform(job_class, *args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'app/jobs/active_batch/batch_scheduler_job.rb', line 9 def perform(job_class, *args) batch = Batch.create(job_class: job_class.constantize, job_id: job_id, arguments: args) batch.job.each_work_unit(*args) do |*work_unit_args| work_unit_job = batch.job.new(*work_unit_args) batch.work_units.create(job_id: work_unit_job.job_id, arguments: work_unit_args) work_unit_job.enqueue end BatchStatusCheckJob.perform_later(batch) self end |