Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pry like debugger for Sidekiq?

I've tried pry and remote-pry, but no luck. I'm familiar with logging, but I want to be able to step thru my code and look at variables.

Does anyone know of anything I can use to debug Sidekiq?

like image 969
ToddT Avatar asked Nov 03 '15 16:11

ToddT


People also ask

How do I debug with pry?

Invoking pry debugging To invoke the debugger, place binding. pry somewhere in your code. When the Ruby interpreter hits that code, execution stops, and you can type in commands to debug the state of the program.

How do I view Sidekiq logs?

Check in /var/log/gitlab/sidekiq/current or $GITLAB_HOME/log/sidekiq. log for the backtrace output. The backtraces are lengthy and generally start with several WARN level messages.

How do I run Sidekiq worker from console?

To run sidekiq, you will need to open a terminal, navigate to your application's directory, and start the sidekiq process, exactly as you would start a web server for the application itself. When the command executes you will see a message that sidekiq has started.


2 Answers

The best thing I've come up with is this gem gem 'pry-remote' it works great and stops all processes from running. And it works like pry just put in binding.remote_pry and you've got a stopping point.

like image 87
ToddT Avatar answered Oct 13 '22 15:10

ToddT


Workers are designed to be trivial to run. Put pry in your worker code and run it in the rails console.

> MyWorker.new.perform(some_args)
like image 40
Mike Perham Avatar answered Oct 13 '22 14:10

Mike Perham