ruby - How to stop God from leaving stale Resque worker processes? -


I am trying to understand how the rask worker should be monitored with God in such a way that God The stale worker will not leave the process.

In the following, I am talking about the worker process, not the job procedures (i.e. the queue is empty all the time).

When I start this kind of Rick Que employee manually:

  $ queue = builds rake resque: work   

I'll get the same process:

  $ ps x | Grape resque 7041 S001 S + 0: 05.04 resque-1.13.0:. Waiting for   

And as soon as this process goes away, I will stop working as a worker

But when I am with God The only thing (i.e., basically the same thing) will start ...

  $ RAILS_ENV = Development God-c config / resque.god -DI [2011- 03-27 22: 49:15] Info: config / resque.god I Loading [2011-03-27 22:49:15] Information: Syslog is enabled. I [2011-03-27 22:49:15] INFO: Using the PID file directory: /Volumes/Users/sven/.god/pids I [2011-03-27 22:49:15] INFO: Started on Drununes: ///tmp/god.17165.sock I [2011-03-27 22:49:15] Information: Take Resque-0 from 'Uncontrolled' to 'Init' I [2011-03 -27 22:49:15] Information: Resque-0 'unmonitored' moved to 'init' I [2011-03-27 22:49:15] Information: resque-0 [trigger] is not running (ProcessRunning) I [2011-03-27 22:49: 15] Information: resque-0 to 'start' the move 'init' I [2011-03-27 22:49:15] info: resque-0 Start: CD / S Processing / user / sven / development / projects / travis end; & Amp; Rake Rescue: Work I [2011-03-27 22:49:15] Information: resque-0 moved 'init' to 'start' I [2011-03-27 22:49:15] Information: Resque-0 [Trigger] Process Running (Processoring) I [2011-03-27 22:49:15] Info: Re-step Step 'up' to 'Start' I [2011-03-27 22: 49:15] Information: resque- 0 'moved' to 'start' I [2011-03-27 22:49:15] Information: resque-0 [OK] within the memory limit [784kb] (MemoryUase) I [2011-03-27 22:49: 15] Information: resque -0 [OK] Process Running (ProcessRunning) I [2011-03-27 22:49:45] info: resque -0 [fine] range [784kb, 784kb] Memory I within MemoryUsage [2011-03-27 22:49:45] Information: resque- 0 [OK] Process is going on (Processoring)   

Then I will get an additional process:

  $ ps x | Grep resque 7187 ?? SS 0: 00.02 CD-CD / Version / User / Sven / Development / Projects / Travis & amp; Rake Risk: work 7188 ?? S 0: 05.11 Resque-1.13.0: Waiting for makes 7183 S001 S + 0: 01.18 / Volumes/Users/sven/.rvm/rubies/ruby-1.8.7-p302/bin/ruby / Segment / users / sven /. RVM / Ratna / Rabbi-1.8.7-P302 / Bin / Dev -Ci Config / Rescue God-D   

God only logs the first pin:

<7> < Code> $ god stop resque dispatch The 'stop' command was influenced by the following clocks: resque-0

God gives this log output:

  I [2011-03-27 22:51:22] Information: resque-0 stop: Default Lambda killer I [2011-03-27 22:51:22] Information: resque-0 sent SIGTERM I [2011-03 -27 22: 51:23] Notice: resque-0 process stopped I [2011-03-27 22:51:23] info: resque-0 move 'up' to 'unmonitored' I [2011-03-27 22:51:23] Info: resque-0 'Anom' by 'up' , But in reality the two processes are not eliminated by leaving the actual worker process alive:  
  $ ps x | Grep resque 6864 ?? S 0: 05.15 resque-1.13.0: Waiting for makes 6858 S001 S + 0: 01.36 / Volumes/Users/sven/.rvm/rubies/ruby-1.8.7-p302/bin / Ruby / section / users / sven /. RVM / Gems / Rabbi-1.8.7-P302 / Bin / Dev-Config / Rescue- god-D    

You need to use the PID file generated by the defense and set the PID file

  w.env = {'PIDFILE' = & Gt; '/path/to/resque.pid'} w.pid_file = '/path/to/resque.pid'   

env rescue must be typed in the pid file, and pid_file God will tell you to use it

  w.env = {'PIDFILE' = & gt; Even svenfuchs have said that it should only be enough to set proper env. "/home/travis/.god/pids/#{w.name}.pid"}   

Where /home/travis/.god/pids is the default pides directory

Comments