I'm interested in returning a list of scheduled and active jobs running for a batch. For active jobs, there's no bid to link that back with the batches. Is there any way to know the relationship as the sidekiq ui does show JIDs for the batch. Or if possible, is there anyway to get scheduled/active jobs through a batch like batch.active_jobs && batch.pending_jobs
I've tried looking at the documentation for sidekiq, but have not found a solution to whether if this is possible.
https://www.rubydoc.info/github/mperham/sidekiq/Sidekiq/Workers https://github.com/mperham/sidekiq/wiki/Best-Practices
To get the batch I need:
batch_statuses = Sidekiq::BatchSet.new
batches = batch_statuses.select{|batch_status| status.callbacks["complete"].first.keys.first.include?("my_batch")}
scheduled jobs for the batch:
scheduled_jobs = Sidekiq::ScheduledSet.new
scheduled_jobs = scheduled_jobs.select{|job| job.item["bid"] == batches.first.id}
active jobs:
active_jobs = Sidekiq::Queue.new
# active_jobs_for_batch