Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

does Delayed_job daemon not run in development?

I'm using delayed_job and I am able to run jobs using rake jobs:work but using the daemonized version, it does nothing although I see it in the process list.

I'm using:

  • rails (3.0.9)
  • delayed_job (2.1.4)
  • daemons (1.0.10)

I'm running delayed_job using:

unix>RAILS_ENV=development script/delayed_job start
like image 695
Aditya Avatar asked Nov 05 '11 16:11

Aditya


2 Answers

It could be a problem loading a custom job class file. To test that, try this:

  • Enter the rails console rails console --sandbox.
  • Make sure you have a job in the table job = Delayed::Job.first.
  • Try YAML.load(job.handler). If you get an error that looks like this: ArgumentError: undefined class/module MyCustomClass, it's probably a problem loading your custom job
  • Still in the rails console, run require 'My_Custom_Class. Then run the YAML.load(job.handler) command again. If this returns the appropriate object it's definitely a class loading problem.

To fix the problem create the file config/initializers/custom.rb and in it put require 'My_Custom_Class'.

You should then be able to run rake jobs::workoff and get something that looks like this:

[Worker(host:my.host pid:5085)] Starting job worker
[Worker(host:my.host pid:5085)] MyCustomJob completed after 0.0774
[Worker(host:my.host pid:5085)] 1 jobs processed at 9.1935 j/s, 0 failed ...
[Worker(host:my.host pid:5085)] No more jobs available. Exiting
like image 149
Gray Kemmey Avatar answered Nov 17 '22 00:11

Gray Kemmey


To answer your question we may need more information.

Are jobs added to database? Are there any errors in jobs?

What's the result of RAILS_ENV=development script/delayed_job status as I already mentioned?

Second, did you went through the most common problems Wiki page?

https://github.com/collectiveidea/delayed_job/wiki/Common-problems

like image 41
Ernest Avatar answered Nov 17 '22 00:11

Ernest