resque 调度程序无法识别的信号 SIGUSR1
resque scheduler unrecognized signal SIGUSR1
我完全不知道如何 运行 我的 resque 调度程序。当我将单个任务排入队列并 运行 它手动工作时它工作正常但是当我尝试使用命令 rake resque:scheduler --trace 实现 resque 调度程序时,我得到 ArgumentError:不支持的信号 SIGUSR1。以下是 resque 调度程序所需的文件:
config/initializers/resque.rb
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'])
config/resque.yml
defaults: &defaults
host: localhost
port: 6379
db: 6
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
lib/tasks/resque.rake
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
config/resque_schedule.yml
run_my_job:
cron: '30 6 * * 1'
class: 'MyJob'
queue: myjob
args:
description: "Runs MyJob"
这里是 rake resque:scheduler 命令的错误消息:
error message
刚刚发现 Windows 不支持 SIGUSR1 信号。这是 Windows 中支持的信号 list。解决方案是使用另一个 OS 例如 Ubuntu 到 运行 操作并且它 运行 没有问题。
我完全不知道如何 运行 我的 resque 调度程序。当我将单个任务排入队列并 运行 它手动工作时它工作正常但是当我尝试使用命令 rake resque:scheduler --trace 实现 resque 调度程序时,我得到 ArgumentError:不支持的信号 SIGUSR1。以下是 resque 调度程序所需的文件:
config/initializers/resque.rb
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'])
config/resque.yml
defaults: &defaults
host: localhost
port: 6379
db: 6
development:
<<: *defaults
test:
<<: *defaults
staging:
<<: *defaults
production:
<<: *defaults
lib/tasks/resque.rake
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
config/resque_schedule.yml
run_my_job:
cron: '30 6 * * 1'
class: 'MyJob'
queue: myjob
args:
description: "Runs MyJob"
这里是 rake resque:scheduler 命令的错误消息: error message
刚刚发现 Windows 不支持 SIGUSR1 信号。这是 Windows 中支持的信号 list。解决方案是使用另一个 OS 例如 Ubuntu 到 运行 操作并且它 运行 没有问题。