Pry like debugger for Sidekiq?
Asked Answered
A

3

15

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?

Alumna answered 3/11, 2015 at 16:18 Comment(0)
A
15

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.

Alumna answered 2/5, 2017 at 12:52 Comment(0)
P
21

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)
Pulpiteer answered 3/11, 2015 at 17:7 Comment(1)
I have an instance where the timing of an async job is an issue and running it in the console does not give me the necessary environment to debug.Goddart
A
15

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.

Alumna answered 2/5, 2017 at 12:52 Comment(0)
L
0

You can use byebug but you have to require it inside the class definition of the job. For instance,

class SomeJob < ActiveJob::Base
  require 'byebug'
  
  def perform(*args)
    byebug
  end
end

then in your rails console run

SomeJob.perform_now(*args)

This will cause a breakpoint to appear where ever you have byebug called with your typical byebug prompt inside your rails console.

Lost answered 11/8, 2020 at 3:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.