Rubygem God: Time limit configuration for process

断了今生、忘了曾经 提交于 2019-12-08 03:20:41

问题


I am using resque, resque-scheduler gems in my rails app. To monitor the working of resque workers, I am using God tool. I want to add such a god configuration, which will monitor the time of job running in the resque worker. If process execution exceeds the time limit, then it should restart the worker.

I read post at http://god.rubyforge.org/. However, couldn't peek the right code base for my requirement.

Any information will be highly appreciated.

Thanks.


回答1:


You could do something where your job creates a pid file, which you can use the FileMtime condition in god to monitor. When the job is finished, it recreates the pid file, if the file is older than x, restart the process with god.

source: https://github.com/mojombo/god/blob/856d321fb135a0b453046e99c266231681bd5ffe/lib/god/conditions/file_mtime.rb

Edit: Added github source




回答2:


i'm having the same problem:

the main problem is that the resque god recipe doesn't monit the child (forked) process, so you can't have control over the memory or the time they spent.

Here is a solution for observe the child process:

https://github.com/mojombo/god/issues/90 https://github.com/jbgo/god/commit/918bc278e4ca5b8133fe34db06c30ccb93dcb7f0

you can use your own gem forked from the origin to add this files, i preferred to require the new files from the god recipes...

For the time problem you can develop a new condition as the given for it (i'm doing it an will post it here).



来源:https://stackoverflow.com/questions/6041731/rubygem-god-time-limit-configuration-for-process

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!