Is there an easy way to search through all of sidekiq (queues, retries, schedules, etc) for a specific job?
Currently I'm doing this:
if !Sidekiq::Queue.new("feeds").find {|j| j.args[0] == feed.id && j.args[1] == true }
if !Sidekiq::RetrySet.new.find {|j| j.queue == 'feeds' && j.args[0] == feed.id && j.args[1] == true }
if !Sidekiq::ScheduledSet.new.find {|j| j.queue == 'feeds' && j.args[0] == feed.id && j.args[1] == true }
feed.sync
end
end
end
But given how large queues can get, there's a chance the job could move between sets during the iteration and get missed.
Sidekiq server process pulls jobs from the queue in Redis and processes them. Like your web processes, Sidekiq boots Rails so your jobs and workers have the full Rails API, including Active Record, available for use. The server will instantiate the worker and call perform with the given arguments.
You can just use direct Sidekiq jobs when you need the improved performance and bulk-enqueing. If your workload is light, or you are early on in your project, you might not need Sidekiq (or at least its Redis dependancy) at all.
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.
To test your Sidekiq Worker jobs array, run WorkerNameHere.jobs in terminal and see if it contains your job with your jid. If it does, then it was enqueued in Sidekiq to be run as a job.
Each node runs 8 sidekiq worker processes. Each sidekiq worker process has a concurrency of 15, meaning that 15 sidekiq jobs can be processed in parallel.
Seems like you want to know your job's status at some moment after spawning it, also you keep its id. There are a couple of plugins exactly for that, they have similar functionality and virtually the same name:
Sidekiq::Status - I was its original author, now it's supported by more apt Ruby developers
SidekiqStatus - an alternative
[edit] the above may be outdated by now, just check Sidekiq's wiki to find queue/status management that suits you best: https://github.com/mperham/sidekiq/wiki/Related-Projects
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With