List all scheduled jobs in Sidekiq
scheduled_jobs = Sidekiq::ScheduledSet.new
scheduled_jobs.each do |job|
puts "Class: #{job.klass}, Arguments: #{job.args.inspect}, Job ID: #{job.jid}, Enqueue at: #{Time.at(job.at).to_s}"
end
List all enqueued jobs in Sidekiq
queues = Sidekiq::Queue.all
queues.each do |queue|
queue.each do |job|
puts "Class: #{job.klass}, Arguments: #{job.args.inspect}, Job ID: #{job.jid}"
end
end
List all running jobs in Sidekiq
workers = Sidekiq::Workers.new
workers.each do |process_id, thread_id, work|
puts "Process ID: #{process_id}, Thread ID: #{thread_id}, Job: #{work['payload']['class']}, Args: #{work['payload']['args'].inspect}"
end