English 中文(简体)
我如何清除 st/stal工?
原标题:How do I clear stuck/stale Resque workers?

正如你从所附形象中可以看到的那样,我走过了似乎被困的夫妇。 这些进程不应超过两秒。

“enterography

我不敢肯定,为什么他们赢得了明确胜利或如何人工清除他们。

I m on Heroku using Resque with Redis-to-Go and HireFire to automatically scale workers.

最佳回答

没有一个这些解决办法对我有利,我仍然会看到这一点。

0 out of 10 Workers Working

最后,这为我扫清所有工人的工作:

Resque.workers.each {|w| w.unregister_worker}
问题回答

In your console:

queue_name = "process_numbers"
Resque.redis.del "queue:#{queue_name}"

否则,你会试图欺骗他们,就像他们去除他们那样做的:

Resque::Worker.working.each {|w| w.done_working}

http://www.ohchr.org。

许多人已经放弃了这一答案,我感到重要的是,人们必须尝试以 ha方式解决问题,而不要让工人坐在一旁,而上述法典删除了问题。 如果你乐于 f,那么冷却。

You probably have the resque gem installed, so you can open the console and get current workers

Resque.workers

工人名单

#=> [#<Worker infusion.local:40194-0:JAVA_DYNAMIC_QUEUES,index_migrator,converter,extractor>]

选择工人和prune_dead_workers,例如,第一例

Resque.workers.first.prune_dead_workers

除了用哈戈夫作答外,我只想能够找到一些时间的未婚工人。 下面的法典只剩300秒(5分钟)。

Resque.workers.each {|w| w.unregister_worker if w.processing[ run_at ] && Time.now - w.processing[ run_at ].to_time > 300}

我一直在收集与雷克相关的雷克任务,我也将此补充到:

在你指挥下开办服务器的地方维持这一指挥系统

$ ps -e -o pid,command | grep [r]esque

你们应当看到这样的情况:

92102 resque: Processing ProcessNumbers since 1253142769

我的榜样是92102

然后,你可以放弃2种方式中的第1项程序。

  • Gracefully use QUIT 92102

  • 武力使用

<><>>> 页: 1

让我知道,你是否有任何麻烦。

我刚才这样做了:

% rails c production
irb(main):001:0>Resque.workers

Got the list of workers.

irb(main):002:0>Resque.remove_worker(Resque.workers[n].id)

......如果是不受欢迎的工人的零基指数,则无。

还有一个类似的问题,即Redis拯救了银,使其包括残疾(非经营)工人。 每当Redis/resque开始的时候,就会出现这种情况。

采用下列方法确定:

Resque::Worker.working.each {|w| w.done_working}
Resque.redis.save # Save the DB to disk without ANY workers

确保你重新开始红利和你的遗体工人。

这里,你如何用东道国名称从Redis手中夺走。 当我停用一台服务器和工人没有体面地离开时,我就这样做了。

Resque.workers.each { |w| w.unregister_worker if w.id.start_with?(hostname) }

I ve cleared them out from redis-cli directly. Luckily redistogo.com allows access from environments outside heroku. Get dead worker ID from the list. Mine was

55ba6f3b-9287-4f81-987a-4e8ae7f51210:2

Run this command in redis directly.

del "resque:worker:55ba6f3b-9287-4f81-987a-4e8ae7f51210:2:*"

你们可以监测重新布局,看看看它在幕后做什么。

redis xxx.redistogo.com> MONITOR
OK
1380274567.540613 "MONITOR"
1380274568.345198 "incrby" "resque:stat:processed" "1"
1380274568.346898 "incrby" "resque:stat:processed:c65c8e2b-555a-4a57-aaa6-477b27d6452d:2:*" "1"
1380274568.346920 "del" "resque:worker:c65c8e2b-555a-4a57-aaa6-477b27d6452d:2:*"
1380274568.348803 "smembers" "resque:queues"

Second last line deletes the worker.

In resque 2.0.0, here s one way that seems to work to remove only actually appearantly-dead workers in resque 2.0.0:

Resque::Worker.all_workers_with_expired_heartbeats.each { |w| w.unregister_worker }

我不是一位专家,他们可以做得更好,或者会遇到问题。 我只是想说这一点。

这似乎将寄回“智能”的工人从resque workers list移走的时间大大超过预期。

如果母体工人处于“经营”状态,那么,在“失败”的工作岗位上将创造与原产地相应的新条目。

我也 st了/拖了工人,或者我说了工作,因为工人实际上仍然在那里,而且打上了罚款,这打上了 st的工序。

我选择了残酷的杀戮解决办法,因为有超过5名未成年人,通过双手套,然后工人就在下游,一切照旧。

查阅我的发言稿:https://gist.github.com/jobwat/5712437

如果你使用更新的Resque版本,那么当内部的APIC改变时,你需要使用以下指挥系统。

Resque::WorkerRegistry.working.each {|work| Resque::WorkerRegistry.remove(work.id)}

This avoids the problem as long as you have a resque version newer than 1.26.0:

resque: env QUEUE=foo TERM_CHILD=1 bundle exec rake resque:work

不要让目前从事的工作结束。

如果你使用Docker,你也可以使用这一指挥:

<id> 是工人补贴。

docker stop <id>

docker start <id>




相关问题
rails collection_select vs. select

collection_select and select Rails helpers: Which one should I use? I can t see a difference in both ways. Both helpers take a collection and generates options tags inside a select tag. Is there a ...

SSL slowness in EC2

We ve deployed our rails app to EC2. In our setup, we have two proxies on small instances behind round-robin DNS. These run nginx load balancers for a dynamically growing and shrinking farm of web ...

Auth-code with A-Za-z0-9 to use in an URL parameter

As part of a web application I need an auth-code to pass as a URL parameter. I am currently using (in Rails) : Digest::SHA1.hexdigest((object_id + rand(255)).to_s) Which provides long strings like : ...

RubyCAS-Client question: Rails

I ve installed RubyCAS-Client version 2.1.0 as a plugin within a rails app. It s working, but I d like to remove the ?ticket= in the url. Is this possible?

activerecord has_many :through find with one sql call

I have a these 3 models: class User < ActiveRecord::Base has_many :permissions, :dependent => :destroy has_many :roles, :through => :permissions end class Permission < ActiveRecord::...

Ordering a hash to xml: Rails

I m building an xml document from a hash. The xml attributes need to be in order. How can this be accomplished? hash.to_xml

Text Editor for Ruby-on-Rails

guys which text editor is good for Rubyonrails? i m using Windows and i was using E-Texteditor but its not free n its expired now can anyone plese tell me any free texteditor? n which one is best an ...

How to get SQL queries for each user where env is production

I’m developing an application dedicated to generate statistical reports, I would like that user after saving their stat report they save sql queries too. To do that I wrote the following module: ...

热门标签