Skip to content

Instantly share code, notes, and snippets.

@ak47
Created April 2, 2014 17:07
Show Gist options
  • Save ak47/9938498 to your computer and use it in GitHub Desktop.
Save ak47/9938498 to your computer and use it in GitHub Desktop.
Resque::Failure.all(Resque::Failure.count-5,5).each { |job| puts "#{job["exception"]} #{job["backtrace"]}" }
fail_counts = {}
Resque::Failure.all(0,Resque::Failure.count).each do |job|
if fail_counts[job['queue']]
fail_counts[job['queue']] += 1
else
fail_counts[job['queue']] = 1
end
end
p fail_counts
err_classes = {}
Resque::Failure.all(0,Resque::Failure.count).each do |job|
if job['queue'] == ''
if err_classes[job['payload']['class']]
err_classes[job['payload']['class']] += 1
else
err_classes[job['payload']['class']] = 1
end
end
end; nil
p err_classes
err_file = File.open('tmp/queue.fail.rb', 'w')
Resque::Failure.all(0,Resque::Failure.count).each do |job|
if job['queue'] == ''
err_file.puts job['payload']['class']
err_file.puts job['payload']['args']
err_file.puts job['error']
err_file.puts job['exception']
err_file.puts '-----------------'
end
end; nil
err_file.close
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment