I have absolutely no idea how to run my resque scheduler. When i enqueue a single task and run it manually it works fine but when i try to implement resque scheduler using the command rake resque:scheduler --trace, i get ArgumentError: unsupported signal SIGUSR1. Below are the files needed for resque scheduler:
require 'resque/failure/multiple'
require 'resque/failure/redis'
Resque::Failure::Multiple.classes = [Resque::Failure::Redis]
Resque::Failure.backend = Resque::Failure::Multiple
Dir[File.join(Rails.root, 'app', 'jobs', '*.rb')].each { |file| require file }
config = YAML.load(File.open("#{Rails.root}/config/resque.yml"))[Rails.env]
Resque.redis = Redis.new(host: config['host'], port: config['port'], db: config['db'])
defaults: &defaults
host: localhost
port: 6379
db: 6
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
require 'resque/tasks'
require 'resque/scheduler/tasks'
require 'yaml'
task 'resque:setup' => :environment
namespace :resque do
task :setup_schedule => :setup do
require 'resque-scheduler'
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
# Resque::Scheduler.dynamic = true
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
Resque.schedule = YAML.load_file(File.open("#{Rails.root}/config/resque_schedule.yml"))
end
task :scheduler => :setup_schedule
end
run_my_job:
cron: '30 6 * * 1'
class: 'MyJob'
queue: myjob
args:
description: "Runs MyJob"
Here's the error message for the rake resque:scheduler command: error message
just found out that Windows doesn't support the SIGUSR1 signal. Here's a list of supported signals in Windows. The solution will be to use another OS such as Ubuntu to run the operation and it runs with no problems.