mozilla-services/circus — pull request #761 by josegonzalez (2014-04-11 21:18:12+00:00)
Title: Allow sending arbitrary signals to child procs via resource watcher. Ref...

...s #756

Previously it was impossible to monitor the resource consumption of child processes. This doesn't affect cases where one mind bind to a file descriptor like Chausette and therefore use multiple top-level processes. However, there are cases where you might run processes under gunicorn - or similar - and have the master process sending off to the application that handles the request. In these cases, the master process will not feature the resource usage you might otherwise see.

You can now define the following config variables in the `resource_watcher` config:

- `process_children`: (boolean default False) Whether or not to also process child processes in determining min/max resource usage
- `child_signal`: (int default signal.SIGTERM) An integer mapping to a signal in the POSIX standard. Note that this may change from system to system re: the python implementation of the signal library.

In all cases, the original implementation of grouping master processes together stays the same. When `process_children` is set to True, each child process has it's resource consumption aggregated. If the resource consumption is higher than that defined by the resource_watcher config, then the signal specified in `child_signal` is sent to the process.

This commit also fixes the issue where not all counters were properly reset after restarting a watcher.