resque scheduler无法识别的信号SIGUSR1

时间:2015-12-20 12:50:40

标签: ruby-on-rails resque resque-scheduler

我完全不知道如何运行我的resque调度程序。当我将一个任务排队并手动运行它工作正常但当我尝试使用命令rake resque实现resque调度程序时:scheduler --trace,我得到ArgumentError:不支持的信号SIGUSR1。以下是resque调度程序所需的文件:

配置/初始化/ 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'])

配置/ resque.yml

defaults: &defaults
  host: localhost
  port: 6379
  db: 6
development:
  <<: *defaults
test:
  <<: *defaults
staging:
  <<: *defaults
production:
  <<: *defaults

的lib /任务/ 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

配置/ resque_schedule.yml

run_my_job:
  cron: '30 6 * * 1'
  class: 'MyJob'
  queue: myjob
  args:
  description: "Runs MyJob"

以下是rake resque:scheduler命令的错误消息: error message

1 个答案:

答案 0 :(得分:2)

刚刚发现Windows不支持SIGUSR1信号。这是Windows中list支持的信号。解决方案是使用另一个操作系统(如Ubuntu)来运行操作,它运行没有问题。