2011-08-24 85 views
0

我正在尝试使用resque-scheduler gem来安排作业我安装了gem(V 2.0.0d)并且遵循了github上写的信息 这是我的resque.rake文件Resque-scheduler动态报告“计划清空”

# Resque tasks 
require 'resque/tasks' 
require 'resque_scheduler/tasks' 



namespace :resque do 
    task :setup do 
    require 'resque' 
    require 'resque_scheduler' 
    require 'resque/scheduler'  



# you probably already have this somewhere 
Resque.redis = 'localhost:6379' 

# 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("#{Rails.root}/config/resque_schedule.yml") 


# 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 



end 
end 

但我每次运行rake resque:scheduler时它说

进度表 附表空!设置Resque.schedule 时刻表加载

如果我删除Resque::Scheduler.dynamic = true日程被正确地加载,但我需要设置这个选项,因为随着时间的推移日程变化

+0

无法得到它的运行,但用另一种方式,我刚写的脚本来杀死调度过程,然后我每次更改文件时重新启动它,可能是这是不是最好的解决方案,但它的工作原理。 离开的问题开放,如果有人能够使它发挥作用。 – Khaled

回答