Reputation: 3912
I am using resque to process some background jobs (like cron jobs). So I fire these two rake tasks:
$> rake resque:work
$> rake resque:scheduler
My question is how to find worker and scheduler are running? For worker I can use
Resque::Worker.all
lists all running workers. And it works fine. But I have not been able to find how to find scheduler is runnig or not (or list all scheduled jobs). I tried Resque::Scheduler.print_schedule
but that does not print schedules and always returns epmty hash even if I have run rake resque:scheduler
Upvotes: 3
Views: 1479
Reputation: 196
The method you need is
Resque.get_schedules
It displays a hash of currently scheduled jobs and their related metadata.
{
"job1"=> {
"every"=>"30s",
"class"=>"JobClass",
"args"=>[1],
"queue"=>"default",
"description"=> "Testing..."
}
}
If you aren't dynamically adding any jobs, i.e you aren't using the dynamic setting of resque-scheduler
Resque::Scheduler.dynamic = true
Then
Resque.schedule
will give you the same result.
Upvotes: 2
Reputation: 193
Am also searching for listing all the scheduled jobs...
Resque.count_all_scheduled_jobs
This displays the number only.
I tried a couple of methods in
Resque.metaclass.instance_methods-Class.methods
but no luck. Have to get into their Github source
Upvotes: 0