Pergunta

On our Rails application, we use Resque to process background jobs (we also use Resque Scheduler and Resque Status).

We're getting jobs in the queue that aren't being processed, however I can't see any details about them.

If I use redis-cli - I can pull up job details:

get "resque:status:bd2209c9......"

Which will show the timestamp, what queue it's in, it's uuid and any parameters, but not the class name. If I do the same on a job that has been run, then I can see the class name, messages etc.

So is there a way that I can find the class name for a job that is waiting to be run.

Thanks.

Foi útil?

Solução

So after some digging:

  • All of the Resque jobs are sitting in a Redis list for each queue
  • There isn't really a way of getting at the elements of the list using their uuid

Although you can look at the entire list (or a subset):

# This works for Resque 1.25.0
Resque.redis.lrange('queue:QUEUE_NAME', 0, -1)

Which will return an array of strings (encoded JSON). To decode the first item:

job = Resque.redis.lrange('queue:QUEUE_NAME', 0, 0).first
h = Resque.decode(job)

Which will then give you a hash to play with, but looking at the list was enough to see the class name. It helped that the queue I was looking at was pretty small.

There may be a better way at finding this out, but this worked for me.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top