首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >resque工作进程在启动后不久退出,没有输出

resque工作进程在启动后不久退出,没有输出
EN

Stack Overflow用户
提问于 2014-02-05 03:35:27
回答 1查看 714关注 0票数 0

我正在尝试让resque在生产中工作。我有以下的上帝文件:

代码语言:javascript
复制
rails_env   = ENV['RAILS_ENV']  || "production"
rails_root  = ENV['RAILS_ROOT'] || "/home/rails/current"
num_workers = rails_env == 'production' ? 5 : 2

num_workers.times do |num|
  God.watch do |w|
    w.dir      = "#{rails_root}"
    w.name     = "resque-#{num}"
    w.group    = 'resque'
    w.interval = 30.seconds
    w.env      = {"QUEUE"=>"add_feed,update_all,update_feed", "RAILS_ENV"=>rails_env}
    w.start    = "rake -f #{rails_root}/Rakefile environment resque:work"
    w.log      = "#{rails_root}/log/#{w.name}.log"

    w.uid = 'rails'
    w.gid = 'rails'

    # restart if memory gets too high
    w.transition(:up, :restart) do |on|
      on.condition(:memory_usage) do |c|
        c.above = 350.megabytes
        c.times = 2
      end
    end

    # determine the state on startup
    w.transition(:init, { true => :up, false => :start }) do |on|
      on.condition(:process_running) do |c|
        c.running = true
      end
    end

    # determine when process has finished starting
    w.transition([:start, :restart], :up) do |on|
      on.condition(:process_running) do |c|
        c.running = true
        c.interval = 5.seconds
      end

      # failsafe
      on.condition(:tries) do |c|
        c.times = 5
        c.transition = :start
        c.interval = 5.seconds
      end
    end

    # start if process is not running
    w.transition(:up, :start) do |on|
      on.condition(:process_running) do |c|
        c.running = false
      end
    end
  end
end

但是,当我尝试运行上帝时,我得到了以下输出:

代码语言:javascript
复制
root@pocketrss:~# god -c /home/rails/current/config/resque.god -D
I [2014-02-04 19:33:23]  INFO: Loading /home/rails/current/config/resque.god
I [2014-02-04 19:33:23]  INFO: Syslog enabled.
I [2014-02-04 19:33:23]  INFO: Using pid file directory: /var/run/god
I [2014-02-04 19:33:24]  INFO: Started on drbunix:///tmp/god.17165.sock
I [2014-02-04 19:33:24]  INFO: resque-0 move 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-1 move 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-2 move 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-3 move 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-4 move 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-4 moved 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-3 moved 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-2 moved 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-1 moved 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-0 moved 'unmonitored' to 'init'
I [2014-02-04 19:33:24]  INFO: resque-0 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:24]  INFO: resque-0 move 'init' to 'start'
I [2014-02-04 19:33:24]  INFO: resque-0 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:24]  INFO: resque-2 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:24]  INFO: resque-1 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:24]  INFO: resque-3 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:24]  INFO: resque-4 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:24]  INFO: resque-1 move 'init' to 'start'
I [2014-02-04 19:33:24]  INFO: resque-4 move 'init' to 'start'
I [2014-02-04 19:33:24]  INFO: resque-3 move 'init' to 'up'
I [2014-02-04 19:33:24]  INFO: resque-4 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:24]  INFO: resque-2 move 'init' to 'up'
I [2014-02-04 19:33:24]  INFO: resque-3 moved 'init' to 'up'
I [2014-02-04 19:33:24]  INFO: resque-1 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:24]  INFO: resque-2 moved 'init' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-0 moved 'init' to 'start'
I [2014-02-04 19:33:25]  INFO: resque-0 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:25]  INFO: resque-0 move 'start' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-0 moved 'start' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-4 moved 'init' to 'start'
I [2014-02-04 19:33:25]  INFO: resque-4 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:25]  INFO: resque-4 move 'start' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-4 moved 'start' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-1 moved 'init' to 'start'
I [2014-02-04 19:33:25]  INFO: resque-1 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:25]  INFO: resque-1 move 'start' to 'up'
I [2014-02-04 19:33:25]  INFO: resque-1 moved 'start' to 'up'
I [2014-02-04 19:33:54]  INFO: resque-3 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:54]  INFO: resque-3 move 'up' to 'start'
I [2014-02-04 19:33:54]  INFO: resque-3 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:54]  INFO: resque-2 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:54]  INFO: resque-2 move 'up' to 'start'
I [2014-02-04 19:33:54]  INFO: resque-2 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:54]  INFO: resque-3 moved 'up' to 'start'
I [2014-02-04 19:33:54]  INFO: resque-3 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:54]  INFO: resque-3 move 'start' to 'up'
I [2014-02-04 19:33:54]  INFO: resque-3 moved 'start' to 'up'
I [2014-02-04 19:33:54]  INFO: resque-2 moved 'up' to 'start'
I [2014-02-04 19:33:54]  INFO: resque-2 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:54]  INFO: resque-2 move 'start' to 'up'
I [2014-02-04 19:33:54]  INFO: resque-2 moved 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-0 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-0 move 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-0 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:55]  INFO: resque-4 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-4 move 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-4 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:55]  INFO: resque-1 [trigger] process is not running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-1 move 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-1 start: rake -f /home/rails/current/Rakefile environment resque:work
I [2014-02-04 19:33:55]  INFO: resque-4 moved 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-4 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-4 move 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-4 moved 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-0 moved 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-0 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-0 move 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-0 moved 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-1 moved 'up' to 'start'
I [2014-02-04 19:33:55]  INFO: resque-1 [trigger] process is running (ProcessRunning)
I [2014-02-04 19:33:55]  INFO: resque-1 move 'start' to 'up'
I [2014-02-04 19:33:55]  INFO: resque-1 moved 'start' to ‘up'

基本上,resque每隔几秒钟就退出一次。我没有日志输出,没有错误,什么都没有。

EN

回答 1

Stack Overflow用户

发布于 2014-02-28 22:56:26

我在我的开发环境中遇到了同样的问题,运行

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

将直接退出到命令行。我不得不和VVERBOSE=1一起跑来搞清楚到底是怎么回事。对于我来说,我得到了以下错误:

代码语言:javascript
复制
Failed to start worker : #<NoMethodError: undefined method `auto_flushing=' for #<ActiveSupport::Logger:0x00000108908ab8>>

事实证明,在我们的项目中

代码语言:javascript
复制
Resque.before_first_fork = Proc.new { Rails.logger.auto_flushing = 1 }

在我们的resque.rake文件中的resque:setup任务中。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21561737

复制
相关文章

相似问题

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