首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Resque装载工作,但不满足要求

Resque装载工作,但不满足要求
EN

Stack Overflow用户
提问于 2017-04-14 07:31:03
回答 1查看 436关注 0票数 0

我有一个时间表,它在resque.rake中定义如下:

代码语言:javascript
复制
require 'resque/tasks'
require 'resque/scheduler/tasks'
task 'resque:setup' => :environment



namespace :resque do
  task :setup do
    require 'resque'
    Resque.redis = 'localhost:6379'


  end

  task :setup_schedule => :setup do
    require 'resque-scheduler'
    ENV['RAILS_ENV'] = Rails.env
    Resque.schedule = YAML.load_file('config/tweet_schedule.yml')
    require 'tweet_sender.rb'
    end

task :scheduler => :setup_schedule


end

班吉莱勒tweet_schedule.yml

代码语言:javascript
复制
tweet_sender:
  cron: "57 7 * * *"
  class: "TweetSender"
  queue: tweets_queue
  args: tweet_id
  rails_env: development
  description: "This job sends daily tweets from the content db"

每当我运行(和redis-server,rails的,加载工人通过)。

代码语言:javascript
复制
bundle exec rake resque:work QUEUE='*' --trace

)

包exec rake环境resque:调度器,我得到以下输出

代码语言:javascript
复制
resque-scheduler: [INFO] 2017-04-14T09:14:49+02:00: Starting
resque-scheduler: [INFO] 2017-04-14T09:14:49+02:00: Loading Schedule
resque-scheduler: [INFO] 2017-04-14T09:14:49+02:00: Scheduling tweet_sender 
resque-scheduler: [INFO] 2017-04-14T09:14:49+02:00: Schedules Loaded
Passing 'info' command to redis as is; administrative commands cannot be effectively namespaced and should be called on the redis connection directly; passthrough has been deprecated and will be removed in redis-namespace 2.0 (at sucesfully/home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/resque-1.27.2/lib/resque/data_store.rb:60:in `method_missing')
Passing 'script' command to redis as is; administrative commands cannot be effectively namespaced and should be called on the redis connection directly; passthrough has been deprecated and will be removed in redis-namespace 2.0 (at /home/jan/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/resque-1.27.2/lib/resque/data_store.rb:60:in `method_missing')

因此,我假设它正在加载我的schedusucesfullyle,但是看起来它没有被查询(到目前为止,我忽略了名称空间警告)。

该计划显示在resque-调度程序web中,每当我通过web接口按钮手动设置它时,作业就会成功执行。任何ide为什么没有正确加载?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-22 07:24:41

因此,在经过大量的尝试之后,我发现重新调度程序并没有得到我的cron定义。

将5* cron更改为6*cron之后

代码语言:javascript
复制
5* cron cron: "57 7 * * *"
5* cron cron: "15 57 7 * * *"

这项工作现在每小时排定一次。由于标准cron语法似乎不起作用,我还没有弄清楚每天如何安排任务。

代码语言:javascript
复制
minute (0-59),
|      hour (0-23),
|      |       day of the month (1-31),
|      |       |       month of the year (1-12),
|      |       |       |       day of the week (0-6 with 0=Sunday).
|      |       |       |       |       command
0      2       *       *       0,4   
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43407183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档