[ruby/rails-noob]Trouble getting my delayed jobs to run..

286 views
Skip to first unread message

kimptoc

unread,
Aug 3, 2010, 5:41:38 AM8/3/10
to delayed_job
Hi,

I have installed delayed_job as a plugin, created the table migration,
run the db migration.

Added the call to "delay" my job and I can see an entry in the
delayed_job table.

But when I run "rake jobs:work" or "script/delayed_job run", I get
this error:

Job failed to load: allocator undefined for Proc. Try to manually
require the required file. Handler: "--- !ruby/
struct:Delayed::PerformableMethod \nobject: &id009 !ruby/
object:StatsController \n _headers: &id001 !
map:Rack::Utils::HeaderHash \n Cache-Control: no-cache\n _params:
&id006 !map:HashWithIndifferentAccess \n action: hack_

I am on Mac OSX 10.6.4, using Ruby 1.8.7, Rails 2.3.8 and latest
delayed_job (pulled it today).

Thanks in advance for any tips/advice.
Chris

lardawge

unread,
Aug 4, 2010, 5:38:15 PM8/4/10
to delayed_job
Can you post code of the method your trying to delay?

kimptoc

unread,
Aug 5, 2010, 12:46:34 PM8/5/10
to delayed_job
Hi,

This is the code (in my controller for now):

def hack_delayed_job_start
self.delay.doit
redirect_to :action => "index"
end

def doit
StationfullsHelper::grab_latest_csv
end

If I take out the "delay." - the "doit method successfully runs when I
call the action "hack_delayed_job_start", but if I use the delay, the
job gets queued up, but errors when run, as mentioned.

Thanks,
Chris

Brandon Keepers

unread,
Aug 5, 2010, 12:48:41 PM8/5/10
to delay...@googlegroups.com

On Aug 5, 2010, at 12:46 PM, kimptoc wrote:

> Hi,
>
> This is the code (in my controller for now):
>
> def hack_delayed_job_start
> self.delay.doit
> redirect_to :action => "index"
> end
>
> def doit
> StationfullsHelper::grab_latest_csv
> end
>
> If I take out the "delay." - the "doit method successfully runs when I
> call the action "hack_delayed_job_start", but if I use the delay, the
> job gets queued up, but errors when run, as mentioned.

Yeah, that won't work on a controller method.

Do this instead:

def hack_delayed_job_start
StationfullsHelper.delay.grab_latest_csv


redirect_to :action => "index"
end


=b

kimptoc

unread,
Aug 5, 2010, 4:43:27 PM8/5/10
to delayed_job
Perfect - that did the trick. Now to try and get http://github.com/ddollar/repeated_job
working with it :)

Thanks.
Reply all
Reply to author
Forward
0 new messages