Dave
Dave

Reputation: 11862

Heroku scheduler: Any ideas on how to debug?

I'm trying to move to the Heroku Scheduler addon, (blog post: http://blog.heroku.com/archives/2011/11/12/heroku_scheduler_add_on_now_available/ , dev centre: http://devcenter.heroku.com/articles/scheduler )

Rails 3.1 app. I setup the scheduler.rake file in lib/tasks and if I run:

heroku rake processtats_main

my process runs perfectly.

In the scheduler addon dashboard I've added

rake processtats_main

and set it to 10 minutes (normally it would be an hourly run task but this is just for testing), and in the web ui it's updating with the last run time every ten minutes but it's not running the task, or running the task is failing in some way.

I can't run it hitting the 'Run' button, it suggests I do it via the command line (is that by running the heroku rake command above? Because that works fine). Frustratingly, after I refresh the page after the failed 'run' click, the Last run time updates. The last run time will update if you setup a task called 'diofgjsfdoigjsdi' and click run, presumably because the scheduler can be used to execute any kind of command, so it's making an attempt. But nothing gets logged for failure, so if I think I have my syntax correct, I'm not sure how to debug.

There is no task output on the dashboard.

There is nothing in the logs to indicate any worker processes or anything else. There is no log activity at all. (Not a live app, so if I don't access it, it's unlikely anyone anywhere will.) My rake task looks like this:

task :processtats_main => :environment do
    puts "Begin Widget.statsUpdate(1)"
         Widget.statsUpdate(1)
    puts "Widget.statsUpdate(1) done."
end

So it should throw at least the 'puts' messaging into the logs at the very least.

I disabled the cron addon just in case that was interfering in some way.

If I run heroku ps I see no processes related to my jobs.

Any ideas? I'm just not seeing anything obvious to attempt next.

Upvotes: 1

Views: 3732

Answers (1)

John Beynon
John Beynon

Reputation: 37507

I've had exactly the same problem yesterday and logged it with Heroku, I've just received a response;

There was a bug in scheduler affecting some new users, preventing any jobs from being executed properly. Can you try it again?

Looking at my logs it definitely looks like it's working - except clicking RUN on the schedule page still errors but I have historical entries for jobs I would have expected to run showing now.

Upvotes: 2

Related Questions