4

I'm looking for a command to start a worker process so that inside of the job's perform method I can call debugger and have control thrown to the command prompt.

James
  • 5,273
  • 10
  • 51
  • 76
  • Do you use any IDEs? How do you set breakpoints now? – Zepplock Mar 04 '13 at 02:22
  • If you call 'debugger' in your ruby code it's treated as a breakpoint. – James Mar 04 '13 at 02:23
  • What about running the task outside of Resque? – mathieugagne Mar 04 '13 at 02:49
  • It's really annoying to do with the way the code is structured – James Mar 04 '13 at 02:51
  • @James I not sure debugger would be ever halt for a `fork` process I tried it number of time without any luck but I know for sure `pry` would work the way u need I tested it against passenger spawner and it gave the desired output that u r looking for – Viren Mar 04 '13 at 06:26
  • I will give pry a try!!!!!!!! Thanks. FWIW I have had the debugger halt for the forked process. I can't remember the command I used to start the worker process... – James Mar 04 '13 at 07:38
  • Pry solved it. Thank you sir – James Mar 04 '13 at 10:55

3 Answers3

2

instead of calling Resque.enqueue(Archive, self.id, branch) (from the resque readme), I think you should be able to call Archive.perform(self.id, branch). Doing this, you should be able to use debugger inside the worker.

jvnill
  • 29,479
  • 4
  • 83
  • 86
2

Add the following line to your rails app Resque.inline = true this causes the resque jobs not be enqueued but to be executed immediately

kristok
  • 152
  • 1
  • 6
0

I ended up using pry instead of ruby-debugger. Works like a charm. Practically an Irish charm!

James
  • 5,273
  • 10
  • 51
  • 76
  • 3
    Can you tell me how you pry it? I have a resque error on production, I know where it's coming from, but I don't know how to pry into it. Do you use pry-rails? If so, does that mean you have to commit new code to production to use it? – Ka Mok Sep 30 '16 at 01:04