queue_classic
Simple, efficient worker queue for Ruby & PostgreSQL.
is there a simple way to run a job once at a specific time in the future using queue_classic and clockwork, something like delayed_jobs
class.delay(run_at: 5.hours.from_now).method(param)
Source: (StackOverflow)
I would need a queue system with scheduling support for a Ruby on Rails application. This is scheduling a job to be run at a certain time. Also it could be modified to be run sooner or later, or removed from the queue.
I'm thinking of using Sidekiq, but as I'm using a PostgreSQL database I was looking at queue_classic, but it seems not to have scheduling support.
Which one is a simple system that can handle timers?
Source: (StackOverflow)
I am using queue_classic,
How can I send the following email using queue_classic?
Notifier.welcome(david).deliver # sends the email
UPDATE
I have added a new class method into User class
def.say_hello
puts "hello!"
Notifier.welcome(@david).deliver
end
QC.enqueue("puts", "hello world")
works fine,
but QC.enqueue("User.say_hello")
doesn't send email"
What could I do?
Source: (StackOverflow)
When I do
bundle exec rake qc:work
to run queue_calssic, I get this error
rake aborted!
PG::UndefinedColumn: ERROR: column "pid" does not exist
LINE 1: ..., locked_by = NULL WHERE locked_by NOT IN (SELECT pid FROM p...
^
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:18:in `exec'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:18:in `block in execute'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:14:in `synchronize'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/conn_adapter.rb:14:in `execute'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic.rb:104:in `unlock_jobs_of_dead_workers'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/worker.rb:42:in `start'
/home/andreas/.rvm/gems/ruby-2.1.1/gems/queue_classic-3.0.3/lib/queue_classic/tasks.rb:27:in `block (2 levels) in <top (required)>'
/home/andreas/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
/home/andreas/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => qc:work
When I do psql --version
i get psql (PostgreSQL) 9.3.5
Any ideas on what might be wrong?
Source: (StackOverflow)
I am using queue_classic for background jobs,
I need to monitor background jobs in production ie start, stop etc.
I found the similar question but it didn't help me
Also I found the god code:
but how would I stop, restart workers?
number_queues.times do |queue_num|
God.watch do |w|
w.name = "QC-#{queue_num}"
w.group = "QC"
w.interval = 5.minutes
w.start = "bundle exec rake queue:work" # This is your rake task to start QC listening
w.gid = 'nginx'
w.uid = 'nginx'
w.dir = rails_root
w.keepalive
w.env = {"RAILS_ENV" => rails_env}
w.log = "#{log_dir}/qc.stdout.log" # Or.... "#{log_dir}//qc-#{queue_num}.stdout.log"
# determine the state on startup
w.transition(:init, { true => :up, false => :start }) do |on|
on.condition(:process_running) do |c|
c.running = true
end
end
end
end
UPDATE
This code seems doesn't work
namespace :queue_classic do
desc "Start QC worker"
task :start, roles: :web do
run "cd #{release_path} && RAILS_ENV=production bundle exec rake qc:work"
end
after "deploy:restart", "queue_classic:restart"
end
Source: (StackOverflow)