Rubygem God:进程的时间限制配置
我在我的 Rails 应用程序中使用 resque、resque-scheduler gems。为了监控 resque 工作人员的工作,我正在使用 God 工具。我想添加这样一个上帝配置,它将监视resque工作器中运行的作业的时间。如果进程执行超过时间限制,则应重新启动工作线程。
我在 http://god.rubyforge.org/ 上阅读了帖子。但是,无法根据我的要求查看正确的代码库。
任何信息都将受到高度赞赏。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你可以做一些事情,你的工作创建一个 pid 文件,你可以使用 god 中的 FileMtime 条件来监视它。当作业完成时,它会重新创建 pid 文件,如果该文件早于 x,则用 god 重新启动该进程。
来源: https://github.com/mojombo/god /blob/856d321fb135a0b453046e99c266231681bd5ffe/lib/god/conditions/file_mtime.rb
编辑:添加了github源
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
我遇到了同样的问题:
主要问题是 resque god Recipe 不会监视子(分叉)进程,因此您无法控制内存或它们花费的时间。
这是观察子进程的解决方案:
https://github.com/mojombo/god/issues /90
https://github.com/jbgo/god/commit/918bc278e4ca5b8133fe34db06c30ccb93dcb7f0
您可以使用自己的宝石从原点分叉来添加此文件,我更喜欢需要来自上帝食谱的新文件...
对于时间问题,您可以开发一个新的条件作为给定的条件(我正在这样做,并将发布它)这里)。
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).