Multiple Processes/PIDs per Watch #7

Open
foobarsucka opened this Issue Dec 19, 2009 · 5 comments

2 participants

@foobarsucka

Wanting to use God to watch delayed_job for a Rails app. I'd like to allow for multiple unique delayed_job workers using the -n switch available in delayed/command.rb. When this switch is used, multiple delayed_job worker processes are started, all using the same Rails environment to save memory. When these processes are started, PID files like delayed_job.0.pid, delayed_job.1.pid, etc are created in tmp/pids/.

If I specify "script/delayed_job -n 5 start" in my watch configuration for delayed_job, God seems to fail when watching the processes. I tried specifying "Dir['tmp/pids/delayed_job.*.pid'] as the pid_file in the watch, but I assume God is expecting a string here, not an array. I could just configure multiple god watches for multiple delayed_job processes similar to how people do it for Thin configurations, but that takes away the advantage of having multiple delayed_job workers being able to use the same Rails environment to save memory.

Any ideas? By the way, the God application is freaking awesome regardless. :)

@eric
Collaborator

There is no current support for child process monitoring.

We've been batting around ideas to solve this problem, as it's relevant for both Unicorn and Passenger as well as many other cases.

@foobarsucka

Can you share some of the current ideas? Can it be something as simple as monitoring all processes with PIDs specified in delayed_job.*.pid files? Does Unicorn and Passenger save their pids with similar file names like delayed_job does?

@eric
Collaborator

The current idea is that god would be able to automatically monitor all of the child processes (we can get that info from the OS).

It wouldn't include any mechanism to be "restarting" the child processes, just use the conditions to monitor if they were using too much CPU or RAM and have a mechanism to kill them.

@foobarsucka

Just checking in here. :) Has any progress been made on this? If not, how can I help? Hints on where to look for existing code would be helpful.

@eric
Collaborator

I have not had a chance to work on it.

My current thinking is that a custom kind of Watch would be created for each of the children.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment