Jobs with Resque gives "Don't know how to build task 'jobs:work'" on Heroku

highBandWidth picture highBandWidth · Feb 9, 2013 · Viewed 7.4k times · Source

I followed the tutorial at https://devcenter.heroku.com/articles/queuing-ruby-resque to queue and run background jobs in a Rails app. After queueing the jobs, it doesn't seem to run any of the jobs since in the console I can see the job has not been processed

>Resque.info
=> {:pending=>1, :processed=>0, :queues=>1, :workers=>0, :working=>0, :failed=>0, :servers=>["redis://dory.redistogo.com:9826/0"], :environment=>"production"}

If I try to do (locally)

bundle exec rake jobs:work

I get

rake aborted!
Don't know how to build task 'jobs:work'

On heroku, if I try

heroku run rake jobs:work

I again get `Don't know how to build task'

In my Rakefile, I have require 'resque/tasks' and in my Procfile I have

resque: env TERM_CHILD=1 bundle exec rake jobs:work
resque: env TERM_CHILD=1 bundle exec rake jobs:work

I have the Resque and redis gems in my Gemfile, but not delayed_job.

Update: Here is my Rakefile:

#!/usr/bin/env rake
require File.expand_path('../config/application', __FILE__)
Guard::Application.load_tasks

/lib/tasks is empty. I have a worker in app/workers that I am enqueueing in a controller.

Answer

Jon Mountjoy picture Jon Mountjoy · Feb 9, 2013

This doesn't appear to have anything to do with Heroku, if it doesn't work locally. You'll have to reveal some of your source to help people help you. For example, what's your Rakefile look like? The demo app in that article defines one with a Rake task with the task. Have you defined your rake task and added the appropriate gem references?