librelist archives

« back to archive

How to tuck in the ruby debugger inside the job

How to tuck in the ruby debugger inside the job

From:
Sachin Rai
Date:
2011-09-20 @ 05:36
Hi, I'm not being able to hook debugger inside the job.
I tried with the following approaches, but none of them worked.

1. Resque.inline = true
2. require 'ruby-debug' in the job class itself
3. QUEUE=* bundle exec rdebug resque:work --trace

How, can I hook the debugger inside the job class perform method??

Thanks.

Re: [resque] How to tuck in the ruby debugger inside the job

From:
Philippe Lafoucrière
Date:
2011-09-20 @ 06:08
On Tue, Sep 20, 2011 at 7:36 AM, Sachin Rai
<sachin@sprout-technology.com> wrote:
> Hi, I'm not being able to hook debugger inside the job.

If you just want to debug a job, and nothing internal to resque, you
can simply run an irb instance with debug option, and run
YourJob.perform :)

Re: [resque] How to tuck in the ruby debugger inside the job

From:
Sachin Rai
Date:
2011-09-20 @ 06:42
Since the perform takes multiple parameters, just running in the IRB doesn't
help coz I've to create many objects.
Its implemented inside a Rals3 app, so I need something within the same
rails process or rake resque:work process.



2011/9/20 Philippe Lafoucrière <philippe.lafoucriere@gmail.com>

> On Tue, Sep 20, 2011 at 7:36 AM, Sachin Rai
> <sachin@sprout-technology.com> wrote:
> > Hi, I'm not being able to hook debugger inside the job.
>
> If you just want to debug a job, and nothing internal to resque, you
> can simply run an irb instance with debug option, and run
> YourJob.perform :)
>

Re: [resque] How to tuck in the ruby debugger inside the job

From:
Philippe Lafoucrière
Date:
2011-09-20 @ 07:50
On Tue, Sep 20, 2011 at 8:42 AM, Sachin Rai
<sachin@sprout-technology.com> wrote:
> Since the perform takes multiple parameters, just running in the IRB doesn't
> help coz I've to create many objects.
> Its implemented inside a Rals3 app, so I need something within the same
> rails process or rake resque:work process.

Ok, so why rails console doesn't suit ? You can create your objects
(with factory_girl for example), and then perform your job.
If you don't want these changes to be persistent, you can rollback
them at exit with rails console --sandbox
Another debug alternative is to use pry.
Hope that helps

Re: [resque] How to tuck in the ruby debugger inside the job

From:
Sachin Rai
Date:
2011-09-20 @ 08:10
Thanks for your help.

~Sachin

2011/9/20 Philippe Lafoucrière <philippe.lafoucriere@gmail.com>

> On Tue, Sep 20, 2011 at 8:42 AM, Sachin Rai
> <sachin@sprout-technology.com> wrote:
> > Since the perform takes multiple parameters, just running in the IRB
> doesn't
> > help coz I've to create many objects.
> > Its implemented inside a Rals3 app, so I need something within the same
> > rails process or rake resque:work process.
>
> Ok, so why rails console doesn't suit ? You can create your objects
> (with factory_girl for example), and then perform your job.
> If you don't want these changes to be persistent, you can rollback
> them at exit with rails console --sandbox
> Another debug alternative is to use pry.
> Hope that helps
>