Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Starting resque workers while started development server

I want to start my workers when I start my development server to test the a new cron job I have in my resque scheduler, so I run this command when starting dev server-

QUEUE=* rake environment resque:work rails s

it has worked for me before and if I'm reading their documentation correctly should still work.

But I'm getting the following error after I interrupt it after it gets hung up-

^Crake aborted!
Don't know how to build task 'rails'

here is what I get after keyboard interrupt and running it with --trace

** Invoke environment (first_time)
** Execute environment
** Invoke resque:work (first_time)
** Invoke resque:preload (first_time)
** Invoke resque:setup (first_time)
** Invoke environment
** Execute resque:setup
** Execute resque:preload
** Invoke resque:setup
** Execute resque:work
^Crake aborted!
Don't know how to build task 'rails'

I don't understand why I would be getting the error and additionally why it previously loaded and worked but not anymore. What am I missing here?

like image 839
computer_smile Avatar asked Jul 18 '26 17:07

computer_smile


2 Answers

Are you sure that you manage to run this command sometime back successfully

QUEUE=* rake environment resque:work rails s

because the way I know rails s is a list of rails command not a rake task

you can run consecutive rake separating spaces like

QUEUE=* rake environment rake1 rake2 rake3

but you cant run a rake and rails command they way you mention above

what I see from your trace above that rake(resque rake) is running now instead of passing a second rake you specified a rails command to start the server rake is considering that as rake task (which is not true)

I believe you are looking for this

QUEUE=* rake environment resque:work && rails s

But I dont believe that what you have mention would ever work please let me know if something conflict over here

Hope It make sense

like image 158
Viren Avatar answered Jul 20 '26 09:07

Viren


This is better:

BACKGROUND=yes QUEUE=* PIDFILE=./tmp/resque.pid bundle exec rake environment resque:work

Then:

rails s

If you need stop resque worker:

kill -QUIT $(cat ./tmp/resque.pid)
like image 27
fabiosammy Avatar answered Jul 20 '26 09:07

fabiosammy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!