2012-08-23 2 views
2

신으로부터 resque worker를 실행하는 데 문제가 있습니다. 최대 : 나는 하나님을 시작할 때resque worker가 시작되었음을 인식하지 못합니다.

다음은 근로자가 작업하는 동안, 다 잘 보이는, 그리고 모든 전환을 실행, 내 신 설정

num_workers = 9 
queue  = '*' 
current_path = "/u/apps/narg/current" 

God.pid_file_directory = "/u/apps/narg/current/tmp/pids" 
num_workers.times do |num| 
    God.watch do |w| 
    w.name  = "resque-#{num}" 
    w.group = "resque_all" 
    w.interval = 30.seconds 
    w.env  = {"QUEUE"=>queue, "RAILS_ENV"=>"production", 
      'PIDFILE' => "#{current_path}/tmp/pids/#{w.name}.pid" } 
w.start = "cd #{current_path} ; bundle exec rake environment resque:work" 
w.log  = "#{current_path}/log/god-#{w.name}.log" 
w.pid_file = "#{current_path}/tmp/pids/#{w.name}.pid" 
w.uid = 'root' 
w.gid = 'root' 
w.behavior(:clean_pid_file) 
# retart if memory gets too high 
w.transition(:up, :restart) do |on| 
    on.condition(:memory_usage) do |c| 
    c.above = 150.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 
    c.interval = 5 
    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 

입니다.

그러나 작업자가 실행 중이 지 않으면 시작한 후에 작업을 중단합니다. 노동자들이 실제로 시작 됐고, pid 파일도 정확합니다. 오직 신만 이해하지 못합니다 :

** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 move 'unmonitored' to 'init' 
** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 moved 'unmonitored' to 'init' 
** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 [trigger] process is not running (ProcessRunning) 
** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 move 'init' to 'start' 
** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 before_start: deleted pid 
** [out :: narg-wrk02] I [2012-08-23 11:40:48] INFO: resque-7 start: cd /u/apps/narg/current ; bundle exec rake environment resque:work 

앞에서 말했듯이, 작업자는 시작되어 잘 돌아갑니다. 또한 pid 파일에 올바른 pid가 있습니다.

지금은에 실행중인 근로자는 미세 및 전환 인식을 신을 죽이고 다시 시작하면 : 최대 ..

어떤 아이디어 또는 포인터를?

답변

0

보십시오 이것은 나를 위해 같은 문제를 해결

w.start = "cd #{current_path} ; bundle exec rake environment resque:work"

w.start = "cd #{current_path} ; bundle exec rake environment resque:work &"

에 변경.

w.start = "cd #{current_path} && rake environment RAILS_ENV=production resque:work &" 
:
0

나는과 같은 문제를 해결
관련 문제